diff options
Diffstat (limited to 'lib/libc/net/rcmd.c')
-rw-r--r-- | lib/libc/net/rcmd.c | 72 |
1 files changed, 22 insertions, 50 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c index 2885dc3..c7ca870 100644 --- a/lib/libc/net/rcmd.c +++ b/lib/libc/net/rcmd.c @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #endif #include <arpa/nameser.h> #include "un-namespace.h" +#include "libc_private.h" extern int innetgr( const char *, const char *, const char *, const char * ); @@ -72,22 +73,15 @@ static int __icheckhost(const struct sockaddr *, socklen_t, const char *); char paddr[NI_MAXHOST]; int -rcmd(ahost, rport, locuser, remuser, cmd, fd2p) - char **ahost; - u_short rport; - const char *locuser, *remuser, *cmd; - int *fd2p; +rcmd(char **ahost, int rport, const char *locuser, const char *remuser, + const char *cmd, int *fd2p) { return rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, AF_INET); } int -rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) - char **ahost; - u_short rport; - const char *locuser, *remuser, *cmd; - int *fd2p; - int af; +rcmd_af(char **ahost, int rport, const char *locuser, const char *remuser, + const char *cmd, int *fd2p, int af) { struct addrinfo hints, *res, *ai; struct sockaddr_storage from; @@ -148,7 +142,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) refused = 0; sigemptyset(&newmask); sigaddset(&newmask, SIGURG); - _sigprocmask(SIG_BLOCK, (const sigset_t *)&newmask, &oldmask); + __libc_sigprocmask(SIG_BLOCK, (const sigset_t *)&newmask, &oldmask); for (timo = 1, lport = IPPORT_RESERVED - 1;;) { s = rresvport_af(&lport, ai->ai_family); if (s < 0) { @@ -163,7 +157,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) (void)fprintf(stderr, "rcmd: socket: %s\n", strerror(errno)); freeaddrinfo(res); - _sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, + __libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL); return (-1); } @@ -181,7 +175,7 @@ rcmd_af(ahost, rport, locuser, remuser, cmd, fd2p, af) (void)fprintf(stderr, "%s: %s\n", *ahost, strerror(errno)); freeaddrinfo(res); - _sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, + __libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL); return (-1); } @@ -306,7 +300,7 @@ again: } goto bad2; } - _sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL); + __libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL); freeaddrinfo(res); return (s); bad2: @@ -314,21 +308,19 @@ bad2: (void)_close(*fd2p); bad: (void)_close(s); - _sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL); + __libc_sigprocmask(SIG_SETMASK, (const sigset_t *)&oldmask, NULL); freeaddrinfo(res); return (-1); } int -rresvport(port) - int *port; +rresvport(int *port) { return rresvport_af(port, AF_INET); } int -rresvport_af(alport, family) - int *alport, family; +rresvport_af(int *alport, int family) { int s; struct sockaddr_storage ss; @@ -379,9 +371,7 @@ int __check_rhosts_file = 1; char *__rcmd_errstr; int -ruserok(rhost, superuser, ruser, luser) - const char *rhost, *ruser, *luser; - int superuser; +ruserok(const char *rhost, int superuser, const char *ruser, const char *luser) { struct addrinfo hints, *res, *r; int error; @@ -414,10 +404,7 @@ ruserok(rhost, superuser, ruser, luser) * Returns 0 if ok, -1 if not ok. */ int -iruserok(raddr, superuser, ruser, luser) - unsigned long raddr; - int superuser; - const char *ruser, *luser; +iruserok(unsigned long raddr, int superuser, const char *ruser, const char *luser) { struct sockaddr_in sin; @@ -435,11 +422,8 @@ iruserok(raddr, superuser, ruser, luser) * Returns 0 if ok, -1 if not ok. */ int -iruserok_sa(ra, rlen, superuser, ruser, luser) - const void *ra; - int rlen; - int superuser; - const char *ruser, *luser; +iruserok_sa(const void *ra, int rlen, int superuser, const char *ruser, + const char *luser) { char *cp; struct stat sbuf; @@ -519,10 +503,7 @@ again: * Returns 0 if ok, -1 if not ok. */ int -__ivaliduser(hostf, raddr, luser, ruser) - FILE *hostf; - u_int32_t raddr; - const char *luser, *ruser; +__ivaliduser(FILE *hostf, u_int32_t raddr, const char *luser, const char *ruser) { struct sockaddr_in sin; @@ -540,11 +521,8 @@ __ivaliduser(hostf, raddr, luser, ruser) * XXX obsolete API. */ int -__ivaliduser_af(hostf, raddr, luser, ruser, af, len) - FILE *hostf; - const void *raddr; - const char *luser, *ruser; - int af, len; +__ivaliduser_af(FILE *hostf, const void *raddr, const char *luser, + const char *ruser, int af, int len) { struct sockaddr *sa = NULL; struct sockaddr_in *sin = NULL; @@ -583,11 +561,8 @@ __ivaliduser_af(hostf, raddr, luser, ruser, af, len) } int -__ivaliduser_sa(hostf, raddr, salen, luser, ruser) - FILE *hostf; - const struct sockaddr *raddr; - socklen_t salen; - const char *luser, *ruser; +__ivaliduser_sa(FILE *hostf, const struct sockaddr *raddr, socklen_t salen, + const char *luser, const char *ruser) { char *user, *p; int ch; @@ -706,10 +681,7 @@ __ivaliduser_sa(hostf, raddr, salen, luser, ruser) * Returns "true" if match, 0 if no match. */ static int -__icheckhost(raddr, salen, lhost) - const struct sockaddr *raddr; - socklen_t salen; - const char *lhost; +__icheckhost(const struct sockaddr *raddr, socklen_t salen, const char *lhost) { struct sockaddr_in sin; struct sockaddr_in6 *sin6; |