diff options
Diffstat (limited to 'debian/patches')
-rw-r--r-- | debian/patches/01-legacy.patch | 328 | ||||
-rw-r--r-- | debian/patches/02-518559-nsswitch-sources.patch | 98 | ||||
-rw-r--r-- | debian/patches/03-468454-fingerd-ipv6.patch | 33 | ||||
-rw-r--r-- | debian/patches/04-468454-finger-ipv6.patch | 120 | ||||
-rw-r--r-- | debian/patches/05-547014-netgroup.patch | 27 | ||||
-rw-r--r-- | debian/patches/06-572211-decrease-timeout.patch | 75 | ||||
-rw-r--r-- | debian/patches/series | 8 | ||||
-rw-r--r-- | debian/patches/use-cmake-as-buildsystem-debian-extras.patch | 29 | ||||
-rw-r--r-- | debian/patches/use-cmake-as-buildsystem.patch | 59 |
9 files changed, 777 insertions, 0 deletions
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 <sys/types.h> + #include <sys/file.h> + #include <sys/stat.h> +-#include <sys/time.h> ++#include <time.h> + #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 <ctype.h> + #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 <sys/types.h> +-#include <sys/time.h> ++#include <time.h> + #include <stdio.h> + #include <stdlib.h> + #include <string.h> +--- 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 <netinet/in.h> + #include <sys/utsname.h> + #include <sys/wait.h> ++#include <sys/socket.h> + + #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 <tabbott@MIT.EDU>
+
+commit ab0b4e09b1281a11587fd0f9797e612cfb08ef57
+Author: Timothy G Abbott <tabbott@mit.edu>
+Date: Fri Mar 6 22:30:00 2009 -0500
+
+ Add support for non-iterable nsswitch sources.
+
+ Signed-off-by: Timothy G Abbott <tabbott@mit.edu>
+
+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 <debian@gisladisker.se> +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 <debian@gisladisker.se> +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" <mdunford@lbl.gov> + +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 <debian@gisladisker.se> +Forwarded: no +Last-Updated: 2010-03-02 + +--- a/finger/net.c ++++ b/finger/net.c +@@ -49,14 +49,25 @@ + #include <string.h> + #include <unistd.h> + #include <ctype.h> ++#include <signal.h> + #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 <debian.axhn@manchmal.in-ulm.de> +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 <debian.axhn@manchmal.in-ulm.de> +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 ++) |