Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/rsh Support -4 and -6. Approved by christos.



details:   https://anonhg.NetBSD.org/src/rev/74208c3cf41f
branches:  trunk
changeset: 574735:74208c3cf41f
user:      ginsbach <ginsbach%NetBSD.org@localhost>
date:      Fri Mar 11 02:45:24 2005 +0000

description:
Support -4 and -6.  Approved by christos.

diffstat:

 usr.bin/rsh/rsh.1 |  12 ++++++++----
 usr.bin/rsh/rsh.c |  27 +++++++++++++++++----------
 2 files changed, 25 insertions(+), 14 deletions(-)

diffs (133 lines):

diff -r 4f6f23a670fa -r 74208c3cf41f usr.bin/rsh/rsh.1
--- a/usr.bin/rsh/rsh.1 Thu Mar 10 23:39:27 2005 +0000
+++ b/usr.bin/rsh/rsh.1 Fri Mar 11 02:45:24 2005 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: rsh.1,v 1.19 2004/09/05 08:48:32 wiz Exp $
+.\"    $NetBSD: rsh.1,v 1.20 2005/03/11 02:45:24 ginsbach Exp $
 .\"
 .\" Copyright (c) 1983, 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"    @(#)rsh.1       8.2 (Berkeley) 4/29/95
 .\"
-.Dd September 5, 2004
+.Dd March 9, 2005
 .Dt RSH 1
 .Os
 .Sh NAME
@@ -37,13 +37,13 @@
 .Nd remote shell
 .Sh SYNOPSIS
 .Nm
-.Op Fl dn
+.Op Fl 46dn
 .Op Fl l Ar username
 .Op Fl p Ar port
 .Ar host
 .Op command
 .Nm
-.Op Fl dn
+.Op Fl 46dn
 .Op Fl p Ar port
 .Ar username@host
 .Op command
@@ -64,6 +64,10 @@
 normally terminates when the remote command does.
 The options are as follows:
 .Bl -tag -width XlXusernameX
+.It Fl 4
+Use IPv4 addresses only.
+.It Fl 6
+Use IPv6 addresses only.
 .It Fl d
 The
 .Fl d
diff -r 4f6f23a670fa -r 74208c3cf41f usr.bin/rsh/rsh.c
--- a/usr.bin/rsh/rsh.c Thu Mar 10 23:39:27 2005 +0000
+++ b/usr.bin/rsh/rsh.c Fri Mar 11 02:45:24 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rsh.c,v 1.25 2005/01/13 23:02:28 ginsbach Exp $        */
+/*     $NetBSD: rsh.c,v 1.26 2005/03/11 02:45:24 ginsbach Exp $        */
 
 /*-
  * Copyright (c) 1983, 1990, 1993, 1994
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)rsh.c      8.4 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: rsh.c,v 1.25 2005/01/13 23:02:28 ginsbach Exp $");
+__RCSID("$NetBSD: rsh.c,v 1.26 2005/03/11 02:45:24 ginsbach Exp $");
 #endif
 #endif /* not lint */
 
@@ -111,6 +111,7 @@
        char    *locuser = 0, *loop;
 #endif /* IN_RCMD */
        int argoff, asrsh, ch, dflag, nflag, one, rem, i;
+       int family = AF_UNSPEC;
        pid_t pid;
        uid_t uid;
        char *args, *host, *p, *user, *name;
@@ -148,24 +149,24 @@
 
 # ifdef KERBEROS
 #  ifdef CRYPT
-#   define     OPTIONS "8KLdek:l:np:u:wx"
+#   define     OPTIONS "468KLdek:l:np:u:wx"
 #  else
-#   define     OPTIONS "8KLdek:l:np:u:w"
+#   define     OPTIONS "468KLdek:l:np:u:w"
 #  endif
 # else
-#  define      OPTIONS "8KLdel:np:u:w"
+#  define      OPTIONS "468KLdel:np:u:w"
 # endif
 
 #else /* IN_RCMD */
 
 # ifdef KERBEROS
 #  ifdef CRYPT
-#   define     OPTIONS "8KLdek:l:np:wx"
+#   define     OPTIONS "468KLdek:l:np:wx"
 #  else
-#   define     OPTIONS "8KLdek:l:np:w"
+#   define     OPTIONS "468KLdek:l:np:w"
 #  endif
 # else
-#  define      OPTIONS "8KLdel:np:w"
+#  define      OPTIONS "468KLdel:np:w"
 # endif
 
 #endif /* IN_RCMD */
@@ -177,6 +178,12 @@
                err(1, "malloc");
        while ((ch = getopt(argc - argoff, argv + argoff, OPTIONS)) != -1)
                switch(ch) {
+               case '4':
+                       family = AF_INET;
+                       break;
+               case '6':
+                       family = AF_INET6;
+                       break;
                case 'K':
 #ifdef KERBEROS
                        use_kerberos = 0;
@@ -331,7 +338,7 @@
                rem = rcmd_af(&host, sp->s_port,
 #endif
                    name,
-                   user, args, &remerr, PF_UNSPEC);
+                   user, args, &remerr, family);
        }
 #else /* KERBEROS */
 
@@ -340,7 +347,7 @@
 #else
        rem = rcmd_af(&host, sp->s_port,
 #endif
-           name, user, args, &remerr, PF_UNSPEC);
+           name, user, args, &remerr, family);
 #endif /* KERBEROS */
        (void)free(name);
 



Home | Main Index | Thread Index | Old Index