diff options
| author | guenther <> | 2016-05-23 00:12:58 +0000 |
|---|---|---|
| committer | guenther <> | 2016-05-23 00:12:58 +0000 |
| commit | 851addc3a6cbe261c45bbd9dc228610b97f154b8 (patch) | |
| tree | f7256b74785b49780f3e02898c313ac0d7be2ef2 | |
| parent | 6c7215cfad90336fdd579e1f21a1ebd7e867e482 (diff) | |
| download | openbsd-851addc3a6cbe261c45bbd9dc228610b97f154b8.tar.gz openbsd-851addc3a6cbe261c45bbd9dc228610b97f154b8.tar.bz2 openbsd-851addc3a6cbe261c45bbd9dc228610b97f154b8.zip | |
Remove iruserok(_sa)? and __ivaliduser(sa)?
ok millert@ deraadt@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libc/net/rcmd.3 | 61 | ||||
| -rw-r--r-- | src/lib/libc/net/ruserok.c | 49 |
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 |
| 59 | The | 53 | The |
| 60 | .Fn rcmd | 54 | .Fn rcmd |
| @@ -90,15 +84,10 @@ and | |||
| 90 | functions return a descriptor to a socket | 84 | functions return a descriptor to a socket |
| 91 | with an address in the privileged port space. | 85 | with an address in the privileged port space. |
| 92 | The | 86 | The |
| 93 | .Fn iruserok | ||
| 94 | and | ||
| 95 | .Fn ruserok | 87 | .Fn ruserok |
| 96 | functions are used by servers | 88 | function is used by servers |
| 97 | to authenticate clients requesting service with | 89 | to authenticate clients requesting service with |
| 98 | .Fn rcmd . | 90 | .Fn rcmd . |
| 99 | .Fn iruserok_sa | ||
| 100 | is an address family independent variant of | ||
| 101 | .Fn iruserok . | ||
| 102 | .Pp | 91 | .Pp |
| 103 | The | 92 | The |
| 104 | .Fn rcmd | 93 | .Fn rcmd |
| @@ -149,7 +138,7 @@ must be | |||
| 149 | .Fn rcmd_af | 138 | .Fn rcmd_af |
| 150 | takes address family in the last argument. | 139 | takes address family in the last argument. |
| 151 | If the last argument is | 140 | If the last argument is |
| 152 | .Dv PF_UNSPEC , | 141 | .Dv AF_UNSPEC , |
| 153 | interpretation of | 142 | interpretation of |
| 154 | .Fa *ahost | 143 | .Fa *ahost |
| 155 | will obey the underlying address resolution like DNS. | 144 | will obey the underlying address resolution like DNS. |
| @@ -174,11 +163,9 @@ need to be seeded with a port number; if that port | |||
| 174 | is not available these functions will find another. | 163 | is not available these functions will find another. |
| 175 | .Pp | 164 | .Pp |
| 176 | The | 165 | The |
| 177 | .Fn iruserok | ||
| 178 | and | ||
| 179 | .Fn ruserok | 166 | .Fn ruserok |
| 180 | functions take a remote host's IP address or name, respectively, | 167 | function takes a remote host's name, two user names, |
| 181 | two user names and a flag indicating whether the local user's | 168 | and a flag indicating whether the local user's |
| 182 | name is that of the superuser. | 169 | name is that of the superuser. |
| 183 | Then, if the user is | 170 | Then, 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 | |||
| 198 | file, or the host and remote user name are found in the | 185 | file, or the host and remote user name are found in the |
| 199 | .Pa .rhosts | 186 | .Pa .rhosts |
| 200 | file; otherwise | 187 | file; otherwise |
| 201 | .Fn iruserok | ||
| 202 | and | ||
| 203 | .Fn ruserok | 188 | .Fn ruserok |
| 204 | return \-1. | 189 | returns \-1. |
| 205 | If the local domain (as obtained from | 190 | If the local domain (as obtained from |
| 206 | .Xr gethostname 3 ) | 191 | .Xr gethostname 3 ) |
| 207 | is the same as the remote domain, only the machine name need be specified. | 192 | is the same as the remote domain, only the machine name need be specified. |
| 208 | .Pp | 193 | .Pp |
| 209 | If the IP address of the remote host is known, | ||
| 210 | .Fn iruserok | ||
| 211 | should be used in preference to | ||
| 212 | .Fn ruserok , | ||
| 213 | as it does not require trusting the DNS server for the remote host's domain. | ||
| 214 | .Pp | ||
| 215 | While | ||
| 216 | .Fn iruserok | ||
| 217 | can handle IPv4 addresses only, | ||
| 218 | .Fn iruserok_sa | ||
| 219 | and | ||
| 220 | .Fn ruserok | 194 | .Fn ruserok |
| 221 | can handle other address families as well, like IPv6. | 195 | implicitly requires trusting the DNS server for the remote host's domain. |
| 222 | The first argument of | ||
| 223 | .Fn iruserok_sa | ||
| 224 | is typed as | ||
| 225 | .Li "void *" | ||
| 226 | to avoid dependency between | ||
| 227 | .In unistd.h | ||
| 228 | and | ||
| 229 | .In sys/socket.h . | ||
| 230 | .Sh DIAGNOSTICS | 196 | .Sh DIAGNOSTICS |
| 231 | The | 197 | The |
| 232 | .Fn rcmd | 198 | .Fn rcmd |
| @@ -255,3 +221,12 @@ is overloaded to mean | |||
| 255 | These | 221 | These |
| 256 | functions appeared in | 222 | functions appeared in |
| 257 | .Bx 4.2 . | 223 | .Bx 4.2 . |
| 224 | .Pp | ||
| 225 | The | ||
| 226 | .Fn iruserok | ||
| 227 | and | ||
| 228 | .Fn iruserok_sa | ||
| 229 | functions, IP address based versions of | ||
| 230 | .Fn ruserok , | ||
| 231 | were 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 | ||
| 51 | int __ivaliduser(FILE *, in_addr_t, const char *, const char *); | 51 | static int __ivaliduser_sa(FILE *, struct sockaddr *, socklen_t, |
| 52 | int __ivaliduser_sa(FILE *, struct sockaddr *, socklen_t, | ||
| 53 | const char *, const char *); | 52 | const char *, const char *); |
| 54 | PROTO_NORMAL(__ivaliduser_sa); | ||
| 55 | static int __icheckhost(struct sockaddr *, socklen_t, const char *); | 53 | static int __icheckhost(struct sockaddr *, socklen_t, const char *); |
| 56 | static char *__gethostloop(struct sockaddr *, socklen_t); | 54 | static char *__gethostloop(struct sockaddr *, socklen_t); |
| 55 | static int iruserok_sa(const void *, int, int, const char *, const char *); | ||
| 57 | 56 | ||
| 58 | int | 57 | int |
| 59 | ruserok(const char *rhost, int superuser, const char *ruser, const char *luser) | 58 | ruserok(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 | */ | ||
| 91 | int | ||
| 92 | iruserok(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 | |||
| 104 | int | 81 | int |
| 105 | iruserok_sa(const void *raddr, int rlen, int superuser, const char *ruser, | 82 | iruserok_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 | } |
| 176 | DEF_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 | */ | ||
| 184 | int | ||
| 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 | ||
| 198 | int | 154 | int |
| 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, | |||
| 335 | bail: | 291 | bail: |
| 336 | return (-1); | 292 | return (-1); |
| 337 | } | 293 | } |
| 338 | DEF_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 |
