slackware-current/source/n/bsd-finger/bsd-finger-0.17-usagi-ipv6.patch

474 lines
15 KiB
Diff
Raw Permalink Normal View History

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