diff --context --recursive finger-1.37.orig/Makefile.in finger-1.37/Makefile.in *** finger-1.37.orig/Makefile.in Wed Oct 21 18:59:40 1992 --- finger-1.37/Makefile.in Thu Mar 17 20:50:27 1994 *************** *** 7,13 **** EXECUTABLES = $(SRC)/fingerd $(SRC)/finger $(SRC)/in.fingerd $(SRC)/in.cfingerd VERSION = "1.37" DEFS = @DEFS@ ! CC = @CC@ INSTALL = @INSTALL_PROGRAM@ RANLIB = @RANLIB@ ALLOCA = @ALLOCA@ --- 7,13 ---- EXECUTABLES = $(SRC)/fingerd $(SRC)/finger $(SRC)/in.fingerd $(SRC)/in.cfingerd VERSION = "1.37" DEFS = @DEFS@ ! CC = gcc -O2 -fomit-frame-pointer -m486 INSTALL = @INSTALL_PROGRAM@ RANLIB = @RANLIB@ ALLOCA = @ALLOCA@ *************** *** 15,21 **** LIBOBJS = LIBS = @LIBS@ SHELL = /bin/sh ! MAILDIR = @MAILDIR@ NODISTABLES=lib/libfinger.a lib/Makefile lib/site/Makefile src/Makefile src/.gdbinit targets/Makefile support/=* --- 15,22 ---- LIBOBJS = LIBS = @LIBS@ SHELL = /bin/sh ! #MAILDIR = @MAILDIR@ ! MAILDIR = /var/spool/mail NODISTABLES=lib/libfinger.a lib/Makefile lib/site/Makefile src/Makefile src/.gdbinit targets/Makefile support/=* *************** *** 51,58 **** false server: $(AUXOBJS) $(EXECUTABLES) ! (cd $(SRC); $(MAKE) $(MFLAGS) $(CC)="$(CC)" server) ! (cd targets; $(MAKE) $(MFLAGS) $(CC)="$(CC)" server) client: $(AUXOBJS) $(EXECUTABLES) (cd $(SRC); $(MAKE) $(MFLAGS) CC="$(CC)" client) --- 52,59 ---- false server: $(AUXOBJS) $(EXECUTABLES) ! (cd $(SRC); $(MAKE) $(MFLAGS) CC="$(CC)" server) ! (cd targets; $(MAKE) $(MFLAGS) CC="$(CC)" server) client: $(AUXOBJS) $(EXECUTABLES) (cd $(SRC); $(MAKE) $(MFLAGS) CC="$(CC)" client) diff --context --recursive finger-1.37.orig/config.h finger-1.37/config.h *** finger-1.37.orig/config.h Thu Oct 22 16:29:32 1992 --- finger-1.37/config.h Thu Feb 17 19:51:47 1994 *************** *** 59,69 **** /* Define to check that ~/.fingerrc is owned by the user we're execing as. Really only does anything to promote security on systems that won't allow anyone to give away their files. */ ! /* #define CHECK_OWNER_FINGERRC */ /* Define to make sure ~/.fingerrc isn't writable by anyone except the owner. Highly recommended. */ ! /* #define CHECK_RDONLY_FINGERRC */ /* Define if the default service for the finger client is related to the basename. */ --- 59,69 ---- /* Define to check that ~/.fingerrc is owned by the user we're execing as. Really only does anything to promote security on systems that won't allow anyone to give away their files. */ ! #define CHECK_OWNER_FINGERRC /* Define to make sure ~/.fingerrc isn't writable by anyone except the owner. Highly recommended. */ ! #define CHECK_RDONLY_FINGERRC /* Define if the default service for the finger client is related to the basename. */ *************** *** 86,95 **** /* Shell to use when execing ~/.fingerrc instead of user's login shell. Comment out to use user's login shell. */ ! /* #define FINGERRC_SHELL "/bin/sh" */ /* Define if you want --info to be the default, rather than --brief. */ ! /* #define INFO_IS_DEFAULT */ /* Default polling interval for fingerd, in seconds */ #define DEFAULT_POLL_INTERVAL 120 --- 86,95 ---- /* Shell to use when execing ~/.fingerrc instead of user's login shell. Comment out to use user's login shell. */ ! #define FINGERRC_SHELL "/bin/sh" /* Define if you want --info to be the default, rather than --brief. */ ! #define INFO_IS_DEFAULT /* Default polling interval for fingerd, in seconds */ #define DEFAULT_POLL_INTERVAL 120 *************** *** 131,140 **** directories to search for mugshots (faces). Note that this value should be surrounded by double quotes. */ ! #define FingerDir /usr/local/etc/fingerdir ! #define BinDir /usr/local/bin ! #define EtcDir /usr/local/etc ! #define MugShotPath "/usr/local/lib/mugshots:/usr/local/mugshots" /* Define USE_DATABASE if you want to keep information about users in a DBM database. You can define the format of this database by simply --- 131,140 ---- directories to search for mugshots (faces). Note that this value should be surrounded by double quotes. */ ! #define FingerDir /etc/fingerdir ! #define BinDir /usr/bin ! #define EtcDir /usr/sbin ! #define MugShotPath "/usr/local/lib/mugshots:/usr/lib/mugshots" /* Define USE_DATABASE if you want to keep information about users in a DBM database. You can define the format of this database by simply *************** *** 205,215 **** --- 205,217 ---- #if defined(USG) || defined (STDC_HEADERS) #include + #if !defined(NeXT) #define index strchr #define rindex strrchr #define bcopy(s, d, n) (memcpy ((d), (s), (n))) #define bcmp(s1, s2, n) (memcmp ((s1), (s2), (n))) #define bzero(d, n) (memset ((d), 0, (n))) + #endif /* !NeXT */ #else #include #endif Only in finger-1.37/: config.status Only in finger-1.37.orig/doc: finger.aux Only in finger-1.37.orig/doc: finger.cp Only in finger-1.37.orig/doc: finger.fn Only in finger-1.37.orig/doc: finger.ky Only in finger-1.37.orig/doc: finger.log Only in finger-1.37.orig/doc: finger.pg Only in finger-1.37.orig/doc: finger.toc Only in finger-1.37.orig/doc: finger.tp Only in finger-1.37.orig/doc: finger.vr diff --context --recursive finger-1.37.orig/include/fingerpaths.h finger-1.37/include/fingerpaths.h *** finger-1.37.orig/include/fingerpaths.h Mon Oct 26 22:15:14 1992 --- finger-1.37/include/fingerpaths.h Thu Feb 17 19:52:56 1994 *************** *** 22,58 **** does NOT end in a slash. */ #ifndef FINGERDIR ! #define FINGERDIR "/usr/local/etc/fingerdir" #endif /* File of hostnames that we should poll. Environment variable FINGERCLIENTS affects this. */ #ifndef FINGERCLIENTS ! #define FINGERCLIENTS "/usr/local/etc/fingerdir/clients" #endif /* File which contains the data received from all active polled hosts. */ ! #define HOSTDATA "/usr/local/etc/fingerdir/hostdata" /* File which contains the data pertaining to the location of users. */ ! #define USERDATA "/usr/local/etc/fingerdir/userdata" /* File which contains the status of each client that we poll. */ ! #define HOSTSTAT "/usr/local/etc/fingerdir/clientstatus" /* File which contains the name of the GNU Finger server. */ #ifndef SERVERHOSTFILE ! #define SERVERHOSTFILE "/usr/local/etc/fingerdir/serverhost" #endif /* File which contains the name of the forward server. */ #ifndef FORWARDHOSTFILE ! #define FORWARDHOSTFILE "/usr/local/etc/fingerdir/forwardhost" #endif /* File which contains the name of the SMTP host */ #ifndef SMTPHOSTFILE ! #define SMTPHOSTFILE "/usr/local/etc/fingerdir/mailhost" #endif /* File of terminal->location mappings, one per line. The first word on the --- 22,58 ---- does NOT end in a slash. */ #ifndef FINGERDIR ! #define FINGERDIR "/etc/fingerdir" #endif /* File of hostnames that we should poll. Environment variable FINGERCLIENTS affects this. */ #ifndef FINGERCLIENTS ! #define FINGERCLIENTS "/etc/fingerdir/clients" #endif /* File which contains the data received from all active polled hosts. */ ! #define HOSTDATA "/etc/fingerdir/hostdata" /* File which contains the data pertaining to the location of users. */ ! #define USERDATA "/etc/fingerdir/userdata" /* File which contains the status of each client that we poll. */ ! #define HOSTSTAT "/etc/fingerdir/clientstatus" /* File which contains the name of the GNU Finger server. */ #ifndef SERVERHOSTFILE ! #define SERVERHOSTFILE "/etc/fingerdir/serverhost" #endif /* File which contains the name of the forward server. */ #ifndef FORWARDHOSTFILE ! #define FORWARDHOSTFILE "/etc/fingerdir/forwardhost" #endif /* File which contains the name of the SMTP host */ #ifndef SMTPHOSTFILE ! #define SMTPHOSTFILE "/etc/fingerdir/mailhost" #endif /* File of terminal->location mappings, one per line. The first word on the *************** *** 62,73 **** to have the file contain host->location mappings, which isn't as good, but still works. */ #ifndef TTYLOCFILE ! #define TTYLOCFILE "/usr/local/etc/fingerdir/ttylocs" #endif /* Directory to look for special target scripts in */ #ifndef TARGETDIR ! #define TARGETDIR "/usr/local/etc/fingerdir/targets" #endif /* If you decide to use the dbm interface for storing information about --- 62,73 ---- to have the file contain host->location mappings, which isn't as good, but still works. */ #ifndef TTYLOCFILE ! #define TTYLOCFILE "/etc/fingerdir/ttylocs" #endif /* Directory to look for special target scripts in */ #ifndef TARGETDIR ! #define TARGETDIR "/etc/fingerdir/targets" #endif /* If you decide to use the dbm interface for storing information about *************** *** 75,83 **** and the location of the file that describes the format of the database. */ #if !defined (DBMINFO) ! #define DBMINFO "/usr/local/etc/fingerdir/userinfo" #endif #if !defined (FORMATFILE) ! #define FORMATFILE "/usr/local/etc/fingerdir/userformat" #endif --- 75,83 ---- and the location of the file that describes the format of the database. */ #if !defined (DBMINFO) ! #define DBMINFO "/etc/fingerdir/userinfo" #endif #if !defined (FORMATFILE) ! #define FORMATFILE "/etc/fingerdir/userformat" #endif diff --context --recursive finger-1.37.orig/lib/os.c finger-1.37/lib/os.c *** finger-1.37.orig/lib/os.c Thu Oct 22 16:01:10 1992 --- finger-1.37/lib/os.c Thu Feb 17 19:43:28 1994 *************** *** 23,29 **** --- 23,31 ---- #include #include #include + #ifndef linux #include + #endif #include #include *************** *** 43,51 **** --- 45,55 ---- #ifdef HAVE_PROC_FS #include + #ifndef linux #include #include #include + #endif /*linux*/ #endif #include *************** *** 193,198 **** --- 197,203 ---- long idle, current_time, get_last_access (); char *hostname, *ttyloc, *tty_location (); #ifdef HAVE_PROC_FS + #ifndef linux prpsinfo_t procinfo; struct procent { *************** *** 202,207 **** --- 207,222 ---- char fname[sizeof (procinfo.pr_fname)]; } *proctable, *tableptr; + #else + struct procent + { + time_t start; + int uid; + dev_t tty; + char fname[15]; + } + *proctable, *tableptr; + #endif /* linux */ int nprocs = 0; #endif /* HAVE_PROC_FS */ *************** *** 235,240 **** --- 250,256 ---- searching through user list. */ #ifdef HAVE_PROC_FS + #ifndef linux { extern char *savedir (); char *dirstring = savedir ("/proc", 2*1024, &nprocs); *************** *** 280,285 **** --- 296,359 ---- free (dirstring); } } + #else /* linux */ + { + + extern char *savedir (); + char *dirstring = savedir ("/proc", 2*1024, &nprocs); + char *proc; + int procfd; + char procfile[17], procstatbuffer[1024]; + struct stat proc_fs_stat; + char procstate; + int tmp_tty; /* dev_t is unsigned, -1 means no controlling tty */ + + /* Allocate process table */ + if (nprocs) + proctable = (struct procent *) xmalloc (sizeof *proctable * nprocs); + + /* Walk processes */ + if (dirstring && nprocs) + { + for (tableptr = proctable, proc = dirstring; + *proc; proc += strlen (proc) + 1) + { + sprintf (procfile, "/proc/%.5s/stat", proc); + + if ((procfd = open (procfile, O_RDONLY)) >= 0 + && read (procfd, procstatbuffer, 1024)) + { + /* see /usr/src/linux/fs/proc/array.c + * this is for 0.99.4 + */ + sscanf (procstatbuffer, "%*d (%14s %c %*d %*d %*d %d " + "%*d %*u %*u %*u %*u %*u %*d %*d %*d %*d %*d %*d %*u " + "%*u %hd" /* " %*u %*u %*u %*u %*u %*u %*u %*u %*d %*d " + "%*d %*d %*u" */, + tableptr->fname, &procstate, &tmp_tty, + &tableptr->start); + tableptr->fname[strlen(tableptr->fname)-1] = 0; /*trailing )*/ + tableptr->tty = tmp_tty; + if (fstat (procfd, &proc_fs_stat) == 0) + tableptr->uid = proc_fs_stat.st_uid; + + /* Only collect non-zombies with controlling tty */ + if (tmp_tty > 0 && procstate != 'Z') + { + tableptr++; + } + else + nprocs--; + + close (procfd); + } + else + nprocs--; + } + free (dirstring); + } + } + #endif /* linux */ #endif /* HAVE_PROC_FS */ *************** *** 332,341 **** --- 406,419 ---- if (stat (device_name, &finfo) != -1) { + #ifdef linux + dev_t tty = finfo.st_rdev&0xff; + #else #ifdef HAVE_ST_RDEV dev_t tty = finfo.st_rdev; #else dev_t tty = finfo.st_dev; + #endif #endif int file; diff --context --recursive finger-1.37.orig/lib/packet.c finger-1.37/lib/packet.c *** finger-1.37.orig/lib/packet.c Wed Oct 21 17:04:38 1992 --- finger-1.37/lib/packet.c Thu Feb 17 19:44:40 1994 *************** *** 196,205 **** packet->name, real_name, what, idle ? idle : "", tty, hostname, ttyloc); if (idle) ! free (idle); fflush (stream); ! free (hostname); } /* Print out everything in a packet to stderr. */ --- 196,205 ---- packet->name, real_name, what, idle ? idle : "", tty, hostname, ttyloc); if (idle) ! xfree (idle); fflush (stream); ! xfree (hostname); } /* Print out everything in a packet to stderr. */ *************** *** 222,228 **** packet->name, packet->real_name, packet->host, ctime (&(packet->login_time)), idle ? idle : "", packet->ttyname, packet->ttyloc, packet->what); ! free (idle); fflush (stderr); } --- 222,228 ---- packet->name, packet->real_name, packet->host, ctime (&(packet->login_time)), idle ? idle : "", packet->ttyname, packet->ttyloc, packet->what); ! xfree (idle); fflush (stderr); } *************** *** 270,276 **** wakeup = (char *) xmalloc (3 + strlen (user)); sprintf (wakeup, ":%s\r\n", user); write (connection, wakeup, strlen (wakeup)); ! free (wakeup); } stream = fdopen (connection, "r"); --- 270,276 ---- wakeup = (char *) xmalloc (3 + strlen (user)); sprintf (wakeup, ":%s\r\n", user); write (connection, wakeup, strlen (wakeup)); ! xfree (wakeup); } stream = fdopen (connection, "r"); *************** *** 315,326 **** end = i; for (i = start; i < end; i++) ! free (list[i]); ! for (i = 0; list[end + i]; i++) list[start + i] = list[end + i]; list[start + i] = (FINGER_PACKET *)NULL; } } } --- 315,326 ---- end = i; for (i = start; i < end; i++) ! xfree (list[i]); for (i = 0; list[end + i]; i++) list[start + i] = list[end + i]; list[start + i] = (FINGER_PACKET *)NULL; + host_index = end - 1; /* continue from where we left off (img/mrg/16-feb-94) */ } } } *************** *** 348,354 **** --- 348,356 ---- perror (filename); } + #ifndef linux /* doesn't have fsync (as of .99.4) */ fsync (file); + #endif close (file); } *************** *** 561,567 **** signal (SIGALRM, SIG_DFL); if (line) ! free (line); return return_val; --- 563,569 ---- signal (SIGALRM, SIG_DFL); if (line) ! xfree (line); return return_val; diff --context --recursive finger-1.37.orig/lib/savedir.c finger-1.37/lib/savedir.c *** finger-1.37.orig/lib/savedir.c Fri Oct 16 20:52:40 1992 --- finger-1.37/lib/savedir.c Thu Feb 17 19:43:28 1994 *************** *** 132,138 **** char * stpcpy (dest, source) char *dest; ! char *source; { while ((*dest++ = *source++) != '\0') /* Do nothing. */ ; --- 132,138 ---- char * stpcpy (dest, source) char *dest; ! const char *source; /* gcc insists on prototype consistency */ { while ((*dest++ = *source++) != '\0') /* Do nothing. */ ; diff --context --recursive finger-1.37.orig/lib/util.c finger-1.37/lib/util.c *** finger-1.37.orig/lib/util.c Mon Oct 26 22:11:43 1992 --- finger-1.37/lib/util.c Thu Feb 17 19:44:40 1994 *************** *** 459,462 **** --- 459,466 ---- #endif free (blk); + #if 0 + fprintf (stderr, "free OK\n", blk); /* DEBUG */ + #endif + } diff --context --recursive finger-1.37.orig/src/Makefile.in finger-1.37/src/Makefile.in *** finger-1.37.orig/src/Makefile.in Wed Oct 21 19:00:16 1992 --- finger-1.37/src/Makefile.in Thu Mar 17 20:52:59 1994 *************** *** 85,102 **** server: $(EXECUTABLES) .fingerdir .etcdir .bindir -if [ ! -r `cat .etcdir` ]; then mkdir `cat .etcdir`; fi -if [ ! -r `cat .fingerdir` ]; then mkdir `cat .fingerdir`; fi ! cp finger `cat .bindir`; chmod a+rx `cat .bindir`/finger ! cp fingerd `cat .etcdir`; chmod a+rx `cat .etcdir`/fingerd ! cp in.fingerd `cat .etcdir`; chmod a+rx `cat .etcdir`/in.fingerd ! cp in.cfingerd `cat .etcdir`; chmod a+rx `cat .etcdir`/in.cfingerd (cd ../lib/site; make install) client: $(EXECUTABLES) .etcdir .fingerdir .bindir -if [ ! -r `cat .etcdir` ]; then mkdir `cat .etcdir`; fi -if [ ! -r `cat .fingerdir` ]; then mkdir `cat .fingerdir`; fi ! cp finger `cat .bindir`; chmod a+rx `cat .bindir`/finger ! cp in.fingerd `cat .etcdir`; chmod a+rx `cat .etcdir`/in.fingerd ! cp in.cfingerd `cat .etcdir`; chmod a+rx `cat .etcdir`/in.cfingerd touch `cat .fingerdir`/ttylocs clean: --- 85,102 ---- server: $(EXECUTABLES) .fingerdir .etcdir .bindir -if [ ! -r `cat .etcdir` ]; then mkdir `cat .etcdir`; fi -if [ ! -r `cat .fingerdir` ]; then mkdir `cat .fingerdir`; fi ! install -g bin -m 755 -o root finger `cat .bindir` ! install -g bin -m 744 -o root fingerd `cat .etcdir` ! install -g bin -m 744 -o root in.fingerd `cat .etcdir` ! install -g bin -m 744 -o root in.cfingerd `cat .etcdir` (cd ../lib/site; make install) client: $(EXECUTABLES) .etcdir .fingerdir .bindir -if [ ! -r `cat .etcdir` ]; then mkdir `cat .etcdir`; fi -if [ ! -r `cat .fingerdir` ]; then mkdir `cat .fingerdir`; fi ! install -g bin -m 755 -o root finger `cat .bindir` ! install -g bin -m 744 -o root in.fingerd `cat .etcdir` ! install -g bin -m 744 -o root in.cfingerd `cat .etcdir` touch `cat .fingerdir`/ttylocs clean: diff --context --recursive finger-1.37.orig/src/finger.c finger-1.37/src/finger.c *** finger-1.37.orig/src/finger.c Wed Oct 21 19:41:13 1992 --- finger-1.37/src/finger.c Thu Feb 17 19:49:00 1994 *************** *** 107,113 **** char *arg, *port; int optc; - default_error_handling (argv[0]); /* Parse the arguments passed on the command line. */ --- 107,112 ---- *************** *** 192,197 **** --- 191,200 ---- long addr; char *finger_server = NULL; int suppress_hostname = 0; + int did_malloc = 0; /* remember any mallocs for the hostname */ + #if defined(linux) /* gethostbyaddr evidently returns pointer to static area */ + int do_hostfree = 0; + #endif /* linux */ username = savestring (arg); *************** *** 237,242 **** --- 240,249 ---- { host = (struct hostent *) xmalloc (sizeof (struct hostent)); host->h_name = hostname; + did_malloc = 1; + #if defined (linux) + do_hostfree = 1; + #endif /* linux */ } } else *************** *** 296,301 **** --- 303,315 ---- if (finger_server) free (finger_server); + #if !defined (linux) if (host) free (host); + #else + if (did_malloc) + free (host); + if (host && do_hostfree) + free (host); + #endif } diff --context --recursive finger-1.37.orig/src/fingerd.c finger-1.37/src/fingerd.c *** finger-1.37.orig/src/fingerd.c Wed Oct 28 10:12:52 1992 --- finger-1.37/src/fingerd.c Thu Feb 17 19:44:40 1994 *************** *** 139,145 **** char *serverhost, *this_host; int arg_index = 1, optc; - allow_time_outs = 1; default_error_handling (argv[0]); --- 139,144 ---- *************** *** 365,375 **** if (clients) { for (i = 0; clients[i]; i++) ! { ! free (clients[i]); ! } ! ! free (clients); clients = (CLIENT **)NULL; clients_size = 0; } --- 364,371 ---- if (clients) { for (i = 0; clients[i]; i++) ! xfree (clients[i]); ! xfree (clients); clients = (CLIENT **)NULL; clients_size = 0; } *************** *** 381,390 **** line_number++; i = 0; if (directive) ! free (directive); if (port) ! free (port); directive = xmalloc (line_size + 1); port = xmalloc (line_size + 1); --- 377,386 ---- line_number++; i = 0; if (directive) ! xfree (directive); if (port) ! xfree (port); directive = xmalloc (line_size + 1); port = xmalloc (line_size + 1); *************** *** 463,469 **** int start = i; if (hostname) ! free (hostname); hostname = xmalloc (line_size + 1); --- 459,465 ---- int start = i; if (hostname) ! xfree (hostname); hostname = xmalloc (line_size + 1); *************** *** 500,515 **** } if (line) ! free (line); if (directive) ! free (directive); if (hostname) ! free (hostname); if (port) ! free (port); fclose (stream); client_index = 0; --- 496,511 ---- } if (line) ! xfree (line); if (directive) ! xfree (directive); if (hostname) ! xfree (hostname); if (port) ! xfree (port); fclose (stream); client_index = 0; *************** *** 671,678 **** for (i = 0; packets[i]; i++) { if (debugging) ! print_packet (packets[i], debug_output); ! if (packets[i]->idle_time < machine_idle_time) machine_idle_time = packets[i]->idle_time; --- 667,673 ---- for (i = 0; packets[i]; i++) { if (debugging) ! print_packet (packets[i], debug_output); if (packets[i]->idle_time < machine_idle_time) machine_idle_time = packets[i]->idle_time; diff --context --recursive finger-1.37.orig/src/in.cfingerd.c finger-1.37/src/in.cfingerd.c *** finger-1.37.orig/src/in.cfingerd.c Thu Oct 15 16:54:58 1992 --- finger-1.37/src/in.cfingerd.c Thu Feb 17 19:44:40 1994 *************** *** 49,61 **** char *buffer = NULL; int buffer_size = 0; - default_error_handling (argv[0]); if (getline (&buffer, &buffer_size, stdin) < 0) exit (1); ! free (buffer); packets = get_finger_data (1); --- 49,60 ---- char *buffer = NULL; int buffer_size = 0; default_error_handling (argv[0]); if (getline (&buffer, &buffer_size, stdin) < 0) exit (1); ! xfree (buffer); packets = get_finger_data (1);