;; IPv6 patch for uucpd on FreeBSD 2.2.8-RELEASE ;; Jan 29, 2000 by Hajimu UMEMOTO ;; --- libexec/uucpd/Makefile.orig Wed Sep 8 04:22:01 1999 +++ libexec/uucpd/Makefile Sat Jan 29 19:15:57 2000 @@ -3,6 +3,7 @@ PROG= uucpd MAN8= uucpd.8 -LDADD= -lcrypt -lutil +CFLAGS+=-DINET6 +LDADD= -L/usr/local/v6/lib -linet6 -lcrypt -lutil DPADD= ${LIBCRYPT} ${LIBUTIL} .include --- libexec/uucpd/uucpd.c.orig Wed Sep 8 04:22:01 1999 +++ libexec/uucpd/uucpd.c Sat Jan 29 19:14:23 2000 @@ -83,9 +83,15 @@ #define SCPYN(a, b) strncpy(a, b, sizeof (a)) +#ifdef INET6 +struct sockaddr_storage hisctladdr; +int hisaddrlen = sizeof hisctladdr; +struct sockaddr_storage myctladdr; +#else struct sockaddr_in hisctladdr; int hisaddrlen = sizeof hisctladdr; struct sockaddr_in myctladdr; +#endif int mypid; char Username[64], Logname[64]; @@ -97,10 +103,18 @@ extern char **environ; extern void logwtmp(char *line, char *name, char *host); +#ifdef INET6 +void doit(struct sockaddr *sinp); +#else void doit(struct sockaddr_in *sinp); +#endif void dologout(void); int readline(char start[], int num, int passw); +#ifdef INET6 +void dologin(struct passwd *pw, struct sockaddr *sin); +#else void dologin(struct passwd *pw, struct sockaddr_in *sin); +#endif void main(int argc, char **argv) { @@ -113,14 +127,26 @@ syslog(LOG_ERR, "getpeername: %m"); _exit(1); } +#ifdef INET6 + doit((struct sockaddr *)&hisctladdr); +#else doit(&hisctladdr); +#endif dologout(); exit(0); } +#ifdef INET6 +void badlogin(char *name, struct sockaddr *sin) +#else void badlogin(char *name, struct sockaddr_in *sin) +#endif { char remotehost[MAXHOSTNAMELEN]; +#ifdef INET6 + getnameinfo(sin, sin->sa_len, remotehost, sizeof remotehost, + NULL, 0, 0); +#else struct hostent *hp = gethostbyaddr((char *)&sin->sin_addr, sizeof (struct in_addr), AF_INET); @@ -132,6 +158,7 @@ sizeof (remotehost)); remotehost[sizeof remotehost - 1] = '\0'; +#endif syslog(LOG_NOTICE, "LOGIN FAILURE FROM %s", remotehost); syslog(LOG_AUTHPRIV|LOG_NOTICE, @@ -141,7 +168,11 @@ exit(1); } +#ifdef INET6 +void doit(struct sockaddr *sinp) +#else void doit(struct sockaddr_in *sinp) +#endif { char user[64], passwd[64]; char *xpasswd, *crypt(); @@ -244,12 +275,20 @@ /* * Record login in wtmp file. */ +#ifdef INET6 +void dologin(struct passwd *pw, struct sockaddr *sin) +#else void dologin(struct passwd *pw, struct sockaddr_in *sin) +#endif { char line[32]; char remotehost[MAXHOSTNAMELEN]; int f; time_t cur_time; +#ifdef INET6 + getnameinfo(sin, sin->sa_len, remotehost, sizeof(remotehost), + NULL, 0, 0); +#else struct hostent *hp = gethostbyaddr((char *)&sin->sin_addr, sizeof (struct in_addr), AF_INET); @@ -260,6 +299,7 @@ strncpy(remotehost, inet_ntoa(sin->sin_addr), sizeof (remotehost)); remotehost[sizeof remotehost - 1] = '\0'; +#endif /* hack, but must be unique and no tty line */ sprintf(line, "uucp%ld", (long)getpid()); time(&cur_time);