1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00

Make IPv6-enable ssh works on socks environment.

Submitted by:	Masahide -mac- NODA <mac@clave.gr.jp>
Reviewed by:	shin, Robert Muir <rmuir@looksharp.net>
		Toshihiko Kodama <kodama@ayame.mfd.cs.fujitsu.co.jp>
Approved by:	torstenb
This commit is contained in:
Munechika SUMIKAWA 2000-02-24 08:27:36 +00:00
parent 456424fe9e
commit 6e0bfd0c33
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=26248
3 changed files with 53 additions and 17 deletions

View File

@ -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;

View File

@ -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

View File

@ -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)