diff options
-rw-r--r-- | usr.bin/rlogin/rlogin.c | 23 | ||||
-rw-r--r-- | usr.bin/rsh/rsh.c | 10 |
2 files changed, 22 insertions, 11 deletions
diff --git a/usr.bin/rlogin/rlogin.c b/usr.bin/rlogin/rlogin.c index 18361f6b818..3c7a0a9297b 100644 --- a/usr.bin/rlogin/rlogin.c +++ b/usr.bin/rlogin/rlogin.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rlogin.c,v 1.21 1998/07/12 08:07:12 deraadt Exp $ */ +/* $OpenBSD: rlogin.c,v 1.22 2000/01/27 05:27:42 itojun Exp $ */ /* $NetBSD: rlogin.c,v 1.8 1995/10/05 09:07:22 mycroft Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)rlogin.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$OpenBSD: rlogin.c,v 1.21 1998/07/12 08:07:12 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rlogin.c,v 1.22 2000/01/27 05:27:42 itojun Exp $"; #endif #endif /* not lint */ @@ -166,6 +166,8 @@ main(argc, argv) int omask; int argoff, ch, dflag, one, uid; char *host, *p, *user, term[64]; + struct sockaddr_storage ss; + socklen_t sslen; argoff = dflag = 0; one = 1; @@ -341,10 +343,11 @@ try_connect: "rlogin: the -x flag requires Kerberos authentication.\n"); exit(1); } - rem = rcmd(&host, sp->s_port, pw->pw_name, user, term, 0); + rem = rcmd_af(&host, sp->s_port, pw->pw_name, user, term, 0, + PF_UNSPEC); } #else - rem = rcmd(&host, sp->s_port, pw->pw_name, user, term, 0); + rem = rcmd_af(&host, sp->s_port, pw->pw_name, user, term, 0, PF_UNSPEC); #endif /* KERBEROS */ if (rem < 0) @@ -354,9 +357,15 @@ try_connect: setsockopt(rem, SOL_SOCKET, SO_DEBUG, &one, sizeof(one)) < 0) (void)fprintf(stderr, "rlogin: setsockopt: %s.\n", strerror(errno)); - one = IPTOS_LOWDELAY; - if (setsockopt(rem, IPPROTO_IP, IP_TOS, (char *)&one, sizeof(int)) < 0) - perror("rlogin: setsockopt TOS (ignored)"); + + sslen = sizeof(ss); + if (getsockname(rem, (struct sockaddr *)&ss, &sslen) == 0 && + ss.ss_family == AF_INET) { + one = IPTOS_LOWDELAY; + if (setsockopt(rem, IPPROTO_IP, IP_TOS, (char *)&one, + sizeof(int)) < 0) + perror("rlogin: setsockopt TOS (ignored)"); + } (void)seteuid(uid); (void)setuid(uid); diff --git a/usr.bin/rsh/rsh.c b/usr.bin/rsh/rsh.c index d5967e5c8f7..b2905d43b72 100644 --- a/usr.bin/rsh/rsh.c +++ b/usr.bin/rsh/rsh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsh.c,v 1.17 1998/03/25 19:53:21 art Exp $ */ +/* $OpenBSD: rsh.c,v 1.18 2000/01/27 05:27:42 itojun Exp $ */ /*- * Copyright (c) 1983, 1990 The Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)rsh.c 5.24 (Berkeley) 7/1/91";*/ -static char rcsid[] = "$OpenBSD: rsh.c,v 1.17 1998/03/25 19:53:21 art Exp $"; +static char rcsid[] = "$OpenBSD: rsh.c,v 1.18 2000/01/27 05:27:42 itojun Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -265,10 +265,12 @@ try_connect: "rsh: the -x flag requires Kerberos authentication.\n"); exit(1); } - rem = rcmd(&host, sp->s_port, pw->pw_name, user, args, &rfd2); + rem = rcmd_af(&host, sp->s_port, pw->pw_name, user, args, + &rfd2, PF_UNSPEC); } #else - rem = rcmd(&host, sp->s_port, pw->pw_name, user, args, &rfd2); + rem = rcmd_af(&host, sp->s_port, pw->pw_name, user, args, &rfd2, + PF_UNSPEC); #endif if (rem < 0) |