From 9696842a61b6608f10633a984732a145c4fe5c68 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Fri, 8 Feb 2019 05:14:29 +0000 Subject: add debian/ folder --- debian/changelog | 200 +++++++++++++ debian/compat | 1 + debian/control | 24 ++ debian/copyright | 16 + debian/finger.docs | 1 + debian/finger.install | 2 + debian/finger.manpages | 2 + debian/fingerd.examples | 1 + debian/fingerd.install | 2 + debian/fingerd.manpages | 2 + debian/fingerd.postinst | 33 +++ debian/fingerd.postrm | 21 ++ debian/fingerd.prerm | 7 + debian/local/finger.xinetd | 13 + debian/patches/01-legacy.patch | 328 +++++++++++++++++++++ debian/patches/02-518559-nsswitch-sources.patch | 98 ++++++ debian/patches/03-468454-fingerd-ipv6.patch | 33 +++ debian/patches/04-468454-finger-ipv6.patch | 120 ++++++++ debian/patches/05-547014-netgroup.patch | 27 ++ debian/patches/06-572211-decrease-timeout.patch | 75 +++++ debian/patches/series | 8 + .../use-cmake-as-buildsystem-debian-extras.patch | 29 ++ debian/patches/use-cmake-as-buildsystem.patch | 59 ++++ debian/rules | 7 + debian/source/format | 1 + debian/source/options | 2 + debian/watch | 2 + 27 files changed, 1114 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/finger.docs create mode 100644 debian/finger.install create mode 100644 debian/finger.manpages create mode 100644 debian/fingerd.examples create mode 100644 debian/fingerd.install create mode 100644 debian/fingerd.manpages create mode 100644 debian/fingerd.postinst create mode 100644 debian/fingerd.postrm create mode 100644 debian/fingerd.prerm create mode 100644 debian/local/finger.xinetd create mode 100644 debian/patches/01-legacy.patch create mode 100644 debian/patches/02-518559-nsswitch-sources.patch create mode 100644 debian/patches/03-468454-fingerd-ipv6.patch create mode 100644 debian/patches/04-468454-finger-ipv6.patch create mode 100644 debian/patches/05-547014-netgroup.patch create mode 100644 debian/patches/06-572211-decrease-timeout.patch create mode 100644 debian/patches/series create mode 100644 debian/patches/use-cmake-as-buildsystem-debian-extras.patch create mode 100644 debian/patches/use-cmake-as-buildsystem.patch create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/source/options create mode 100644 debian/watch diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..e18f6ca --- /dev/null +++ b/debian/changelog @@ -0,0 +1,200 @@ +bsd-finger (0.17-15.2) unstable; urgency=medium + + * Non-maintainer upload + * Use cmake as build system. Closes: #873085, #912121 + + -- Christoph Biedl Sat, 08 Dec 2018 10:36:30 +0100 + +bsd-finger (0.17-15.1) unstable; urgency=medium + + * Non-maintainer upload. + * Do not specify bzip2 compressor to dh_builddeb + (Closes: #833210) + + -- Jonathan Wiltshire Fri, 11 Nov 2016 14:58:53 +0000 + +bsd-finger (0.17-15) unstable; urgency=low + + * Fix "finger client causes long timeouts" + Add 06-572211-decrease-timeout.patch + Patch by Mats Erik Andersson + Closes: #572211 + * Suggests: finger + Closes: #622105 + * Enable hardened build flags + * DH compatibility level is 9 + * Standards version is 3.9.3 + * Debian source format is 3.0 (quilt) + * Fix debian-rules-missing-recommended-target + + -- Anibal Monsalve Salazar Mon, 18 Jun 2012 15:37:11 +1000 + +bsd-finger (0.17-14) unstable; urgency=low + + [ Mats Erik Andersson ] + * Implement IPv6-support + Add 03-468454-fingerd-ipv6.patch + Add 04-468454-finger-ipv6.patch + Closes: #468454 + * debian/fingerd.examples: Add debian/local/finger.xinetd + + [ Anibal Monsalve Salazar ] + * Don't segfault when /etc/passwd has netgroup entry + Add 05-547014-netgroup.patch + Patch by Matthew A. Dunford + Closes: #547014 + * Debian source format is 3.0 (quilt) + * Fix out-of-date-standards-version + * Fix maintainer-script-without-set-e + + -- Anibal Monsalve Salazar Fri, 12 Feb 2010 14:49:23 +1100 + +bsd-finger (0.17-13) unstable; urgency=low + + * Priority is optional + * Build depends on quilt + * Standards Version is 3.8.1 + * DH compatibility level is 7 + * Run dh_prep instead of dh_clean -k + * Work with a non-iterable nsswitch source + 02-518559-nsswitch-sources.patch by Tim Abbott + closes: #518559 + + -- Anibal Monsalve Salazar Wed, 10 Jun 2009 19:49:18 +1000 + +bsd-finger (0.17-12) unstable; urgency=low + + * Added debian/watch + * Fixed the following lintian issues: + - bsd-finger source: debian-rules-sets-DH_COMPAT line 10 + - bsd-finger source: debian-rules-ignores-make-clean-error line 34 + - bsd-finger source: out-of-date-standards-version 3.7.2 (current is 3.7.3) + + -- Anibal Monsalve Salazar Sun, 06 Apr 2008 17:30:13 +1000 + +bsd-finger (0.17-11) unstable; urgency=low + + * Resynchronise with Ubuntu. + + -- Anibal Monsalve Salazar Fri, 09 Feb 2007 10:43:05 +1100 + +bsd-finger (0.17-10ubuntu1) feisty; urgency=low + + * Make fingerd depend on update-inetd for update-inetd. + + -- Tollef Fog Heen Thu, 14 Dec 2006 11:40:14 +0100 + +bsd-finger (0.17-10) unstable; urgency=low + + * Set Standards-Version to 3.7.2. + * Set DH_COMPAT to 5. + + -- Anibal Monsalve Salazar Thu, 22 Jun 2006 09:03:02 +1000 + +bsd-finger (0.17-9) unstable; urgency=low + + * Set Standards-Version to 3.6.2. + * Set DH_COMPAT to 4. + * Fixed "fingerd.postrm is a #!/bin/sh script but uses command + -v", closes: #292977. + * Fixed "/usr/share/doc/finger/README.gz not helpful for user", + closes: #323230. + + -- Anibal Monsalve Salazar Sat, 08 Oct 2005 19:10:10 +1000 + +bsd-finger (0.17-8) unstable; urgency=low + + * Fixed "Manpage mentions ~/.pgp when it should say ~/.pgpkey" + (Closes: #244217). + * Fixed "Manpage describes ~/.project as restricted to one line" + (Closes: #244218). + * New maintainer's email address. + + -- Anibal Monsalve Salazar Thu, 10 Feb 2005 23:22:52 +1100 + +bsd-finger (0.17-7) unstable; urgency=low + + * New maintainer. + + -- Anibal Monsalve Salazar Thu, 20 May 2004 09:24:26 +1000 + +bsd-finger (0.17-6) unstable; urgency=low + + * Exit with a nonzero status when a request fails (closes: #122915). + + -- Herbert Xu Sat, 8 Dec 2001 18:39:54 +1100 + +bsd-finger (0.17-5) unstable; urgency=low + + * Use asprintf in preference to an array on the stack (closes: #106385). + + -- Herbert Xu Tue, 24 Jul 2001 19:25:14 +1000 + +bsd-finger (0.17-4) unstable; urgency=low + + * Restored old strsep code since gecos may be empty (closes: #103273). + + -- Herbert Xu Tue, 3 Jul 2001 21:24:19 +1000 + +bsd-finger (0.17-3) unstable; urgency=low + + * Finger no longer complains about remote X displays. + + -- Herbert Xu Tue, 19 Jun 2001 22:21:25 +1000 + +bsd-finger (0.17-2) unstable; urgency=low + + * Fixed typo in finger(1) man page (closes: #99328). + + -- Herbert Xu Thu, 31 May 2001 19:17:12 +1000 + +bsd-finger (0.17-1) unstable; urgency=low + + * New upstream release. + * Fixed compilation problems with glibc 2.2 (closes: #90356). + + -- Herbert Xu Tue, 20 Mar 2001 21:30:56 +1100 + +bsd-finger (0.16-3) unstable; urgency=low + + * Set pn->realname to NULL by default (closes: #67593). + + -- Herbert Xu Sun, 23 Jul 2000 14:12:52 +1000 + +bsd-finger (0.16-2) unstable; urgency=low + + * Fixed a null pointer dereference (closes: #66829). Reported and fixed by + Peter Toneby. + * Added build-time dependency on debhelper. + + -- Herbert Xu Fri, 7 Jul 2000 19:09:11 +1000 + +bsd-finger (0.16-1) unstable; urgency=low + + * New upstream release. + * Added .pgpkey to finger.1 (closes: #65632). + + -- Herbert Xu Mon, 19 Jun 2000 14:58:04 +1000 + +bsd-finger (0.10-3) frozen unstable; urgency=low + + * Clear the idle time if we cannot obtain a valid value, which is the case + for X logins (closes: #53816). + + -- Herbert Xu Tue, 21 Mar 2000 22:09:23 +1100 + +bsd-finger (0.10-2) unstable; urgency=low + + * Fixed finger width calculation (closes: #49510). + + -- Herbert Xu Thu, 11 Nov 1999 20:11:24 +1100 + +bsd-finger (0.10-1) unstable; urgency=low + + * Initial release. + * Don't print an error message if we can't open a tty file as it may be a + remote X login. + * finger now supports pts devices (closes: #39196, #41552, #43342, #43952). + + -- Herbert Xu Wed, 3 Nov 1999 10:00:20 +1100 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +10 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..14365de --- /dev/null +++ b/debian/control @@ -0,0 +1,24 @@ +Source: bsd-finger +Section: net +Priority: optional +Maintainer: Anibal Monsalve Salazar +Standards-Version: 3.9.3 +Build-Depends: dpkg-dev (>= 1.16.1~), debhelper (>= 10~), cmake + +Package: finger +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Replaces: netstd +Description: user information lookup program + finger displays information about the system users. + +Package: fingerd +Architecture: any +Depends: update-inetd, netbase, ${shlibs:Depends}, ${misc:Depends} +Suggests: finger +Replaces: netstd +Description: remote user information server + Fingerd is a simple daemon based on RFC1196 that provides an interface to the + "finger" program at most network sites. The program is supposed to return a + friendly, human-oriented status report on either the system at the moment or a + particular person in depth. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..aa9d175 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,16 @@ +This package was split from netstd by Herbert Xu herbert@debian.org on +Wed, 3 Nov 1999 10:03:41 +1100. + +It is maintained by Anibal Monsalve Salazar . + +netstd was created by Peter Tobias tobias@et-inf.fho-emden.de on +Wed, 20 Jul 1994 17:23:21 +0200. + +It was downloaded from ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/. + +Copyright: + +Copyright (c) 1980-1991 The Regents of the University of California. + +The license can be found in /usr/share/common-licenses/BSD. + diff --git a/debian/finger.docs b/debian/finger.docs new file mode 100644 index 0000000..4ef5908 --- /dev/null +++ b/debian/finger.docs @@ -0,0 +1 @@ +BUGS diff --git a/debian/finger.install b/debian/finger.install new file mode 100644 index 0000000..4c8cba9 --- /dev/null +++ b/debian/finger.install @@ -0,0 +1,2 @@ + +usr/bin/finger diff --git a/debian/finger.manpages b/debian/finger.manpages new file mode 100644 index 0000000..819fd6b --- /dev/null +++ b/debian/finger.manpages @@ -0,0 +1,2 @@ + +debian/tmp/usr/share/man/man1/finger.1 diff --git a/debian/fingerd.examples b/debian/fingerd.examples new file mode 100644 index 0000000..4fe0f15 --- /dev/null +++ b/debian/fingerd.examples @@ -0,0 +1 @@ +debian/local/finger.xinetd diff --git a/debian/fingerd.install b/debian/fingerd.install new file mode 100644 index 0000000..67e5d97 --- /dev/null +++ b/debian/fingerd.install @@ -0,0 +1,2 @@ + +usr/sbin/in.fingerd diff --git a/debian/fingerd.manpages b/debian/fingerd.manpages new file mode 100644 index 0000000..d5d840b --- /dev/null +++ b/debian/fingerd.manpages @@ -0,0 +1,2 @@ + +debian/tmp/usr/share/man/man8/in.fingerd.8 diff --git a/debian/fingerd.postinst b/debian/fingerd.postinst new file mode 100644 index 0000000..afe09b7 --- /dev/null +++ b/debian/fingerd.postinst @@ -0,0 +1,33 @@ +#!/bin/sh + +set -e + +enable_if_alone() { + if ! grep -q ^finger /etc/inetd.conf; then + update-inetd --pattern /usr/sbin/in\\.fingerd --enable finger + fi +} + +case "$1" in +abort-upgrade | abort-deconfigure | abort-remove) + enable_if_alone + ;; +configure) + if [ -n "$2" ]; then + enable_if_alone + else + fingerentry="finger stream tcp nowait nobody /usr/sbin/tcpd /usr/sbin/in.fingerd" + if grep -q ^finger /etc/inetd.conf; then + update-inetd --group INFO --add "#$fingerentry" + else + update-inetd --group INFO --add "$fingerentry" + fi + fi + ;; +*) + printf "$0: incorrect arguments: $*\n" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/fingerd.postrm b/debian/fingerd.postrm new file mode 100644 index 0000000..7a86064 --- /dev/null +++ b/debian/fingerd.postrm @@ -0,0 +1,21 @@ +#!/bin/sh + +set -e + +case "$1" in +abort-install | remove | abort-upgrade | upgrade | failed-upgrade | disappear) + ;; +purge) + # If netbase is not installed, then we don't need to do the remove. + #if command -v update-inetd >/dev/null 2>&1; then + if [ -x /usr/sbin/update-inetd ]; then + update-inetd --remove "finger .* /usr/sbin/in\.fingerd" + fi + ;; +*) + echo "$0: incorrect arguments: $*" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/fingerd.prerm b/debian/fingerd.prerm new file mode 100644 index 0000000..3a81544 --- /dev/null +++ b/debian/fingerd.prerm @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +update-inetd --pattern /usr/sbin/in\\.fingerd --disable finger + +#DEBHELPER# diff --git a/debian/local/finger.xinetd b/debian/local/finger.xinetd new file mode 100644 index 0000000..e7c8450 --- /dev/null +++ b/debian/local/finger.xinetd @@ -0,0 +1,13 @@ +service finger +{ + disable = no + socket_type = stream + protocol = tcp + flags = IPv6 + wait = no + user = nobody + server = /usr/sbin/in.fingerd + server_args = -l -w + log_type = SYSLOG daemon info + log_on_success = HOST +} diff --git a/debian/patches/01-legacy.patch b/debian/patches/01-legacy.patch new file mode 100644 index 0000000..91bf0a9 --- /dev/null +++ b/debian/patches/01-legacy.patch @@ -0,0 +1,328 @@ +--- a/finger/finger.1 2000-07-31 09:56:57.000000000 +1000 ++++ b/finger/finger.1 2009-06-10 20:08:45.000000000 +1000 +@@ -169,16 +169,14 @@ started by + must be able to see the + .Pa .nofinger + file. This generally means that the home directory containing the file +-must have the other-users-execute bit set (o+w). See ++must have the other-users-execute bit set (o+x). See + .Xr chmod 1 . + If you use this feature for privacy, please test it with ``finger + @localhost'' before relying on it, just in case. + .It ~/.plan + .It ~/.project +-.It ~/.pgp ++.It ~/.pgpkey + These files are printed as part of a long-format request. The +-.Pa .project +-file is limited to one line; the + .Pa .plan + file may be arbitrarily long. + .El +--- a/finger/finger.c 1999-12-19 03:41:51.000000000 +1100 ++++ b/finger/finger.c 2009-06-10 20:08:45.000000000 +1000 +@@ -77,7 +77,7 @@ char finger_rcsid[] = \ + #include "../version.h" + + static void loginlist(void); +-static void userlist(int argc, char *argv[]); ++static int userlist(int argc, char *argv[]); + + int lflag, pplan; + static int sflag, mflag; +@@ -92,6 +92,7 @@ int entries; /* number of people */ + + int main(int argc, char *argv[]) { + int ch; ++ int err = 0; + struct sockaddr_in sin; + socklen_t slen = sizeof(sin); + +@@ -159,7 +160,7 @@ int main(int argc, char *argv[]) { + } + } + else { +- userlist(argc, argv); ++ err = userlist(argc, argv); + /* + * Assign explicit "large" format if names given and -s not + * explicitly stated. Force the -l AFTER we get names so any +@@ -172,7 +173,7 @@ int main(int argc, char *argv[]) { + if (lflag) lflag_print(); + else sflag_print(); + } +- return 0; ++ return err; + } + + /* Returns 1 if .nofinger is found and enable_nofinger is set. */ +@@ -181,10 +182,16 @@ int + check_nofinger(struct passwd *pw) + { + if (enable_nofinger) { +- char path[PATH_MAX]; + struct stat tripe; +- snprintf(path, sizeof(path), "%s/.nofinger", pw->pw_dir); +- if (stat(path, &tripe)==0) { ++ int ret; ++ char *path; ++ if (asprintf(&path, "%s/.nofinger", pw->pw_dir) < 0) { ++ eprintf("finger: Out of space.\n"); ++ exit(1); ++ } ++ ret = stat(path, &tripe); ++ free(path); ++ if (!ret) { + return 1; + } + } +@@ -264,10 +271,11 @@ static void do_local(int argc, char *arg + + } + +-static void ++static int + userlist(int argc, char *argv[]) + { + int i; ++ int err = 0; + PERSON *pn; + PERSON *nethead, **nettail; + struct utmp *uptr; +@@ -297,13 +305,13 @@ userlist(int argc, char *argv[]) + + /* handle network requests */ + for (pn = nethead; pn; pn = pn->next) { +- netfinger(pn->name); ++ err |= netfinger(pn->name); + if (pn->next || entries) + xputc('\n'); + } + + if (entries == 0) +- return; ++ return err; + + /* + * Scan thru the list of users currently logged in, saving +@@ -331,4 +339,6 @@ userlist(int argc, char *argv[]) + enter_lastlog(pn); + } + endutent(); ++ ++ return err; + } +--- a/finger/finger.h 1999-09-14 20:51:11.000000000 +1000 ++++ b/finger/finger.h 2009-06-10 20:08:45.000000000 +1000 +@@ -92,7 +92,7 @@ void sflag_print(void); + void enter_where(struct utmp *ut, PERSON *pn); + void enter_lastlog(PERSON *pn); + int match(struct passwd *pw, const char *user); +-void netfinger(const char *name); ++int netfinger(const char *name); + const char *prphone(const char *num); + + #ifndef DAYSPERNYEAR +--- a/finger/lprint.c 1999-09-14 20:51:11.000000000 +1000 ++++ b/finger/lprint.c 2009-06-10 20:08:45.000000000 +1000 +@@ -48,7 +48,7 @@ char lprint_rcsid[] = + #include + #include + #include +-#include ++#include + #include "finger.h" + + static void lprint(PERSON *pn); +@@ -100,7 +100,7 @@ lprint(PERSON *pn) + * office, office phone, home phone if available + */ + xprintf("Login: %-15s\t\t\tName: %s\nDirectory: %-25s", +- pn->name, pn->realname, pn->dir); ++ pn->name, pn->realname ? pn->realname : "", pn->dir); + xprintf("\tShell: %-s\n", *pn->shell ? pn->shell : _PATH_BSHELL); + + /* +--- a/finger/net.c 1999-09-14 20:51:11.000000000 +1000 ++++ b/finger/net.c 2009-06-10 20:08:45.000000000 +1000 +@@ -51,7 +51,7 @@ char net_rcsid[] = "$Id: net.c,v 1.9 199 + #include + #include "finger.h" + +-void netfinger(const char *name) { ++int netfinger(const char *name) { + register FILE *fp; + struct in_addr defaddr; + register int c, sawret, ateol; +@@ -62,7 +62,7 @@ void netfinger(const char *name) { + char *alist[1], *host; + + host = strrchr(name, '@'); +- if (!host) return; ++ if (!host) return 1; + *host++ = '\0'; + + memset(&sn, 0, sizeof(sn)); +@@ -70,7 +70,7 @@ void netfinger(const char *name) { + sp = getservbyname("finger", "tcp"); + if (!sp) { + eprintf("finger: tcp/finger: unknown service\n"); +- return; ++ return 1; + } + sn.sin_port = sp->s_port; + +@@ -78,7 +78,7 @@ void netfinger(const char *name) { + if (!hp) { + if (!inet_aton(host, &defaddr)) { + eprintf("finger: unknown host: %s\n", host); +- return; ++ return 1; + } + def.h_name = host; + def.h_addr_list = alist; +@@ -96,7 +96,7 @@ void netfinger(const char *name) { + + if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) { + eprintf("finger: socket: %s\n", strerror(errno)); +- return; ++ return 1; + } + + /* print hostname before connecting, in case it takes a while */ +@@ -104,7 +104,7 @@ void netfinger(const char *name) { + if (connect(s, (struct sockaddr *)&sn, sizeof(sn)) < 0) { + eprintf("finger: connect: %s\n", strerror(errno)); + close(s); +- return; ++ return 1; + } + + /* -l flag for remote fingerd */ +@@ -128,7 +128,7 @@ void netfinger(const char *name) { + if (!fp) { + eprintf("finger: fdopen: %s\n", strerror(errno)); + close(s); +- return; ++ return 1; + } + + sawret = 0; +@@ -152,4 +152,6 @@ void netfinger(const char *name) { + } + if (!ateol) xputc('\n'); + fclose(fp); ++ ++ return 0; + } +--- a/finger/sprint.c 1999-12-13 05:59:33.000000000 +1100 ++++ b/finger/sprint.c 2009-06-10 20:08:45.000000000 +1000 +@@ -40,7 +40,7 @@ char sprint_rcsid[] = "$Id: sprint.c,v 1 + #endif /* not lint */ + + #include +-#include ++#include + #include + #include + #include +--- a/finger/util.c 1999-09-29 08:53:58.000000000 +1000 ++++ b/finger/util.c 2009-06-10 20:08:45.000000000 +1000 +@@ -64,7 +64,7 @@ static void find_idle_and_ttywrite(regis + struct stat sb; + + /* No device for X console. Utmp entry by XDM login (":0"). */ +- if (w->tty[0] == ':') { ++ if (strchr(w->tty, ':')) { + w->idletime = 0; /* would be nice to have it emit ??? */ + w->writable = 0; + return; +@@ -109,9 +109,8 @@ static void userinfo(PERSON *pn, struct + * fields[3] -> homephone + */ + nfields = 0; +- for (p = strtok(bp, ","); p; p = strtok(NULL, ",")) { +- if (*p==0) p = NULL; // skip empties +- if (nfields < 4) fields[nfields++] = p; ++ while ((p = strsep(&bp, ","))) { ++ if (nfields < 4) fields[nfields++] = *p ? p : NULL; + } + while (nfields<4) fields[nfields++] = NULL; + +@@ -150,6 +149,9 @@ static void userinfo(PERSON *pn, struct + + pn->realname = rname; + } ++ else { ++ pn->realname = NULL; ++ } + + pn->office = fields[1] ? strdup(fields[1]) : NULL; + pn->officephone = fields[2] ? strdup(fields[2]) : NULL; +--- a/fingerd/fingerd.8 2000-07-31 09:56:57.000000000 +1000 ++++ b/fingerd/fingerd.8 2009-06-10 20:08:45.000000000 +1000 +@@ -36,10 +36,10 @@ + .Dt FINGERD 8 + .Os "Linux NetKit (0.17)" + .Sh NAME +-.Nm fingerd ++.Nm in.fingerd + .Nd remote user information server + .Sh SYNOPSIS +-.Nm fingerd ++.Nm in.fingerd + .Op Fl wulf + .Op Fl pL Ar path + .Op Fl t Ar timeout +@@ -61,7 +61,7 @@ option is given, remote users will get a + banner + which also shows some informations (e.g. uptime, operating system name and + release) about the system the +-.Nm fingerd ++.Nm in.fingerd + is running on. Some sites may consider this a security risk as it + gives out information that may be useful to crackers. + .Pp +@@ -85,7 +85,7 @@ resource reasons. + .Pp + The + .Fl p +-option allows specification of an alternate location for fingerd to find ++option allows specification of an alternate location for in.fingerd to find + the + .Dq finger + program. The +@@ -97,7 +97,7 @@ The + option specifies the time to wait for a request before closing the + connection. A value of 0 waits forever. The default is 60 seconds. + .Pp +-Options to fingerd should be specified in ++Options to in.fingerd should be specified in + .Pa /etc/inetd.conf . + .Pp + The finger protocol consists mostly of specifying command arguments. +@@ -105,12 +105,12 @@ The + .Xr inetd 8 + .Dq super-server + runs +-.Nm fingerd ++.Nm in.fingerd + for + .Tn TCP + requests received on port 79. + Once connected +-.Nm fingerd ++.Nm in.fingerd + reads a single command line + terminated by a + .Aq Tn CRLF +--- a/fingerd/fingerd.c 1999-12-13 05:46:28.000000000 +1100 ++++ b/fingerd/fingerd.c 2009-06-10 20:08:45.000000000 +1000 +@@ -55,6 +55,7 @@ char rcsid[] = + #include + #include + #include ++#include + + #include "pathnames.h" + #include "../version.h" diff --git a/debian/patches/02-518559-nsswitch-sources.patch b/debian/patches/02-518559-nsswitch-sources.patch new file mode 100644 index 0000000..95f9c38 --- /dev/null +++ b/debian/patches/02-518559-nsswitch-sources.patch @@ -0,0 +1,98 @@ +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=518559 + +Doesn't work with a non-iterable nsswitch source + +Currently, "finger tabbott" works by iterating through the list of users +on the system using getpwent and checking if any of them match "tabbott". + +Some nsswitch backends (including Hesiod and LDAP[1]) do not support +iterating through the complete list of users. These nsswitch backends +instead only fully support looking up a user's information by username or +uid. + +So, if tabbott is a user whose nsswitch information comes from LDAP, then +"finger tabbott" will incorrectly report "finger: tabbott: no such user." +"finger -m tabbott" does work correctly, however, because it looks up the +matching username using getpwnam. + +A fix for this is to always look up an argument to finger for a username +match, and having -m only control whether finger searches the entire user +database for real name matches. Patch attached. + +This patch has the advantageous side effect that if there are some real +name matches and a username match, finger will always display the username +match first (rather than in some random place in the list). + + -Tim Abbott + +[1] with LDAP, it is typically the case that one can iterate through only +the first 100 results from a query. + +Tim Abbott + +commit ab0b4e09b1281a11587fd0f9797e612cfb08ef57 +Author: Timothy G Abbott +Date: Fri Mar 6 22:30:00 2009 -0500 + + Add support for non-iterable nsswitch sources. + + Signed-off-by: Timothy G Abbott + +diff --git a/finger/finger.c b/finger/finger.c +index 7b96d3c..5737782 100644 +--- a/finger/finger.c ++++ b/finger/finger.c +@@ -241,28 +241,35 @@ static void do_local(int argc, char *argv[], int *used) { + int i; + struct passwd *pw; + ++ for (i = 0; i < argc; i++) { ++ if (used[i] >= 0 && (pw = getpwnam(argv[i]))) { ++ if (!check_nofinger(pw)) { ++ enter_person(pw); ++ used[i] = 1; ++ } ++ } ++ } + /* +- * traverse the list of possible login names and check the login name +- * and real name against the name specified by the user. ++ * Traverse the list of users and check the real name against ++ * the name specified by the user. ++ * ++ * Since we've already entered users whose usernames match, ++ * ignore them when doing real name matching. + */ +- if (mflag) { +- for (i = 0; i < argc; i++) +- if (used[i] >= 0 && (pw = getpwnam(argv[i]))) { +- if (!check_nofinger(pw)) { +- enter_person(pw); +- used[i] = 1; +- } +- } +- } else for (pw = getpwent(); pw; pw = getpwent()) +- for (i = 0; i < argc; i++) +- if (used[i] >= 0 && +- (!strcasecmp(pw->pw_name, argv[i]) || +- match(pw, argv[i]))) { +- if (!check_nofinger(pw)) { +- enter_person(pw); +- used[i] = 1; ++ if (!mflag) { ++ for (pw = getpwent(); pw; pw = getpwent()) { ++ for (i = 0; i < argc; i++) { ++ if (used[i] >= 0 && ++ strcasecmp(pw->pw_name, argv[i]) && ++ match(pw, argv[i])) { ++ if (!check_nofinger(pw)) { ++ enter_person(pw); ++ used[i] = 1; ++ } + } + } ++ } ++ } + + /* list errors */ + for (i = 0; i < argc; i++) diff --git a/debian/patches/03-468454-fingerd-ipv6.patch b/debian/patches/03-468454-fingerd-ipv6.patch new file mode 100644 index 0000000..854643e --- /dev/null +++ b/debian/patches/03-468454-fingerd-ipv6.patch @@ -0,0 +1,33 @@ +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468454 + +Description: Implement IPv6 capacity for the server Fingerd. +Author: Mats Erik Andersson +Forwarded: no +Last-Update: 2010-02-09 + +--- a/fingerd/fingerd.c ++++ b/fingerd/fingerd.c +@@ -112,7 +112,7 @@ main(int argc, char *argv[]) + int k, nusers; + char *s, *t; + const char *fingerpath = NULL; +- struct sockaddr_in sn; ++ struct sockaddr_storage sn; + socklen_t sval = sizeof(sn); + + +@@ -182,11 +182,13 @@ main(int argc, char *argv[]) + } + + if (welcome) { +- char buf[256]; ++ char buf[256] = ""; + struct hostent *hp; + struct utsname utsname; + + uname(&utsname); ++ /* gethostbyname() only retrieves the local hostname. ++ * This does not disturb IPv6 in any manner. */ + gethostname(buf, sizeof(buf)); + if ((hp = gethostbyname(buf))) { + /* paranoia: dns spoofing? */ diff --git a/debian/patches/04-468454-finger-ipv6.patch b/debian/patches/04-468454-finger-ipv6.patch new file mode 100644 index 0000000..e6e13c8 --- /dev/null +++ b/debian/patches/04-468454-finger-ipv6.patch @@ -0,0 +1,120 @@ +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=468454 + +Description: Implement IPv6 capability for the client Finger. +Author: Mats Erik Andersson +Forwarded: no +Last-Updated: 2010-02-09 + +--- a/finger/finger.c ++++ b/finger/finger.c +@@ -93,7 +93,7 @@ + int main(int argc, char *argv[]) { + int ch; + int err = 0; +- struct sockaddr_in sin; ++ struct sockaddr_storage sin; + socklen_t slen = sizeof(sin); + + while ((ch = getopt(argc, argv, "lmps")) != EOF) { +@@ -137,6 +137,8 @@ int main(int argc, char *argv[]) { + * Also check stdin for nofinger processing, because of older + * fingerds that make stdout a pipe for CRLF handling. + */ ++ slen = sizeof(slen); /* For safety: sockaddr_in and sockaddr_in6 */ ++ + if (getsockname(STDIN_FILENO, (struct sockaddr *)&sin, &slen)==0) { + enable_nofinger = 1; + } +--- a/finger/net.c ++++ b/finger/net.c +@@ -53,13 +53,12 @@ + + int netfinger(const char *name) { + register FILE *fp; +- struct in_addr defaddr; + register int c, sawret, ateol; +- struct hostent *hp, def; ++ struct addrinfo hints, *result, *resptr; + struct servent *sp; +- struct sockaddr_in sn; +- int s; +- char *alist[1], *host; ++ struct sockaddr_storage sn; ++ int s, status; ++ char *host; + + host = strrchr(name, '@'); + if (!host) return 1; +@@ -72,38 +71,46 @@ int netfinger(const char *name) { + eprintf("finger: tcp/finger: unknown service\n"); + return 1; + } +- sn.sin_port = sp->s_port; ++ memset(&hints, 0, sizeof(hints)); ++ hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; ++ hints.ai_family = AF_UNSPEC; ++ hints.ai_socktype = SOCK_STREAM; ++ hints.ai_protocol = IPPROTO_TCP; ++ ++ status = getaddrinfo(host, "finger", &hints, &result); ++ if (status != 0) { ++ eprintf("finger: unknown host: %s\n", host); ++ eprintf("getaddrinfo: %s\n", gai_strerror(status)); ++ return 1; ++ } + +- hp = gethostbyname(host); +- if (!hp) { +- if (!inet_aton(host, &defaddr)) { +- eprintf("finger: unknown host: %s\n", host); +- return 1; ++ for ( resptr = result; resptr; resptr = resptr->ai_next) { ++ ++ if ((s = socket(resptr->ai_family, resptr->ai_socktype, ++ resptr->ai_protocol)) < 0) ++ continue; ++ ++ ++ /* print hostname before connecting, in case it takes a while */ ++ /* This should probably be removed. */ ++ /* xprintf("[%s]\n", result->ai_canonname); */ ++ ++ if (connect(s, resptr->ai_addr, resptr->ai_addrlen) < 0) { ++ close(s); ++ continue; + } +- def.h_name = host; +- def.h_addr_list = alist; +- def.h_addr = (char *)&defaddr; +- def.h_length = sizeof(struct in_addr); +- def.h_addrtype = AF_INET; +- def.h_aliases = 0; +- hp = &def; +- } +- sn.sin_family = hp->h_addrtype; +- if (hp->h_length > (int)sizeof(sn.sin_addr)) { +- hp->h_length = sizeof(sn.sin_addr); +- } +- memcpy(&sn.sin_addr, hp->h_addr, hp->h_length); + +- if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) { +- eprintf("finger: socket: %s\n", strerror(errno)); +- return 1; ++ /* Connection is now established. ++ /* Assemble the gained information. */ ++ memcpy(&sn, resptr->ai_addr, resptr->ai_addrlen); ++ break; + } + +- /* print hostname before connecting, in case it takes a while */ +- xprintf("[%s]\n", hp->h_name); +- if (connect(s, (struct sockaddr *)&sn, sizeof(sn)) < 0) { ++ freeaddrinfo(result); ++ ++ if ( resptr == NULL ) { ++ /* Last error is still providing the correct clue. */ + eprintf("finger: connect: %s\n", strerror(errno)); +- close(s); + return 1; + } + diff --git a/debian/patches/05-547014-netgroup.patch b/debian/patches/05-547014-netgroup.patch new file mode 100644 index 0000000..8667a39 --- /dev/null +++ b/debian/patches/05-547014-netgroup.patch @@ -0,0 +1,27 @@ +http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=547014 + +From: "Matthew A. Dunford" + +finger segfaults when it comes across a netgroup entry in /etc/passwd. +A netgroup entry doesn't include many of the fields in a normal passwd +entry, so pw->pw_gecos is set to NULL, which causes finger to core +dump. + +Here is part of a /etc/passwd file with a netgroup entry: + +nobody:x:65534:65534:nobody:/nonexistent:/bin/sh ++@operator + +This patch sidesteps what finger considers a malformed passwd entry: + +--- a/finger/util.c 1999-09-29 08:53:58.000000000 +1000 ++++ b/finger/util.c 2010-02-12 16:08:50.000000000 +1100 +@@ -178,6 +180,8 @@ match(struct passwd *pw, const char *use + int i, j, ct, rv=0; + char *rname; + ++ if (pw->pw_gecos == NULL) return 0; ++ + strncpy(tbuf, pw->pw_gecos, TBUFLEN); + tbuf[TBUFLEN-1] = 0; /* guarantee null termination */ + p = tbuf; diff --git a/debian/patches/06-572211-decrease-timeout.patch b/debian/patches/06-572211-decrease-timeout.patch new file mode 100644 index 0000000..c836fe3 --- /dev/null +++ b/debian/patches/06-572211-decrease-timeout.patch @@ -0,0 +1,75 @@ +Description: Decrease timeout length during connect(). + In cases where a name server is answering with A as well as AAAA records, + but the system to be queried has lost a corresponding address, the TCP + handshake timeout will cause a long delay before allowing the query of + the next address family, or the next address in general. + . + The use of a trivial signal handler for SIGALRM allows the reduction + of this timeout, thus producing better responsiveness for the interactive + user of the Finger service. +Author: Mats Erik Andersson +Forwarded: no +Last-Updated: 2010-03-02 + +--- a/finger/net.c ++++ b/finger/net.c +@@ -49,14 +49,25 @@ + #include + #include + #include ++#include + #include "finger.h" + ++#if ! defined(FINGER_TIMEOUT) || FINGER_TIMEOUT < 1 ++# define FINGER_TIMEOUT 5 ++#endif ++ ++static void trivial_alarm(int sig) { ++ /* Just to trigger EINTR, and to later use it. */ ++ return; ++} ++ + int netfinger(const char *name) { + register FILE *fp; + register int c, sawret, ateol; + struct addrinfo hints, *result, *resptr; + struct servent *sp; + struct sockaddr_storage sn; ++ struct sigaction sigact, oldsigact; + int s, status; + char *host; + +@@ -77,6 +88,10 @@ + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + ++ sigact.sa_handler = trivial_alarm; ++ sigemptyset(&sigact.sa_mask); ++ sigact.sa_flags = 0; ++ + status = getaddrinfo(host, "finger", &hints, &result); + if (status != 0) { + eprintf("finger: unknown host: %s\n", host); +@@ -95,13 +110,21 @@ + /* This should probably be removed. */ + /* xprintf("[%s]\n", result->ai_canonname); */ + ++ sigaction(SIGALRM, &sigact, &oldsigact); ++ alarm(FINGER_TIMEOUT); ++ + if (connect(s, resptr->ai_addr, resptr->ai_addrlen) < 0) { ++ if ( errno == EINTR ) ++ errno = ETIMEDOUT; + close(s); + continue; + } + ++ alarm(0); ++ sigaction(SIGALRM, &oldsigact, NULL); ++ + /* Connection is now established. +- /* Assemble the gained information. */ ++ * Assemble the gained information. */ + memcpy(&sn, resptr->ai_addr, resptr->ai_addrlen); + break; + } diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..8b5fe97 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,8 @@ +01-legacy.patch +02-518559-nsswitch-sources.patch +03-468454-fingerd-ipv6.patch +04-468454-finger-ipv6.patch +05-547014-netgroup.patch +06-572211-decrease-timeout.patch +use-cmake-as-buildsystem.patch +use-cmake-as-buildsystem-debian-extras.patch diff --git a/debian/patches/use-cmake-as-buildsystem-debian-extras.patch b/debian/patches/use-cmake-as-buildsystem-debian-extras.patch new file mode 100644 index 0000000..0d6dfd9 --- /dev/null +++ b/debian/patches/use-cmake-as-buildsystem-debian-extras.patch @@ -0,0 +1,29 @@ +Description: Debian-specific changes to the cmake build system +Author: Christoph Biedl +Forwarded: not-needed +Last-Update: 2018-11-25 + +--- a/finger/CMakeLists.txt ++++ b/finger/CMakeLists.txt +@@ -1,4 +1,9 @@ + ++set( ++ CMAKE_C_FLAGS ++ "${CMAKE_C_FLAGS} -D_GNU_SOURCE" ++) ++ + add_executable( + finger + finger.c +--- a/fingerd/CMakeLists.txt ++++ b/fingerd/CMakeLists.txt +@@ -1,4 +1,9 @@ + ++set( ++ CMAKE_C_FLAGS ++ "${CMAKE_C_FLAGS} -D_GNU_SOURCE" ++) ++ + add_executable( + in.fingerd + fingerd.c diff --git a/debian/patches/use-cmake-as-buildsystem.patch b/debian/patches/use-cmake-as-buildsystem.patch new file mode 100644 index 0000000..56a1dd3 --- /dev/null +++ b/debian/patches/use-cmake-as-buildsystem.patch @@ -0,0 +1,59 @@ +Description: Use cmake as build system +Author: Christoph Biedl +Bug-Debian: + https://bugs.debian.org/873085 + https://bugs.debian.org/912121 +Last-Update: 2018-11-25 + +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,9 @@ ++cmake_minimum_required(VERSION 3.7) ++project(bsd-finger) ++ ++set(BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin") ++set(SBIN_DIR "${CMAKE_INSTALL_PREFIX}/sbin") ++set(MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man") ++ ++add_subdirectory(finger) ++add_subdirectory(fingerd) +--- /dev/null ++++ b/finger/CMakeLists.txt +@@ -0,0 +1,19 @@ ++ ++add_executable( ++ finger ++ finger.c ++ lprint.c ++ net.c ++ sprint.c ++ util.c ++ display.c ++) ++install( ++ TARGETS finger ++ DESTINATION ${BIN_DIR} ++) ++ ++install( ++ FILES finger.1 ++ DESTINATION ${MAN_DIR}/man1/ ++) +--- /dev/null ++++ b/fingerd/CMakeLists.txt +@@ -0,0 +1,15 @@ ++ ++add_executable( ++ in.fingerd ++ fingerd.c ++) ++install( ++ TARGETS in.fingerd ++ DESTINATION ${SBIN_DIR} ++) ++ ++install( ++ FILES fingerd.8 ++ DESTINATION ${MAN_DIR}/man8/ ++ RENAME in.fingerd.8 ++) diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..703c07c --- /dev/null +++ b/debian/rules @@ -0,0 +1,7 @@ +#!/usr/bin/make -f + +%: + dh $@ --buildsystem=cmake + +override_dh_missing: + dh_missing --fail-missing diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000..779dbfd --- /dev/null +++ b/debian/source/options @@ -0,0 +1,2 @@ +compression = "bzip2" +compression-level = 9 diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..6ff367b --- /dev/null +++ b/debian/watch @@ -0,0 +1,2 @@ +version=3 +ftp://ftp.uk.linux.org/pub/linux/Networking/netkit/ bsd-finger-([\d]+[\.\d]*).tar.gz -- cgit v1.2.3