summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorguenther <>2016-05-23 00:12:58 +0000
committerguenther <>2016-05-23 00:12:58 +0000
commitf97f55cce24d9416bbf12dc5a5b5aae41e3c1ea4 (patch)
treef7256b74785b49780f3e02898c313ac0d7be2ef2 /src
parent482e5cd1b118cf0e45534687fd0cca2743dbd27b (diff)
downloadopenbsd-f97f55cce24d9416bbf12dc5a5b5aae41e3c1ea4.tar.gz
openbsd-f97f55cce24d9416bbf12dc5a5b5aae41e3c1ea4.tar.bz2
openbsd-f97f55cce24d9416bbf12dc5a5b5aae41e3c1ea4.zip
Remove iruserok(_sa)? and __ivaliduser(sa)?
ok millert@ deraadt@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libc/net/rcmd.361
-rw-r--r--src/lib/libc/net/ruserok.c49
2 files changed, 20 insertions, 90 deletions
diff --git a/src/lib/libc/net/rcmd.3 b/src/lib/libc/net/rcmd.3
index 5fe1ee58eb..3bba0bc73d 100644
--- a/src/lib/libc/net/rcmd.3
+++ b/src/lib/libc/net/rcmd.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: rcmd.3,v 1.32 2015/03/23 22:29:32 halex Exp $ 1.\" $OpenBSD: rcmd.3,v 1.33 2016/05/23 00:12:58 guenther Exp $
2.\" 2.\"
3.\" Copyright (c) 1983, 1991, 1993 3.\" Copyright (c) 1983, 1991, 1993
4.\" The Regents of the University of California. All rights reserved. 4.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE. 28.\" SUCH DAMAGE.
29.\" 29.\"
30.Dd $Mdocdate: March 23 2015 $ 30.Dd $Mdocdate: May 23 2016 $
31.Dt RCMD 3 31.Dt RCMD 3
32.Os 32.Os
33.Sh NAME 33.Sh NAME
@@ -35,9 +35,7 @@
35.Nm rcmd_af , 35.Nm rcmd_af ,
36.Nm rresvport , 36.Nm rresvport ,
37.Nm rresvport_af , 37.Nm rresvport_af ,
38.Nm iruserok , 38.Nm ruserok
39.Nm ruserok ,
40.Nm iruserok_sa
41.Nd routines for returning a stream to a remote command 39.Nd routines for returning a stream to a remote command
42.Sh SYNOPSIS 40.Sh SYNOPSIS
43.In unistd.h 41.In unistd.h
@@ -50,11 +48,7 @@
50.Ft int 48.Ft int
51.Fn rresvport_af "int *port" "int af" 49.Fn rresvport_af "int *port" "int af"
52.Ft int 50.Ft int
53.Fn iruserok "u_int32_t raddr" "int superuser" "const char *ruser" "const char *luser"
54.Ft int
55.Fn ruserok "const char *rhost" "int superuser" "const char *ruser" "const char *luser" 51.Fn ruserok "const char *rhost" "int superuser" "const char *ruser" "const char *luser"
56.Ft int
57.Fn iruserok_sa "const void *sa" "int salen" "int superuser" "const char *ruser" "const char *luser"
58.Sh DESCRIPTION 52.Sh DESCRIPTION
59The 53The
60.Fn rcmd 54.Fn rcmd
@@ -90,15 +84,10 @@ and
90functions return a descriptor to a socket 84functions return a descriptor to a socket
91with an address in the privileged port space. 85with an address in the privileged port space.
92The 86The
93.Fn iruserok
94and
95.Fn ruserok 87.Fn ruserok
96functions are used by servers 88function is used by servers
97to authenticate clients requesting service with 89to authenticate clients requesting service with
98.Fn rcmd . 90.Fn rcmd .
99.Fn iruserok_sa
100is an address family independent variant of
101.Fn iruserok .
102.Pp 91.Pp
103The 92The
104.Fn rcmd 93.Fn rcmd
@@ -149,7 +138,7 @@ must be
149.Fn rcmd_af 138.Fn rcmd_af
150takes address family in the last argument. 139takes address family in the last argument.
151If the last argument is 140If the last argument is
152.Dv PF_UNSPEC , 141.Dv AF_UNSPEC ,
153interpretation of 142interpretation of
154.Fa *ahost 143.Fa *ahost
155will obey the underlying address resolution like DNS. 144will obey the underlying address resolution like DNS.
@@ -174,11 +163,9 @@ need to be seeded with a port number; if that port
174is not available these functions will find another. 163is not available these functions will find another.
175.Pp 164.Pp
176The 165The
177.Fn iruserok
178and
179.Fn ruserok 166.Fn ruserok
180functions take a remote host's IP address or name, respectively, 167function takes a remote host's name, two user names,
181two user names and a flag indicating whether the local user's 168and a flag indicating whether the local user's
182name is that of the superuser. 169name is that of the superuser.
183Then, if the user is 170Then, if the user is
184.Em not 171.Em not
@@ -198,35 +185,14 @@ Zero is returned if the machine name is listed in the
198file, or the host and remote user name are found in the 185file, or the host and remote user name are found in the
199.Pa .rhosts 186.Pa .rhosts
200file; otherwise 187file; otherwise
201.Fn iruserok
202and
203.Fn ruserok 188.Fn ruserok
204return \-1. 189returns \-1.
205If the local domain (as obtained from 190If the local domain (as obtained from
206.Xr gethostname 3 ) 191.Xr gethostname 3 )
207is the same as the remote domain, only the machine name need be specified. 192is the same as the remote domain, only the machine name need be specified.
208.Pp 193.Pp
209If the IP address of the remote host is known,
210.Fn iruserok
211should be used in preference to
212.Fn ruserok ,
213as it does not require trusting the DNS server for the remote host's domain.
214.Pp
215While
216.Fn iruserok
217can handle IPv4 addresses only,
218.Fn iruserok_sa
219and
220.Fn ruserok 194.Fn ruserok
221can handle other address families as well, like IPv6. 195implicitly requires trusting the DNS server for the remote host's domain.
222The first argument of
223.Fn iruserok_sa
224is typed as
225.Li "void *"
226to avoid dependency between
227.In unistd.h
228and
229.In sys/socket.h .
230.Sh DIAGNOSTICS 196.Sh DIAGNOSTICS
231The 197The
232.Fn rcmd 198.Fn rcmd
@@ -255,3 +221,12 @@ is overloaded to mean
255These 221These
256functions appeared in 222functions appeared in
257.Bx 4.2 . 223.Bx 4.2 .
224.Pp
225The
226.Fn iruserok
227and
228.Fn iruserok_sa
229functions, IP address based versions of
230.Fn ruserok ,
231were removed in
232.Ox 6.0 .
diff --git a/src/lib/libc/net/ruserok.c b/src/lib/libc/net/ruserok.c
index 4218b419b7..cab6f96449 100644
--- a/src/lib/libc/net/ruserok.c
+++ b/src/lib/libc/net/ruserok.c
@@ -48,12 +48,11 @@
48#include <syslog.h> 48#include <syslog.h>
49#include <unistd.h> 49#include <unistd.h>
50 50
51int __ivaliduser(FILE *, in_addr_t, const char *, const char *); 51static int __ivaliduser_sa(FILE *, struct sockaddr *, socklen_t,
52int __ivaliduser_sa(FILE *, struct sockaddr *, socklen_t,
53 const char *, const char *); 52 const char *, const char *);
54PROTO_NORMAL(__ivaliduser_sa);
55static int __icheckhost(struct sockaddr *, socklen_t, const char *); 53static int __icheckhost(struct sockaddr *, socklen_t, const char *);
56static char *__gethostloop(struct sockaddr *, socklen_t); 54static char *__gethostloop(struct sockaddr *, socklen_t);
55static int iruserok_sa(const void *, int, int, const char *, const char *);
57 56
58int 57int
59ruserok(const char *rhost, int superuser, const char *ruser, const char *luser) 58ruserok(const char *rhost, int superuser, const char *ruser, const char *luser)
@@ -79,28 +78,6 @@ ruserok(const char *rhost, int superuser, const char *ruser, const char *luser)
79 return (-1); 78 return (-1);
80} 79}
81 80
82/*
83 * New .rhosts strategy: We are passed an ip address. We spin through
84 * hosts.equiv and .rhosts looking for a match. When the .rhosts only
85 * has ip addresses, we don't have to trust a nameserver. When it
86 * contains hostnames, we spin through the list of addresses the nameserver
87 * gives us and look for a match.
88 *
89 * Returns 0 if ok, -1 if not ok.
90 */
91int
92iruserok(u_int32_t raddr, int superuser, const char *ruser, const char *luser)
93{
94 struct sockaddr_in sin;
95
96 memset(&sin, 0, sizeof(sin));
97 sin.sin_family = AF_INET;
98 sin.sin_len = sizeof(struct sockaddr_in);
99 memcpy(&sin.sin_addr, &raddr, sizeof(sin.sin_addr));
100 return iruserok_sa(&sin, sizeof(struct sockaddr_in), superuser, ruser,
101 luser);
102}
103
104int 81int
105iruserok_sa(const void *raddr, int rlen, int superuser, const char *ruser, 82iruserok_sa(const void *raddr, int rlen, int superuser, const char *ruser,
106 const char *luser) 83 const char *luser)
@@ -173,27 +150,6 @@ again:
173 } 150 }
174 return (-1); 151 return (-1);
175} 152}
176DEF_WEAK(iruserok_sa);
177
178/*
179 * XXX
180 * Don't make static, used by lpd(8).
181 *
182 * Returns 0 if ok, -1 if not ok.
183 */
184int
185__ivaliduser(FILE *hostf, in_addr_t raddrl, const char *luser,
186 const char *ruser)
187{
188 struct sockaddr_in sin;
189
190 memset(&sin, 0, sizeof(sin));
191 sin.sin_family = AF_INET;
192 sin.sin_len = sizeof(struct sockaddr_in);
193 memcpy(&sin.sin_addr, &raddrl, sizeof(sin.sin_addr));
194 return __ivaliduser_sa(hostf, (struct sockaddr *)&sin, sin.sin_len,
195 luser, ruser);
196}
197 153
198int 154int
199__ivaliduser_sa(FILE *hostf, struct sockaddr *raddr, socklen_t salen, 155__ivaliduser_sa(FILE *hostf, struct sockaddr *raddr, socklen_t salen,
@@ -335,7 +291,6 @@ __ivaliduser_sa(FILE *hostf, struct sockaddr *raddr, socklen_t salen,
335bail: 291bail:
336 return (-1); 292 return (-1);
337} 293}
338DEF_STRONG(__ivaliduser_sa);
339 294
340/* 295/*
341 * Returns "true" if match, 0 if no match. If we do not find any 296 * Returns "true" if match, 0 if no match. If we do not find any