diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libc/net/ruserok.c | 49 | 
1 files changed, 2 insertions, 47 deletions
| 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 | 
