1 --- bsd-finger-0.17.orig/finger/finger.1
2 +++ bsd-finger-0.17/finger/finger.1
4 must be able to see the
6 file. This generally means that the home directory containing the file
7 -must have the other-users-execute bit set (o+w). See
8 +must have the other-users-execute bit set (o+x). See
10 If you use this feature for privacy, please test it with ``finger
11 @localhost'' before relying on it, just in case.
16 These files are printed as part of a long-format request. The
18 -file is limited to one line; the
20 file may be arbitrarily long.
22 --- bsd-finger-0.17.orig/finger/finger.c
23 +++ bsd-finger-0.17/finger/finger.c
25 #include "../version.h"
27 static void loginlist(void);
28 -static void userlist(int argc, char *argv[]);
29 +static int userlist(int argc, char *argv[]);
32 static int sflag, mflag;
35 int main(int argc, char *argv[]) {
38 struct sockaddr_in sin;
39 socklen_t slen = sizeof(sin);
45 - userlist(argc, argv);
46 + err = userlist(argc, argv);
48 * Assign explicit "large" format if names given and -s not
49 * explicitly stated. Force the -l AFTER we get names so any
51 if (lflag) lflag_print();
58 /* Returns 1 if .nofinger is found and enable_nofinger is set. */
60 check_nofinger(struct passwd *pw)
62 if (enable_nofinger) {
63 - char path[PATH_MAX];
65 - snprintf(path, sizeof(path), "%s/.nofinger", pw->pw_dir);
66 - if (stat(path, &tripe)==0) {
69 + if (asprintf(&path, "%s/.nofinger", pw->pw_dir) < 0) {
70 + eprintf("finger: Out of space.\n");
73 + ret = stat(path, &tripe);
85 userlist(int argc, char *argv[])
90 PERSON *nethead, **nettail;
94 /* handle network requests */
95 for (pn = nethead; pn; pn = pn->next) {
96 - netfinger(pn->name);
97 + err |= netfinger(pn->name);
98 if (pn->next || entries)
107 * Scan thru the list of users currently logged in, saving
115 --- bsd-finger-0.17.orig/finger/finger.h
116 +++ bsd-finger-0.17/finger/finger.h
118 void enter_where(struct utmp *ut, PERSON *pn);
119 void enter_lastlog(PERSON *pn);
120 int match(struct passwd *pw, const char *user);
121 -void netfinger(const char *name);
122 +int netfinger(const char *name);
123 const char *prphone(const char *num);
126 --- bsd-finger-0.17.orig/finger/lprint.c
127 +++ bsd-finger-0.17/finger/lprint.c
129 #include <sys/types.h>
130 #include <sys/file.h>
131 #include <sys/stat.h>
132 -#include <sys/time.h>
136 static void lprint(PERSON *pn);
138 * office, office phone, home phone if available
140 xprintf("Login: %-15s\t\t\tName: %s\nDirectory: %-25s",
141 - pn->name, pn->realname, pn->dir);
142 + pn->name, pn->realname ? pn->realname : "", pn->dir);
143 xprintf("\tShell: %-s\n", *pn->shell ? pn->shell : _PATH_BSHELL);
146 --- bsd-finger-0.17.orig/finger/net.c
147 +++ bsd-finger-0.17/finger/net.c
152 -void netfinger(const char *name) {
153 +int netfinger(const char *name) {
155 struct in_addr defaddr;
156 register int c, sawret, ateol;
158 char *alist[1], *host;
160 host = strrchr(name, '@');
162 + if (!host) return 1;
165 memset(&sn, 0, sizeof(sn));
167 sp = getservbyname("finger", "tcp");
169 eprintf("finger: tcp/finger: unknown service\n");
173 sn.sin_port = sp->s_port;
177 if (!inet_aton(host, &defaddr)) {
178 eprintf("finger: unknown host: %s\n", host);
183 def.h_addr_list = alist;
186 if ((s = socket(hp->h_addrtype, SOCK_STREAM, 0)) < 0) {
187 eprintf("finger: socket: %s\n", strerror(errno));
192 /* print hostname before connecting, in case it takes a while */
194 if (connect(s, (struct sockaddr *)&sn, sizeof(sn)) < 0) {
195 eprintf("finger: connect: %s\n", strerror(errno));
201 /* -l flag for remote fingerd */
204 eprintf("finger: fdopen: %s\n", strerror(errno));
213 if (!ateol) xputc('\n');
218 --- bsd-finger-0.17.orig/finger/sprint.c
219 +++ bsd-finger-0.17/finger/sprint.c
221 #endif /* not lint */
223 #include <sys/types.h>
224 -#include <sys/time.h>
229 --- bsd-finger-0.17.orig/finger/util.c
230 +++ bsd-finger-0.17/finger/util.c
234 /* No device for X console. Utmp entry by XDM login (":0"). */
235 - if (w->tty[0] == ':') {
236 + if (strchr(w->tty, ':')) {
237 w->idletime = 0; /* would be nice to have it emit ??? */
241 * fields[3] -> homephone
244 - for (p = strtok(bp, ","); p; p = strtok(NULL, ",")) {
245 - if (*p==0) p = NULL; // skip empties
246 - if (nfields < 4) fields[nfields++] = p;
247 + while ((p = strsep(&bp, ","))) {
248 + if (nfields < 4) fields[nfields++] = *p ? p : NULL;
250 while (nfields<4) fields[nfields++] = NULL;
254 pn->realname = rname;
257 + pn->realname = NULL;
260 pn->office = fields[1] ? strdup(fields[1]) : NULL;
261 pn->officephone = fields[2] ? strdup(fields[2]) : NULL;