Source-Changes-HG archive

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

[src/trunk]: src add IPv6 support to rcmd() and friends.



details:   https://anonhg.NetBSD.org/src/rev/cd66cfc9f194
branches:  trunk
changeset: 481362:cd66cfc9f194
user:      itojun <itojun%NetBSD.org@localhost>
date:      Thu Jan 27 05:33:06 2000 +0000

description:
add IPv6 support to rcmd() and friends.
        rcmd() and iruserok(): unchanged
        ruserok(): became address family independent
        rcmd_af(), iruesrok_sa(): address family independent

diffstat:

 distrib/sets/lists/comp/mi |   11 +-
 include/unistd.h           |    7 +-
 lib/libc/net/Makefile.inc  |   10 +-
 lib/libc/net/rcmd.3        |   59 ++++++-
 lib/libc/net/rcmd.c        |  359 +++++++++++++++++++++++++++++++++-----------
 5 files changed, 340 insertions(+), 106 deletions(-)

diffs (truncated from 874 to 300 lines):

diff -r 701ccc137689 -r cd66cfc9f194 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi        Thu Jan 27 05:17:12 2000 +0000
+++ b/distrib/sets/lists/comp/mi        Thu Jan 27 05:33:06 2000 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.187 2000/01/26 13:20:26 itojun Exp $
+# $NetBSD: mi,v 1.188 2000/01/27 05:33:07 itojun Exp $
 ./sys
 ./usr/bin/ar
 ./usr/bin/as
@@ -1882,6 +1882,7 @@
 ./usr/share/man/cat3/ipsec_set_policy.0
 ./usr/share/man/cat3/ipsec_strerror.0
 ./usr/share/man/cat3/iruserok.0
+./usr/share/man/cat3/iruserok_sa.0
 ./usr/share/man/cat3/isalnum.0
 ./usr/share/man/cat3/isalpha.0
 ./usr/share/man/cat3/isascii.0
@@ -2040,6 +2041,7 @@
 ./usr/share/man/cat3/openlog.0
 ./usr/share/man/cat3/openpty.0
 ./usr/share/man/cat3/orcmd.0
+./usr/share/man/cat3/orcmd_af.0
 ./usr/share/man/cat3/ossaudio.0
 ./usr/share/man/cat3/pause.0
 ./usr/share/man/cat3/pcap.0
@@ -2083,6 +2085,7 @@
 ./usr/share/man/cat3/rand_r.0
 ./usr/share/man/cat3/random.0
 ./usr/share/man/cat3/rcmd.0
+./usr/share/man/cat3/rcmd_af.0
 ./usr/share/man/cat3/re_comp.0
 ./usr/share/man/cat3/re_exec.0
 ./usr/share/man/cat3/readdir.0
@@ -2118,6 +2121,7 @@
 ./usr/share/man/cat3/rpc.0
 ./usr/share/man/cat3/rpc_createerr.0
 ./usr/share/man/cat3/rresvport.0
+./usr/share/man/cat3/rresvport_af.0
 ./usr/share/man/cat3/ruserok.0
 ./usr/share/man/cat3/scalb.0
 ./usr/share/man/cat3/scalbf.0
@@ -2988,6 +2992,7 @@
 ./usr/share/man/man3/bcmp.3
 ./usr/share/man/man3/bcopy.3
 ./usr/share/man/man3/bindresvport.3
+./usr/share/man/man3/bindresvport_sa.3
 ./usr/share/man/man3/bitstring.3
 ./usr/share/man/man3/bm.3
 ./usr/share/man/man3/bm_comp.3
@@ -3357,6 +3362,7 @@
 ./usr/share/man/man3/ipsec_set_policy.3
 ./usr/share/man/man3/ipsec_strerror.3
 ./usr/share/man/man3/iruserok.3
+./usr/share/man/man3/iruserok_sa.3
 ./usr/share/man/man3/isalnum.3
 ./usr/share/man/man3/isalpha.3
 ./usr/share/man/man3/isascii.3
@@ -3515,6 +3521,7 @@
 ./usr/share/man/man3/openlog.3
 ./usr/share/man/man3/openpty.3
 ./usr/share/man/man3/orcmd.3
+./usr/share/man/man3/orcmd_af.3
 ./usr/share/man/man3/ossaudio.3
 ./usr/share/man/man3/pause.3
 ./usr/share/man/man3/pcap.3
@@ -3558,6 +3565,7 @@
 ./usr/share/man/man3/rand_r.3
 ./usr/share/man/man3/random.3
 ./usr/share/man/man3/rcmd.3
+./usr/share/man/man3/rcmd_af.3
 ./usr/share/man/man3/re_comp.3
 ./usr/share/man/man3/re_exec.3
 ./usr/share/man/man3/readdir.3
@@ -3593,6 +3601,7 @@
 ./usr/share/man/man3/rpc.3
 ./usr/share/man/man3/rpc_createerr.3
 ./usr/share/man/man3/rresvport.3
+./usr/share/man/man3/rresvport_af.3
 ./usr/share/man/man3/ruserok.3
 ./usr/share/man/man3/scalb.3
 ./usr/share/man/man3/scalbf.3
diff -r 701ccc137689 -r cd66cfc9f194 include/unistd.h
--- a/include/unistd.h  Thu Jan 27 05:17:12 2000 +0000
+++ b/include/unistd.h  Thu Jan 27 05:33:06 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: unistd.h,v 1.80 2000/01/10 16:58:38 kleink Exp $       */
+/*     $NetBSD: unistd.h,v 1.81 2000/01/27 05:33:07 itojun Exp $       */
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -331,9 +331,10 @@
 int     undelete __P((const char *));
 
 #if 1 /*INET6*/
+int     rcmd_af __P((char **, int, const char *,
+           const char *, const char *, int *, int));
 int     rresvport_af __P((int *, int));
-int     ruserok_af __P((const char *, int, const char *, const char *, int));
-int     iruserok_af __P((const void *, int, const char *, const char *, int));
+int     iruserok_sa __P((const void *, int, int, const char *, const char *));
 #endif
 
 extern __const char *__const *sys_siglist __RENAME(__sys_siglist14);
diff -r 701ccc137689 -r cd66cfc9f194 lib/libc/net/Makefile.inc
--- a/lib/libc/net/Makefile.inc Thu Jan 27 05:17:12 2000 +0000
+++ b/lib/libc/net/Makefile.inc Thu Jan 27 05:33:06 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.47 2000/01/26 02:46:36 itojun Exp $
+#      $NetBSD: Makefile.inc,v 1.48 2000/01/27 05:33:06 itojun Exp $
 #      @(#)Makefile.inc        8.2 (Berkeley) 9/5/93
 
 # net sources
@@ -19,7 +19,7 @@
 # IPv6
 SRCS+= getaddrinfo.c getnameinfo.c ifname.c ip6opt.c rthdr.c vars6.c
 # need to revisit
-#SRCS+=        name6.c rresvport_af.c freehostent.c
+#SRCS+=        name6.c freehostent.c
 #CPPFLAGS+=    -DUSE_GETIPNODEBY
 
 LPREFIX=_nsyy
@@ -86,7 +86,9 @@
        inet6_rthdr_space.3 inet6_rthdr_reverse.3 \
        inet6_rthdr_space.3 inet6_rthdr_segments.3 \
        inet6_rthdr_space.3 inet6_rthdr_getaddr.3 \
-       inet6_rthdr_space.3 inet6_rthdr_getflags.3
+       inet6_rthdr_space.3 inet6_rthdr_getflags.3 \
+       rcmd.3 rcmd_af.3 rcmd.3 iruserok_sa.3 rcmd.3 rresvport_af.3 \
+       rcmd.3 orcmd_af.3
 # need to revisit
-#MAN+= getipnodebyname.3 rresvport_af.3
+#MAN+= getipnodebyname.3
 #MLINKS+=getipnodebyname.3 getipnodebyaddr.3 getipnodebyname.3 freehostent.3 \
diff -r 701ccc137689 -r cd66cfc9f194 lib/libc/net/rcmd.3
--- a/lib/libc/net/rcmd.3       Thu Jan 27 05:17:12 2000 +0000
+++ b/lib/libc/net/rcmd.3       Thu Jan 27 05:33:06 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: rcmd.3,v 1.18 1999/07/04 00:43:44 itojun Exp $
+.\"    $NetBSD: rcmd.3,v 1.19 2000/01/27 05:33:06 itojun Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -38,11 +38,14 @@
 .Os
 .Sh NAME
 .Nm rcmd ,
+.Nm orcmd ,
+.Nm rcmd_af ,
+.Nm orcmd_af ,
 .Nm rresvport ,
 .Nm rresvport_af ,
 .Nm iruserok ,
 .Nm ruserok ,
-.Nm orcmd
+.Nm iruserok_sa
 .Nd routines for returning a stream to a remote command
 .Sh LIBRARY
 .Lb libc
@@ -53,6 +56,10 @@
 .Ft int
 .Fn orcmd "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p"
 .Ft int
+.Fn rcmd_af "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p" "int af"
+.Ft int
+.Fn orcmd_af "char **ahost" "int inport" "const char *locuser" "const char *remuser" "const char *cmd" "int *fd2p" "int af"
+.Ft int
 .Fn rresvport "int *port"
 .Ft int
 .Fn rresvport_af "int *port" "int family"
@@ -60,6 +67,8 @@
 .Fn iruserok "u_int32_t raddr" "int superuser" "const char *ruser" "const char *luser"
 .Ft int
 .Fn ruserok "const char *rhost" "int superuser" "const char *ruser" "const char *luser"
+.Ft int
+.Fn iruserok_sa "const void *raddr" "int rlen" "int superuser" "const char *ruser" "const char *luser"
 .Sh DESCRIPTION
 The
 .Fn rcmd
@@ -80,6 +89,15 @@
 is used by the super-user to execute a command on
 a remote machine using an authentication scheme based
 on reserved port numbers.
+While
+.Fn rcmd
+and
+.Fn orcmd
+can only handle IPv4 address in the first argument,
+.Fn rcmd_af
+and
+.Fn orcmd_af
+can handle other cases as well.
 The
 .Fn rresvport
 function
@@ -107,6 +125,9 @@
 by the
 .Xr rshd 8
 server (among others).
+.Fn iruserok_sa
+is an address family independent variant of
+.Fn iruserok .
 .Pp
 The
 .Fn rcmd
@@ -154,6 +175,16 @@
 provision is made for sending arbitrary signals to the remote process,
 although you may be able to get its attention by using out-of-band data.
 .Pp
+.Fn rcmd_af
+and
+.Fn orcmd_af
+take address family in the last argument.
+If the last argument is
+.Dv PF_UNSPEC ,
+interpretation of
+.Fa *ahost
+will obey the underlying address resolution like DNS.
+.Pp
 The protocol is described in detail in
 .Xr rshd 8 .
 .Pp
@@ -207,6 +238,22 @@
 should be used in preference to
 .Fn ruserok ,
 as it does not require trusting the DNS server for the remote host's domain.
+.Pp
+While
+.Fn iruserok
+can handle IPv4 addresses only,
+.Fn iruserok_sa
+and
+.Fn ruserok
+can handle other address families as well, like IPv6.
+The first argument of
+.Fn iruserok_sa
+is typed as
+.Fa "void *"
+to avoid dependency between
+.Aq Li unistd.h
+and
+.Aq Li sys/socket.h .
 .Sh DIAGNOSTICS
 The
 .Fn rcmd
@@ -244,7 +291,7 @@
 .Xr rhosts 5 , 
 .Xr rexecd 8 ,
 .Xr rlogind 8 ,
-.Xr rshd 8 .
+.Xr rshd 8
 .Sh HISTORY
 The
 .Fn orcmd ,
@@ -257,13 +304,15 @@
 where the
 .Fn orcmd
 function was called
-.Fn rcmd.
+.Fn rcmd .
 The (newer)
 .Fn rcmd
 function appeared in
 .Nx 1.3 .
+.Fn rcmd_af
+and
 .Fn rresvport_af
-was defined in RFC2292.
+were defined in RFC2292.
 .Sh BUGS
 As the
 .Nm
diff -r 701ccc137689 -r cd66cfc9f194 lib/libc/net/rcmd.c
--- a/lib/libc/net/rcmd.c       Thu Jan 27 05:17:12 2000 +0000
+++ b/lib/libc/net/rcmd.c       Thu Jan 27 05:33:06 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rcmd.c,v 1.36 2000/01/22 23:36:17 mycroft Exp $        */
+/*     $NetBSD: rcmd.c,v 1.37 2000/01/27 05:33:06 itojun Exp $ */
 
 /*
  * Copyright (c) 1997 Matthew R. Green.
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)rcmd.c     8.3 (Berkeley) 3/26/94";
 #else
-__RCSID("$NetBSD: rcmd.c,v 1.36 2000/01/22 23:36:17 mycroft Exp $");
+__RCSID("$NetBSD: rcmd.c,v 1.37 2000/01/27 05:33:06 itojun Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -75,13 +75,17 @@
 
 int    orcmd __P((char **, u_int, const char *, const char *, const char *,
            int *));
+int    orcmd_af __P((char **, u_int, const char *, const char *, const char *,
+           int *, int));
 int    __ivaliduser __P((FILE *, u_int32_t, const char *, const char *));
+int    __ivaliduser_sa __P((FILE *, struct sockaddr *, const char *,
+           const char *));
 static int rshrcmd __P((char **, u_int32_t, const char *, const char *,
            const char *, int *, const char *));



Home | Main Index | Thread Index | Old Index