From cc791e22b1c78fa42cd47eca1b743e572660b167 Mon Sep 17 00:00:00 2001 From: sumikawa Date: Thu, 24 Feb 2000 08:27:36 +0000 Subject: Make IPv6-enable ssh works on socks environment. Submitted by: Masahide -mac- NODA Reviewed by: shin, Robert Muir Toshihiko Kodama Approved by: torstenb --- security/ssh/files/patch-al | 33 ++++++++++++++++++++++++--------- security/ssh/files/patch-bd | 17 ++++++++++++++--- security/ssh/files/patch-be | 20 +++++++++++++++----- 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/security/ssh/files/patch-al b/security/ssh/files/patch-al index 1bfbbb5f2542..7478124390e9 100644 --- a/security/ssh/files/patch-al +++ b/security/ssh/files/patch-al @@ -1,5 +1,5 @@ *** sshconnect.c.orig Wed May 12 13:19:29 1999 ---- sshconnect.c Wed Jan 12 00:34:55 2000 +--- sshconnect.c Thu Feb 24 17:12:10 2000 *************** *** 337,343 **** @@ -60,7 +60,7 @@ if (sock < 0) fatal("socket: %.100s", strerror(errno)); } ---- 345,392 ---- +--- 345,397 ---- bind our own socket to a privileged port. */ if (privileged) { @@ -80,8 +80,13 @@ ! hints.ai_flags = AI_PASSIVE; ! hints.ai_socktype = SOCK_STREAM; ! sprintf(strport, "%d", p); +! #if defined(SOCKS) +! if ((errgai = Rgetaddrinfo(NULL, strport, &hints, &ai)) != 0) +! fatal("getaddrinfo: %.100s", gai_strerror(errgai)); +! #else /* SOCKS */ ! if ((errgai = getaddrinfo(NULL, strport, &hints, &ai)) != 0) ! fatal("getaddrinfo: %.100s", gai_strerror(errgai)); +! #endif /* SOCKS */ /* Try to bind the socket to the privileged port. */ #if defined(SOCKS) @@ -125,7 +130,7 @@ #if defined(SO_LINGER) && defined(ENABLE_SO_LINGER) struct linger linger; #endif /* SO_LINGER */ ---- 403,421 ---- +--- 408,426 ---- the daemon. */ int ssh_connect(const char *host, int port, int connection_attempts, @@ -157,7 +162,7 @@ /* If a proxy command is given, connect using it. */ if (proxy_command != NULL && *proxy_command) return ssh_proxy_connect(host, port, original_real_uid, proxy_command, ---- 433,438 ---- +--- 438,443 ---- *************** *** 432,440 **** @@ -169,7 +174,7 @@ /* Try to connect several times. On some machines, the first time will sometimes fail. In general socket code appears to behave quite magically on many machines. */ ---- 440,467 ---- +--- 445,482 ---- /* No proxy command. */ @@ -177,8 +182,13 @@ ! hints.ai_family = IPv4or6; ! hints.ai_socktype = SOCK_STREAM; ! sprintf(strport, "%d", port); +! #if defined(SOCKS) +! if ((gaierr = Rgetaddrinfo(host, strport, &hints, &aitop)) != 0) +! fatal("Bad host name: %.100s (%s)", host, gai_strerror(gaierr)); +! #else /* SOCKS */ ! if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) ! fatal("Bad host name: %.100s (%s)", host, gai_strerror(gaierr)); +! #endif /* SOCKS */ ! ! #ifdef ENABLE_ANOTHER_PORT_TRY ! if (another_port) @@ -188,8 +198,13 @@ ! hints.ai_family = IPv4or6; ! hints.ai_socktype = SOCK_STREAM; ! sprintf(strport, "%d", another_port); +! #if defined(SOCKS) +! if ((gaierr = Rgetaddrinfo(host, strport, &hints, &aitop)) != 0) +! fatal("Bad host name: %.100s (%s)", host, gai_strerror(gaierr)); +! #else /* SOCKS */ ! if ((gaierr = getaddrinfo(host, strport, &hints, &aitop)) != 0) ! fatal("Bad host name: %.100s (%s)", host, gai_strerror(gaierr)); +! #endif /* SOCKS */ ! for (ai = aitop; ai->ai_next; ai = ai->ai_next); ! ai->ai_next = aitmp; ! } @@ -303,7 +318,7 @@ #endif /* SOCKS */ { /* Successful connection. */ ---- 470,496 ---- +--- 485,511 ---- if (attempt > 0) debug("Trying again..."); @@ -355,7 +370,7 @@ /* Return failure if we didn't get a successful connection. */ if (attempt >= connection_attempts) ---- 503,517 ---- +--- 518,532 ---- returned an error. */ shutdown(sock, 2); close(sock); @@ -373,7 +388,7 @@ if (attempt >= connection_attempts) *************** *** 578,586 **** ---- 522,532 ---- +--- 537,547 ---- /* Set socket options. We would like the socket to disappear as soon as it has been closed for whatever reason. */ /* setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *)&on, sizeof(on)); */ @@ -394,7 +409,7 @@ memset(&auth, 0 , sizeof(auth)); remotehost = (char *) get_canonical_hostname(); ---- 892,898 ---- +--- 907,913 ---- int ap_opts, ret_stat = 0; krb5_keyblock *session_key = 0; krb5_ap_rep_enc_part *repl = 0; diff --git a/security/ssh/files/patch-bd b/security/ssh/files/patch-bd index d6c0361ff73e..7cb3c119c216 100644 --- a/security/ssh/files/patch-bd +++ b/security/ssh/files/patch-bd @@ -1,8 +1,19 @@ *** config.h.in.orig Wed May 12 13:20:04 1999 ---- config.h.in Mon Jan 10 22:56:13 2000 +--- config.h.in Thu Feb 24 17:12:10 2000 +*************** +*** 285,290 **** +--- 285,292 ---- + #undef Rdup2 + #undef Rfclose + #undef Rgethostbyname ++ #undef Rgetaddrinfo ++ + + /* Set this to allow group writeability of $HOME, .ssh and authorized_keys */ + #undef ALLOW_GROUP_WRITEABILITY *************** *** 323,328 **** ---- 323,346 ---- +--- 325,348 ---- /etc/nologin.allow. */ #undef NOLOGIN_ALLOW @@ -29,7 +40,7 @@ *************** *** 375,385 **** ---- 393,409 ---- +--- 395,411 ---- /* Define if you have the ftruncate function. */ #undef HAVE_FTRUNCATE diff --git a/security/ssh/files/patch-be b/security/ssh/files/patch-be index c4e537fd0855..4bf46bb14df0 100644 --- a/security/ssh/files/patch-be +++ b/security/ssh/files/patch-be @@ -1,5 +1,5 @@ *** configure.in.orig Wed May 12 13:20:02 1999 ---- configure.in Sat Feb 12 15:32:11 2000 +--- configure.in Thu Feb 24 17:12:10 2000 *************** *** 30,37 **** --- 30,169 ---- @@ -328,8 +328,18 @@ KERBEROS_OBJS="auth-kerberos.o" ;; *************** +*** 1123,1128 **** +--- 1370,1376 ---- + AC_DEFINE(Rdup2,SOCKSdup2) + AC_DEFINE(Rfclose,SOCKSfclose) + AC_DEFINE(Rgethostbyname,SOCKSgethostbyname) ++ AC_DEFINE(Rgetaddrinfo,SOCKSgetaddrinfo) + fi + + AC_MSG_CHECKING(whether to use rsaref) +*************** *** 1252,1257 **** ---- 1499,1536 ---- +--- 1500,1537 ---- AC_DEFINE(ENABLE_TCP_NODELAY) ) @@ -370,7 +380,7 @@ [ --enable-so-linger Enable setting SO_LINGER socket option], *************** *** 1311,1316 **** ---- 1590,1597 ---- +--- 1591,1598 ---- AC_DEFINE(SCP_ALL_STATISTICS_ENABLED) ) @@ -388,7 +398,7 @@ AC_ARG_PROGRAM ---- 1605,1611 ---- +--- 1606,1612 ---- fi AC_MSG_RESULT($PIDDIR) @@ -402,7 +412,7 @@ AC_SUBST(SSHINSTALLMODE) ! AC_OUTPUT(Makefile sshd.8 ssh.1 make-ssh-known-hosts.1 zlib-1.0.4/Makefile) ---- 1617,1620 ---- +--- 1618,1621 ---- AC_SUBST(SSHDCONFOBJS) AC_SUBST(SSHINSTALLMODE) -- cgit