patch to support hurd-i386.
Markus Friedl
markus.friedl at informatik.uni-erlangen.de
Fri Dec 29 00:46:19 EST 2000
1) IMHO, Hurd should add a definition for MAXHOSTNAMELEN.
2) the patch does not use xmalloc,xrealloc
On Wed, Dec 27, 2000 at 11:51:20PM +0100, Christian Kurz wrote:
>
> Damn, forgot the rest of the patch. Here it comes.
>
> diff -Nur openssh-2.2.0p1-/ssh-keygen.c openssh-2.2.0p1/ssh-keygen.c
> --- openssh-2.2.0p1-/ssh-keygen.c Wed Aug 23 02:46:24 2000
> +++ openssh-2.2.0p1/ssh-keygen.c Sun Oct 29 16:44:50 2000
> @@ -68,7 +68,7 @@
> static const char *__progname = "ssh-keygen";
> #endif /* HAVE___PROGNAME */
>
> -char hostname[MAXHOSTNAMELEN];
> +char *hostname;
>
> void
> ask_filename(struct passwd *pw, const char *prompt)
> @@ -525,10 +525,24 @@
> printf("You don't exist, go away!\n");
> exit(1);
> }
> - if (gethostname(hostname, sizeof(hostname)) < 0) {
> - perror("gethostname");
> - exit(1);
> - }
> + {
> + size_t size = 100;
> + hostname = (char *)malloc(size);
> + while (hostname) {
> + if (gethostname(hostname, size) >= 0)
> + break;
> + if (errno != ENAMETOOLONG) {
> + perror("gethostname");
> + exit(1);
> + }
> + size <<= 1;
> + hostname = realloc(hostname, size);
> + }
> + if (hostname == NULL) {
> + perror("malloc");
> + exit(1);
> + }
> + }
>
> while ((opt = getopt(ac, av, "dqpclRxXyb:f:P:N:C:")) != EOF) {
> switch (opt) {
> diff -Nur openssh-2.2.0p1-/sshd.c openssh-2.2.0p1/sshd.c
> --- openssh-2.2.0p1-/sshd.c Tue Aug 29 02:05:50 2000
> +++ openssh-2.2.0p1/sshd.c Sun Oct 29 16:44:50 2000
> @@ -140,7 +140,7 @@
> int session_id2_len = 0;
>
> /* record remote hostname or ip */
> -unsigned int utmp_len = MAXHOSTNAMELEN;
> +unsigned int utmp_len = 256; /* bigger than LI_HOSTSIZE makes no sense */
>
> /* Prototypes for various functions defined later in this file. */
> void do_ssh1_kex();
>
> --
> Debian Developer and Quality Assurance Team Member
> 1024/26CC7853 31E6 A8CA 68FC 284F 7D16 63EC A9E6 67FF 26CC 7853
More information about the openssh-unix-dev
mailing list