diff options
-rw-r--r-- | libexec/rpc.rquotad/rquotad.c | 4 | ||||
-rw-r--r-- | libexec/rpc.rstatd/rstatd.c | 6 | ||||
-rw-r--r-- | libexec/rpc.rusersd/rusersd.c | 6 | ||||
-rw-r--r-- | libexec/rpc.rwalld/rwalld.c | 6 | ||||
-rw-r--r-- | libexec/rpc.sprayd/sprayd.c | 6 | ||||
-rw-r--r-- | libexec/uucpd/uucpd.c | 40 |
6 files changed, 29 insertions, 39 deletions
diff --git a/libexec/rpc.rquotad/rquotad.c b/libexec/rpc.rquotad/rquotad.c index 15f72a164bc..46e061e6ef7 100644 --- a/libexec/rpc.rquotad/rquotad.c +++ b/libexec/rpc.rquotad/rquotad.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rquotad.c,v 1.18 2003/07/29 18:39:23 deraadt Exp $ */ +/* $OpenBSD: rquotad.c,v 1.19 2004/06/02 02:21:15 brad Exp $ */ /* * by Manuel Bouyer (bouyer@ensta.fr). Public domain. @@ -62,7 +62,7 @@ main(int argc, char *argv[]) SVCXPRT *transp; int sock = 0; int proto = 0; - struct sockaddr_in from; + struct sockaddr_storage from; socklen_t fromlen; fromlen = sizeof(from); diff --git a/libexec/rpc.rstatd/rstatd.c b/libexec/rpc.rstatd/rstatd.c index d9a8fd3b998..1af267a33ac 100644 --- a/libexec/rpc.rstatd/rstatd.c +++ b/libexec/rpc.rstatd/rstatd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rstatd.c,v 1.17 2004/01/07 21:12:24 millert Exp $ */ +/* $OpenBSD: rstatd.c,v 1.18 2004/06/02 02:21:15 brad Exp $ */ /*- * Copyright (c) 1993, John Brezak @@ -29,7 +29,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: rstatd.c,v 1.17 2004/01/07 21:12:24 millert Exp $"; +static char rcsid[] = "$OpenBSD: rstatd.c,v 1.18 2004/06/02 02:21:15 brad Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -71,7 +71,7 @@ main(int argc, char *argv[]) int sock = 0, proto = 0; socklen_t fromlen; struct passwd *pw; - struct sockaddr_in from; + struct sockaddr_storage from; SVCXPRT *transp; openlog("rpc.rstatd", LOG_NDELAY|LOG_CONS|LOG_PID, LOG_DAEMON); diff --git a/libexec/rpc.rusersd/rusersd.c b/libexec/rpc.rusersd/rusersd.c index 41a7adfa958..20c496ba826 100644 --- a/libexec/rpc.rusersd/rusersd.c +++ b/libexec/rpc.rusersd/rusersd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rusersd.c,v 1.13 2003/07/05 17:02:37 deraadt Exp $ */ +/* $OpenBSD: rusersd.c,v 1.14 2004/06/02 02:21:15 brad Exp $ */ /*- * Copyright (c) 1993 John Brezak @@ -29,7 +29,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: rusersd.c,v 1.13 2003/07/05 17:02:37 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rusersd.c,v 1.14 2004/06/02 02:21:15 brad Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -66,7 +66,7 @@ main(int argc, char *argv[]) { int sock = 0, proto = 0; socklen_t fromlen; - struct sockaddr_in from; + struct sockaddr_storage from; struct passwd *pw; SVCXPRT *transp; diff --git a/libexec/rpc.rwalld/rwalld.c b/libexec/rpc.rwalld/rwalld.c index c651706a45d..1f1b899592b 100644 --- a/libexec/rpc.rwalld/rwalld.c +++ b/libexec/rpc.rwalld/rwalld.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rwalld.c,v 1.11 2003/07/06 21:57:27 deraadt Exp $ */ +/* $OpenBSD: rwalld.c,v 1.12 2004/06/02 02:21:15 brad Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou @@ -30,7 +30,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: rwalld.c,v 1.11 2003/07/06 21:57:27 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: rwalld.c,v 1.12 2004/06/02 02:21:15 brad Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -69,7 +69,7 @@ main(int argc, char *argv[]) { int sock = 0, proto = 0; socklen_t fromlen; - struct sockaddr_in from; + struct sockaddr_storage from; SVCXPRT *transp; if (geteuid() == 0) { diff --git a/libexec/rpc.sprayd/sprayd.c b/libexec/rpc.sprayd/sprayd.c index 6975c001741..8a21a9448c0 100644 --- a/libexec/rpc.sprayd/sprayd.c +++ b/libexec/rpc.sprayd/sprayd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sprayd.c,v 1.8 2003/07/06 21:57:27 deraadt Exp $*/ +/* $OpenBSD: sprayd.c,v 1.9 2004/06/02 02:21:15 brad Exp $*/ /* * Copyright (c) 1994 Christos Zoulas @@ -32,7 +32,7 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: sprayd.c,v 1.8 2003/07/06 21:57:27 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: sprayd.c,v 1.9 2004/06/02 02:21:15 brad Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -71,7 +71,7 @@ main(int argc, char *argv[]) SVCXPRT *transp; int sock = 0; int proto = 0; - struct sockaddr_in from; + struct sockaddr_storage from; socklen_t fromlen; /* diff --git a/libexec/uucpd/uucpd.c b/libexec/uucpd/uucpd.c index 7a7516ecc9c..555e788dd0e 100644 --- a/libexec/uucpd/uucpd.c +++ b/libexec/uucpd/uucpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uucpd.c,v 1.28 2004/05/27 19:15:45 deraadt Exp $ */ +/* $OpenBSD: uucpd.c,v 1.29 2004/06/02 02:21:15 brad Exp $ */ /* * Copyright (c) 1985 The Regents of the University of California. @@ -40,7 +40,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)uucpd.c 5.10 (Berkeley) 2/26/91";*/ -static char rcsid[] = "$OpenBSD: uucpd.c,v 1.28 2004/05/27 19:15:45 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: uucpd.c,v 1.29 2004/06/02 02:21:15 brad Exp $"; #endif /* not lint */ /* @@ -69,14 +69,13 @@ static char rcsid[] = "$OpenBSD: uucpd.c,v 1.28 2004/05/27 19:15:45 deraadt Exp #include <fcntl.h> #include "pathnames.h" -void doit(struct sockaddr_in *); +void doit(struct sockaddr *); int readline(char *, int n); void dologout(void); -void dologin(struct passwd *, struct sockaddr_in *); +void dologin(struct passwd *, struct sockaddr *); -struct sockaddr_in hisctladdr; +struct sockaddr_storage hisctladdr; socklen_t hisaddrlen = sizeof hisctladdr; -struct sockaddr_in myctladdr; pid_t mypid; char Username[64], Loginname[64]; @@ -110,7 +109,7 @@ main(int argc, char *argv[]) _exit(1); } if ((childpid = fork()) == 0) - doit(&hisctladdr); + doit((struct sockaddr *)&hisctladdr); snprintf(utline, sizeof(utline), "uucp%.4ld", (long)childpid); dologout(); exit(1); @@ -166,7 +165,7 @@ main(int argc, char *argv[]) } void -doit(struct sockaddr_in *sinp) +doit(struct sockaddr *sa) { char user[64], passwd[64]; char *xpasswd; @@ -214,7 +213,7 @@ doit(struct sockaddr_in *sinp) alarm(0); (void) snprintf(Username, sizeof(Username), "USER=%s", user); (void) snprintf(Loginname, sizeof(Loginname), "LOGNAME=%s", user); - dologin(pw, sinp); + dologin(pw, sa); if (setusercontext(0, pw, pw->pw_uid, LOGIN_SETALL) != 0) { perror("unable to set user context"); return; @@ -276,30 +275,21 @@ dologout(void) * Record login in wtmp file. */ void -dologin(struct passwd *pw, struct sockaddr_in *sin) +dologin(struct passwd *pw, struct sockaddr *sa) { char line[32]; - char remotehost[MAXHOSTNAMELEN]; + char hbuf[NI_MAXHOST]; int wtmp, f; - struct hostent *hp; - - hp = gethostbyaddr((char *)&sin->sin_addr, - sizeof (struct in_addr), AF_INET); - - if (hp) { - strlcpy(remotehost, hp->h_name, sizeof(remotehost)); - endhostent(); - } else - strlcpy(remotehost, inet_ntoa(sin->sin_addr), - sizeof(remotehost)); + if (getnameinfo(sa, sa->sa_len, hbuf, sizeof(hbuf), NULL, 0, 0)) + (void)strlcpy(hbuf, "?", sizeof(hbuf)); wtmp = open(_PATH_WTMP, O_WRONLY|O_APPEND); if (wtmp >= 0) { /* hack, but must be unique and no tty line */ (void) snprintf(line, sizeof line, "uucp%.4ld", (long)getpid()); SCPYN(utmp.ut_line, line); SCPYN(utmp.ut_name, pw->pw_name); - SCPYN(utmp.ut_host, remotehost); + SCPYN(utmp.ut_host, hbuf); time(&utmp.ut_time); (void) write(wtmp, (char *)&utmp, sizeof (utmp)); (void) close(wtmp); @@ -309,8 +299,8 @@ dologin(struct passwd *pw, struct sockaddr_in *sin) time(&ll.ll_time); lseek(f, pw->pw_uid * sizeof(struct lastlog), 0); - SCPYN(ll.ll_line, remotehost); - SCPYN(ll.ll_host, remotehost); + SCPYN(ll.ll_line, hbuf); + SCPYN(ll.ll_host, hbuf); (void) write(f, (char *) &ll, sizeof ll); (void) close(f); } |