Blame SOURCES/bsd-finger-0.17-usagi-ipv6.patch

c7b137
diff -uNr bsd-finger-0.17/CVS/Entries bsd-finger/CVS/Entries
c7b137
--- bsd-finger-0.17/CVS/Entries	Thu Jan  1 02:00:00 1970
c7b137
+++ bsd-finger/CVS/Entries	Fri Mar  9 00:00:29 2001
c7b137
@@ -0,0 +1,11 @@
c7b137
+/.cvsignore/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/BUGS/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/ChangeLog/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/MCONFIG.in/1.3/Sat Jan 27 04:14:52 2001//
c7b137
+/MRULES/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/Makefile/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/README/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/configure/1.5/Sat Jan 27 04:14:52 2001//
c7b137
+/version.h/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+D/finger////
c7b137
+D/fingerd////
c7b137
diff -uNr bsd-finger-0.17/CVS/Repository bsd-finger/CVS/Repository
c7b137
--- bsd-finger-0.17/CVS/Repository	Thu Jan  1 02:00:00 1970
c7b137
+++ bsd-finger/CVS/Repository	Mon Feb 19 06:50:43 2001
c7b137
@@ -0,0 +1 @@
c7b137
+usagi/src/bsd-finger
c7b137
diff -uNr bsd-finger-0.17/CVS/Root bsd-finger/CVS/Root
c7b137
--- bsd-finger-0.17/CVS/Root	Thu Jan  1 02:00:00 1970
c7b137
+++ bsd-finger/CVS/Root	Mon Feb 19 06:50:43 2001
c7b137
@@ -0,0 +1 @@
c7b137
+:pserver:anoncvs@anoncvs.linux-ipv6.org:/cvsroot/usagi
c7b137
diff -uNr bsd-finger-0.17/configure bsd-finger/configure
c7b137
--- bsd-finger-0.17/configure	Sat Jul 29 21:00:27 2000
c7b137
+++ bsd-finger/configure	Sat Jan 27 06:14:52 2001
c7b137
@@ -25,6 +25,7 @@
c7b137
     --daemonmode=mode     Mode for daemon binaries [same as binmode]
c7b137
     --manmode=mode        Mode for manual pages [644]
c7b137
     --with-c-compiler=cc  Program for compiling C source [guessed]
c7b137
+    --enable-ipv6         Enable IPv6 support
c7b137
 EOF
c7b137
 	exit 0;;
c7b137
 	--verbose) ;;
c7b137
@@ -40,6 +41,11 @@
c7b137
 	--daemonmode=*) DAEMONMODE=`echo $1 | sed 's/^[^=]*=//'` ;;
c7b137
 	--manmode=*) MANMODE=`echo $1 | sed 's/^[^=]*=//'` ;;
c7b137
 	--with-c-compiler=*) CC=`echo $1 | sed 's/^[^=]*=//'` ;;
c7b137
+
c7b137
+	--disable-ipv6) ENABLE_IPV6=no;;
c7b137
+	--enable-ipv6=*) ENABLE_IPV6=`echo $1 | sed 's/^[^=]*=//'`;;
c7b137
+	--enable-ipv6) ENABLE_IPV6=yes;;
c7b137
+
c7b137
 	*) echo "Unrecognized option: $1"; exit 1;;
c7b137
 esac 
c7b137
 shift
c7b137
@@ -148,6 +154,42 @@
c7b137
 
c7b137
 LDFLAGS=
c7b137
 LIBS=
c7b137
+
c7b137
+rm -f __conftest*
c7b137
+
c7b137
+##################################################
c7b137
+## Enable IPv6
c7b137
+echo -n "Whether to enable IPv6 support... "
c7b137
+if [ x"$ENABLE_IPV6" = x"yes" ]; then
c7b137
+    echo yes
c7b137
+    CFLAGS="$CFLAGS -DINET6"
c7b137
+else
c7b137
+    echo no
c7b137
+fi
c7b137
+
c7b137
+rm -f __conftest*
c7b137
+
c7b137
+## Search IPv6 Library / Headers
c7b137
+if [ x"$ENABLE_IPV6" = x"yes" ]; then
c7b137
+    echo -n "Search for IPv6 library... "
c7b137
+    inet6libdirs="/usr/local/v6/lib /usr/local/lib /usr /usr/inet6/lib"
c7b137
+    inet6libs="inet6"
c7b137
+    inet6found=no
c7b137
+    for inet6libdir in $inet6libdirs; do
c7b137
+        for inet6lib in $inet6libs; do
c7b137
+            if [ -d $inet6libdir ] && [ -f $inet6libdir/lib$inet6lib.a ]; then
c7b137
+                inet6found=yes
c7b137
+                break 2
c7b137
+            fi
c7b137
+        done
c7b137
+    done
c7b137
+    if [ x"$inet6found" = x"yes" ]; then
c7b137
+        echo "$inet6libdir/lib$inet6lib.a"
c7b137
+        LIBS="$LIBS -L$inet6libdir -l$inet6lib"
c7b137
+    else
c7b137
+        echo "not found"
c7b137
+    fi
c7b137
+fi
c7b137
 
c7b137
 rm -f __conftest*
c7b137
 
c7b137
diff -uNr bsd-finger-0.17/finger/CVS/Entries bsd-finger/finger/CVS/Entries
c7b137
--- bsd-finger-0.17/finger/CVS/Entries	Thu Jan  1 02:00:00 1970
c7b137
+++ bsd-finger/finger/CVS/Entries	Mon Feb 19 06:50:43 2001
c7b137
@@ -0,0 +1,11 @@
c7b137
+/.cvsignore/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/Makefile/1.4/Sat Jan 27 05:57:07 2001//
c7b137
+/display.c/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/finger.1/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/finger.c/1.3/Sun Feb 11 09:33:52 2001//
c7b137
+/finger.h/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/lprint.c/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/net.c/1.3/Fri Jan 26 18:08:21 2001//
c7b137
+/sprint.c/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/util.c/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+D
c7b137
diff -uNr bsd-finger-0.17/finger/CVS/Repository bsd-finger/finger/CVS/Repository
c7b137
--- bsd-finger-0.17/finger/CVS/Repository	Thu Jan  1 02:00:00 1970
c7b137
+++ bsd-finger/finger/CVS/Repository	Mon Feb 19 06:50:43 2001
c7b137
@@ -0,0 +1 @@
c7b137
+usagi/src/bsd-finger/finger
c7b137
diff -uNr bsd-finger-0.17/finger/CVS/Root bsd-finger/finger/CVS/Root
c7b137
--- bsd-finger-0.17/finger/CVS/Root	Thu Jan  1 02:00:00 1970
c7b137
+++ bsd-finger/finger/CVS/Root	Mon Feb 19 06:50:43 2001
c7b137
@@ -0,0 +1 @@
c7b137
+:pserver:anoncvs@anoncvs.linux-ipv6.org:/cvsroot/usagi
c7b137
diff -uNr bsd-finger-0.17/finger/Makefile bsd-finger/finger/Makefile
c7b137
--- bsd-finger-0.17/finger/Makefile	Sun Dec 12 20:04:52 1999
c7b137
+++ bsd-finger/finger/Makefile	Sat Jan 27 07:57:07 2001
c7b137
@@ -10,7 +10,9 @@
c7b137
 finger.o: ../version.h
c7b137
 
c7b137
 install: finger
c7b137
+	install -d $(INSTALLROOT)$(BINDIR)
c7b137
 	install -s -m$(BINMODE) finger $(INSTALLROOT)$(BINDIR)
c7b137
+	install -d $(INSTALLROOT)$(MANDIR)/man1
c7b137
 	install -m$(MANMODE) finger.1 $(INSTALLROOT)$(MANDIR)/man1
c7b137
 
c7b137
 clean:
c7b137
diff -uNr bsd-finger-0.17/finger/finger.1 bsd-finger/finger/finger.1
c7b137
--- bsd-finger-0.17/finger/finger.1	Mon Jul 31 02:56:57 2000
c7b137
+++ bsd-finger/finger/finger.1	Fri Nov  3 21:18:15 2000
c7b137
@@ -30,7 +30,7 @@
c7b137
 .\" SUCH DAMAGE.
c7b137
 .\"
c7b137
 .\"	from: @(#)finger.1	6.14 (Berkeley) 7/27/91
c7b137
-.\"	$Id: finger.1,v 1.18 2000/07/30 23:56:57 dholland Exp $
c7b137
+.\"	$Id: finger.1,v 1.1.1.1 2000/11/03 19:18:15 mk Exp $
c7b137
 .\"
c7b137
 .Dd August 15, 1999
c7b137
 .Dt FINGER 1
c7b137
diff -uNr bsd-finger-0.17/finger/finger.c bsd-finger/finger/finger.c
c7b137
--- bsd-finger-0.17/finger/finger.c	Sat Dec 18 18:41:51 1999
c7b137
+++ bsd-finger/finger/finger.c	Sun Feb 11 11:33:52 2001
c7b137
@@ -1,3 +1,5 @@
c7b137
+/* $USAGI$ */
c7b137
+
c7b137
 /*
c7b137
  * Copyright (c) 1989 The Regents of the University of California.
c7b137
  * All rights reserved.
c7b137
@@ -46,7 +48,7 @@
c7b137
  * from: @(#)finger.c	5.22 (Berkeley) 6/29/90 
c7b137
  */
c7b137
 char finger_rcsid[] = \
c7b137
-  "$Id: finger.c,v 1.15 1999/12/18 16:41:51 dholland Exp $";
c7b137
+  "$Id: finger.c,v 1.3 2001/02/11 09:33:52 yoshfuji Exp $";
c7b137
 
c7b137
 /*
c7b137
  * Finger prints out information about users.  It is not portable since
c7b137
@@ -74,7 +76,11 @@
c7b137
 #include <time.h>
c7b137
 #include <getopt.h>
c7b137
 #include "finger.h"
c7b137
+#ifdef _USAGI
c7b137
+#include "version.h"
c7b137
+#else
c7b137
 #include "../version.h"
c7b137
+#endif
c7b137
 
c7b137
 static void loginlist(void);
c7b137
 static void userlist(int argc, char *argv[]);
c7b137
@@ -92,8 +98,12 @@
c7b137
 
c7b137
 int main(int argc, char *argv[]) {
c7b137
 	int ch;
c7b137
-	struct sockaddr_in sin;
c7b137
-	socklen_t slen = sizeof(sin);
c7b137
+#ifdef INET6
c7b137
+	struct sockaddr_storage sa;
c7b137
+#else
c7b137
+	struct sockaddr sa;
c7b137
+#endif
c7b137
+	socklen_t slen = sizeof(sa);
c7b137
 
c7b137
 	while ((ch = getopt(argc, argv, "lmps")) != EOF) {
c7b137
 		switch(ch) {
c7b137
@@ -119,7 +129,7 @@
c7b137
 	argc -= optind;
c7b137
 	argv += optind;
c7b137
 
c7b137
-	if (getsockname(STDOUT_FILENO, (struct sockaddr *)&sin, &slen)==0) {
c7b137
+	if (getsockname(STDOUT_FILENO, (struct sockaddr *)&sa, &slen)==0) {
c7b137
 		/*
c7b137
 		 * stdout is a socket. must be a network finger request,
c7b137
 		 * so emit CRs with our LFs at the ends of lines.
c7b137
@@ -136,7 +146,7 @@
c7b137
 	 * Also check stdin for nofinger processing, because of older
c7b137
 	 * fingerds that make stdout a pipe for CRLF handling.
c7b137
 	 */
c7b137
-	if (getsockname(STDIN_FILENO, (struct sockaddr *)&sin, &slen)==0) {
c7b137
+	if (getsockname(STDIN_FILENO, (struct sockaddr *)&sa, &slen)==0) {
c7b137
 		enable_nofinger = 1;
c7b137
 	}	
c7b137
 
c7b137
diff -uNr bsd-finger-0.17/finger/finger.h bsd-finger/finger/finger.h
c7b137
--- bsd-finger-0.17/finger/finger.h	Tue Sep 14 13:51:11 1999
c7b137
+++ bsd-finger/finger/finger.h	Fri Nov  3 21:18:15 2000
c7b137
@@ -34,7 +34,7 @@
c7b137
  * SUCH DAMAGE.
c7b137
  *
c7b137
  *	from: @(#)finger.h	5.5 (Berkeley) 6/1/90
c7b137
- *	$Id: finger.h,v 1.7 1999/09/14 10:51:11 dholland Exp $
c7b137
+ *	$Id: finger.h,v 1.1.1.1 2000/11/03 19:18:15 mk Exp $
c7b137
  */
c7b137
 
c7b137
 #include <pwd.h>
c7b137
diff -uNr bsd-finger-0.17/finger/lprint.c bsd-finger/finger/lprint.c
c7b137
--- bsd-finger-0.17/finger/lprint.c	Tue Sep 14 13:51:11 1999
c7b137
+++ bsd-finger/finger/lprint.c	Fri Nov  3 21:18:15 2000
c7b137
@@ -38,7 +38,7 @@
c7b137
  * from: @(#)lprint.c	5.13 (Berkeley) 10/31/90
c7b137
  */
c7b137
 char lprint_rcsid[] = 
c7b137
-  "$Id: lprint.c,v 1.11 1999/09/14 10:51:11 dholland Exp $";
c7b137
+  "$Id: lprint.c,v 1.1.1.1 2000/11/03 19:18:15 mk Exp $";
c7b137
 
c7b137
 #include <stdio.h>
c7b137
 #include <ctype.h>
c7b137
diff -uNr bsd-finger-0.17/finger/net.c bsd-finger/finger/net.c
c7b137
--- bsd-finger-0.17/finger/net.c	Tue Sep 14 13:51:11 1999
c7b137
+++ bsd-finger/finger/net.c	Fri Jan 26 20:08:21 2001
c7b137
@@ -1,3 +1,5 @@
c7b137
+/* $USAGI: net.c,v 1.2 2000/11/17 08:00:44 yoshfuji Exp $ */
c7b137
+
c7b137
 /*
c7b137
  * Copyright (c) 1989 The Regents of the University of California.
c7b137
  * All rights reserved.
c7b137
@@ -36,7 +38,7 @@
c7b137
 
c7b137
 #ifndef lint
c7b137
 /*static char sccsid[] = "from: @(#)net.c	5.5 (Berkeley) 6/1/90";*/
c7b137
-char net_rcsid[] = "$Id: net.c,v 1.9 1999/09/14 10:51:11 dholland Exp $";
c7b137
+char net_rcsid[] = "$Id: net.c,v 1.3 2001/01/26 18:08:21 yoshfuji Exp $";
c7b137
 #endif /* not lint */
c7b137
 
c7b137
 #include <sys/types.h>
c7b137
@@ -53,18 +55,53 @@
c7b137
 
c7b137
 void netfinger(const char *name) {
c7b137
 	register FILE *fp;
c7b137
-	struct in_addr defaddr;
c7b137
 	register int c, sawret, ateol;
c7b137
+#ifdef INET6
c7b137
+	struct addrinfo hints, *res0, *res;
c7b137
+	int gai;
c7b137
+#else
c7b137
+	struct in_addr defaddr;
c7b137
 	struct hostent *hp, def;
c7b137
 	struct servent *sp;
c7b137
 	struct sockaddr_in sn;
c7b137
+	char *alist[1];
c7b137
+#endif
c7b137
 	int s;
c7b137
-	char *alist[1], *host;
c7b137
+	char *host;
c7b137
 
c7b137
 	host = strrchr(name, '@');
c7b137
 	if (!host) return;
c7b137
 	*host++ = '\0';
c7b137
 
c7b137
+#ifdef INET6
c7b137
+	memset(&hints, 0, sizeof(hints));
c7b137
+	hints.ai_family = PF_UNSPEC;
c7b137
+	hints.ai_socktype = SOCK_STREAM;
c7b137
+	gai = getaddrinfo(host, "finger", &hints, &res0);
c7b137
+	if (gai) {
c7b137
+		eprintf("finger: %s: host '%s', service '%s'\n",
c7b137
+			gai_strerror(gai), host, "finger");
c7b137
+		return;
c7b137
+	}
c7b137
+	s = -1;
c7b137
+	errno = 0;
c7b137
+	for (res=res0; res; res=res->ai_next) {
c7b137
+		s = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
c7b137
+		if (s < 0)
c7b137
+			continue;
c7b137
+		if (connect(s, res->ai_addr, res->ai_addrlen) < 0){
c7b137
+			close(s);
c7b137
+			s = -1;
c7b137
+			continue;
c7b137
+		}
c7b137
+		break;
c7b137
+	}
c7b137
+	freeaddrinfo(res0);
c7b137
+	if (s < 0) {
c7b137
+		eprintf("finger: cannot create socket / connet host\n");
c7b137
+		return;
c7b137
+	}
c7b137
+#else
c7b137
 	memset(&sn, 0, sizeof(sn));
c7b137
 
c7b137
 	sp = getservbyname("finger", "tcp");
c7b137
@@ -106,6 +143,7 @@
c7b137
 		close(s);
c7b137
 		return;
c7b137
 	}
c7b137
+#endif
c7b137
 
c7b137
 	/* -l flag for remote fingerd  */
c7b137
 	if (lflag) write(s, "/W ", 3);
c7b137
diff -uNr bsd-finger-0.17/finger/sprint.c bsd-finger/finger/sprint.c
c7b137
--- bsd-finger-0.17/finger/sprint.c	Sun Dec 12 20:59:33 1999
c7b137
+++ bsd-finger/finger/sprint.c	Fri Nov  3 21:18:15 2000
c7b137
@@ -36,7 +36,7 @@
c7b137
 
c7b137
 #ifndef lint
c7b137
 /*static char sccsid[] = "from: @(#)sprint.c	5.8 (Berkeley) 12/4/90";*/
c7b137
-char sprint_rcsid[] = "$Id: sprint.c,v 1.10 1999/12/12 18:59:33 dholland Exp $";
c7b137
+char sprint_rcsid[] = "$Id: sprint.c,v 1.1.1.1 2000/11/03 19:18:15 mk Exp $";
c7b137
 #endif /* not lint */
c7b137
 
c7b137
 #include <sys/types.h>
c7b137
diff -uNr bsd-finger-0.17/finger/util.c bsd-finger/finger/util.c
c7b137
--- bsd-finger-0.17/finger/util.c	Wed Sep 29 01:53:58 1999
c7b137
+++ bsd-finger/finger/util.c	Fri Nov  3 21:18:15 2000
c7b137
@@ -36,7 +36,7 @@
c7b137
 
c7b137
 #ifndef lint
c7b137
 /*static char sccsid[] = "from: @(#)util.c	5.14 (Berkeley) 1/17/91";*/
c7b137
-char util_rcsid[] = "$Id: util.c,v 1.18 1999/09/28 22:53:58 netbug Exp $";
c7b137
+char util_rcsid[] = "$Id: util.c,v 1.1.1.1 2000/11/03 19:18:15 mk Exp $";
c7b137
 #endif /* not lint */
c7b137
 
c7b137
 #include <sys/types.h>
c7b137
diff -uNr bsd-finger-0.17/fingerd/CVS/Entries bsd-finger/fingerd/CVS/Entries
c7b137
--- bsd-finger-0.17/fingerd/CVS/Entries	Thu Jan  1 02:00:00 1970
c7b137
+++ bsd-finger/fingerd/CVS/Entries	Mon Feb 19 06:50:43 2001
c7b137
@@ -0,0 +1,6 @@
c7b137
+/.cvsignore/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/Makefile/1.4/Sat Jan 27 05:57:07 2001//
c7b137
+/fingerd.8/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+/fingerd.c/1.5/Sun Feb 11 09:33:52 2001//
c7b137
+/pathnames.h/1.1.1.1/Fri Nov  3 19:18:15 2000//
c7b137
+D
c7b137
diff -uNr bsd-finger-0.17/fingerd/CVS/Repository bsd-finger/fingerd/CVS/Repository
c7b137
--- bsd-finger-0.17/fingerd/CVS/Repository	Thu Jan  1 02:00:00 1970
c7b137
+++ bsd-finger/fingerd/CVS/Repository	Mon Feb 19 06:50:43 2001
c7b137
@@ -0,0 +1 @@
c7b137
+usagi/src/bsd-finger/fingerd
c7b137
diff -uNr bsd-finger-0.17/fingerd/CVS/Root bsd-finger/fingerd/CVS/Root
c7b137
--- bsd-finger-0.17/fingerd/CVS/Root	Thu Jan  1 02:00:00 1970
c7b137
+++ bsd-finger/fingerd/CVS/Root	Mon Feb 19 06:50:43 2001
c7b137
@@ -0,0 +1 @@
c7b137
+:pserver:anoncvs@anoncvs.linux-ipv6.org:/cvsroot/usagi
c7b137
diff -uNr bsd-finger-0.17/fingerd/Makefile bsd-finger/fingerd/Makefile
c7b137
--- bsd-finger-0.17/fingerd/Makefile	Sun Dec 12 20:04:57 1999
c7b137
+++ bsd-finger/fingerd/Makefile	Sat Jan 27 07:57:07 2001
c7b137
@@ -9,7 +9,9 @@
c7b137
 fingerd.o: pathnames.h ../version.h
c7b137
 
c7b137
 install: fingerd
c7b137
+	install -d $(INSTALLROOT)$(SBINDIR)
c7b137
 	install -s -m$(DAEMONMODE) fingerd $(INSTALLROOT)$(SBINDIR)/in.fingerd
c7b137
+	install -d $(INSTALLROOT)$(MANDIR)/man8
c7b137
 	install -m$(MANMODE) fingerd.8 $(INSTALLROOT)$(MANDIR)/man8/in.fingerd.8
c7b137
 	ln -sf in.fingerd.8 $(INSTALLROOT)$(MANDIR)/man8/fingerd.8
c7b137
 
c7b137
diff -uNr bsd-finger-0.17/fingerd/fingerd.8 bsd-finger/fingerd/fingerd.8
c7b137
--- bsd-finger-0.17/fingerd/fingerd.8	Mon Jul 31 02:56:57 2000
c7b137
+++ bsd-finger/fingerd/fingerd.8	Fri Nov  3 21:18:15 2000
c7b137
@@ -30,7 +30,7 @@
c7b137
 .\" SUCH DAMAGE.
c7b137
 .\"
c7b137
 .\"     from: @(#)fingerd.8	6.4 (Berkeley) 3/16/91
c7b137
-.\"	$Id: fingerd.8,v 1.18 2000/07/30 23:56:57 dholland Exp $
c7b137
+.\"	$Id: fingerd.8,v 1.1.1.1 2000/11/03 19:18:15 mk Exp $
c7b137
 .\"
c7b137
 .Dd August 29, 1996
c7b137
 .Dt FINGERD 8
c7b137
diff -uNr bsd-finger-0.17/fingerd/fingerd.c bsd-finger/fingerd/fingerd.c
c7b137
--- bsd-finger-0.17/fingerd/fingerd.c	Sun Dec 12 20:46:28 1999
c7b137
+++ bsd-finger/fingerd/fingerd.c	Sun Feb 11 11:33:52 2001
c7b137
@@ -1,3 +1,5 @@
c7b137
+/* $USAGI: fingerd.c,v 1.3 2000/11/17 08:13:01 yoshfuji Exp $ */
c7b137
+
c7b137
 /*
c7b137
  * Copyright (c) 1983 The Regents of the University of California.
c7b137
  * All rights reserved.
c7b137
@@ -39,7 +41,7 @@
c7b137
  * from: @(#)fingerd.c	5.6 (Berkeley) 6/1/90"
c7b137
  */
c7b137
 char rcsid[] = 
c7b137
-  "$Id: fingerd.c,v 1.23 1999/12/12 18:46:28 dholland Exp $";
c7b137
+  "$Id: fingerd.c,v 1.5 2001/02/11 09:33:52 yoshfuji Exp $";
c7b137
 
c7b137
 #include <pwd.h>
c7b137
 #include <grp.h>
c7b137
@@ -57,7 +59,11 @@
c7b137
 #include <sys/wait.h>
c7b137
 
c7b137
 #include "pathnames.h"
c7b137
+#ifdef _USAGI
c7b137
+#include "version.h"
c7b137
+#else
c7b137
 #include "../version.h"
c7b137
+#endif
c7b137
 
c7b137
 #define	ENTRIES	50
c7b137
 #define WS " \t\r\n"
c7b137
@@ -111,7 +117,11 @@
c7b137
 	int k, nusers;
c7b137
 	char *s, *t;
c7b137
 	const char *fingerpath = NULL;
c7b137
-	struct sockaddr_in sn;
c7b137
+#ifdef INET6
c7b137
+	struct sockaddr_storage sn;
c7b137
+#else
c7b137
+	struct sockaddr sn;
c7b137
+#endif
c7b137
 	socklen_t sval = sizeof(sn);
c7b137
 
c7b137
 
c7b137
@@ -182,18 +192,35 @@
c7b137
 
c7b137
 	if (welcome) {
c7b137
 		char buf[256];
c7b137
+#ifdef INET6
c7b137
+		struct addrinfo hints, *res0;
c7b137
+#else
c7b137
 		struct hostent *hp;
c7b137
+#endif
c7b137
 		struct utsname utsname;
c7b137
+		const char *cname = buf;
c7b137
 
c7b137
 		uname(&utsname);
c7b137
 		gethostname(buf, sizeof(buf));
c7b137
+#ifdef INET6
c7b137
+		memset(&hints, 0, sizeof(hints));
c7b137
+		hints.ai_family = PF_UNSPEC;
c7b137
+		hints.ai_flags = AI_CANONNAME;
c7b137
+		if (getaddrinfo(buf, NULL, &hints, &res0)) {
c7b137
+			/* paranoia: dns spoofing? */
c7b137
+			cname = res0->ai_canonname;
c7b137
+		}
c7b137
+#else
c7b137
 		if ((hp = gethostbyname(buf))) {
c7b137
 			/* paranoia: dns spoofing? */
c7b137
-			strncpy(buf, hp->h_name, sizeof(buf));
c7b137
-			buf[sizeof(buf)-1] = 0;
c7b137
+			cname = hp->h_name;
c7b137
 		}
c7b137
+#endif
c7b137
 		printf("\r\nWelcome to %s version %s at %s !\r\n\n",
c7b137
-				utsname.sysname, utsname.release, buf);
c7b137
+				utsname.sysname, utsname.release, cname);
c7b137
+#ifdef INET6
c7b137
+		freeaddrinfo(res0);
c7b137
+#endif
c7b137
 		fflush(stdout);
c7b137
 		switch (fork()) {
c7b137
 		 case -1: /* fork failed, oh well */
c7b137
diff -uNr bsd-finger-0.17/fingerd/pathnames.h bsd-finger/fingerd/pathnames.h
c7b137
--- bsd-finger-0.17/fingerd/pathnames.h	Sun Jul 14 02:21:42 1996
c7b137
+++ bsd-finger/fingerd/pathnames.h	Fri Nov  3 21:18:15 2000
c7b137
@@ -31,7 +31,7 @@
c7b137
  * SUCH DAMAGE.
c7b137
  *
c7b137
  *	from: @(#)pathnames.h	5.3 (Berkeley) 6/1/90
c7b137
- *	$Id: pathnames.h,v 1.3 1996/07/13 23:21:42 dholland Exp $
c7b137
+ *	$Id: pathnames.h,v 1.1.1.1 2000/11/03 19:18:15 mk Exp $
c7b137
  */
c7b137
 
c7b137
 /*