386BSD 0.1 development
authorWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Fri, 12 Apr 1991 21:15:55 +0000 (13:15 -0800)
committerWilliam F. Jolitz <wjolitz@soda.berkeley.edu>
Fri, 12 Apr 1991 21:15:55 +0000 (13:15 -0800)
Work on file usr/src/libexec/comsat/comsat.8
Work on file usr/src/libexec/comsat/comsat.c
Work on file usr/src/libexec/fingerd/pathnames.h
Work on file usr/src/libexec/fingerd/fingerd.c
Work on file usr/src/libexec/fingerd/fingerd.8

Co-Authored-By: Lynne Greer Jolitz <ljolitz@cardio.ucsf.edu>
Synthesized-from: 386BSD-0.1

usr/src/libexec/comsat/comsat.8 [new file with mode: 0644]
usr/src/libexec/comsat/comsat.c [new file with mode: 0644]
usr/src/libexec/fingerd/fingerd.8 [new file with mode: 0644]
usr/src/libexec/fingerd/fingerd.c [new file with mode: 0644]
usr/src/libexec/fingerd/pathnames.h [new file with mode: 0644]

diff --git a/usr/src/libexec/comsat/comsat.8 b/usr/src/libexec/comsat/comsat.8
new file mode 100644 (file)
index 0000000..317b749
--- /dev/null
@@ -0,0 +1,96 @@
+.\" Copyright (c) 1983, 1991 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by the University of
+.\"    California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"     @(#)comsat.8   6.5 (Berkeley) 3/16/91
+.\"
+.Dd March 16, 1991
+.Dt COMSAT 8
+.Os BSD 4.2
+.Sh NAME
+.Nm comsat
+.Nd biff server
+.Sh SYNOPSIS
+.Nm comsat
+.Sh DESCRIPTION
+.Nm Comsat
+is the server process which receives reports of incoming mail
+and notifies users if they have requested this service.
+.Nm Comsat
+receives messages on a datagram port associated with the
+.Dq biff
+service
+specification (see
+.Xr services 5
+and
+.Xr inetd 8 ) .
+The one line messages are of the form:
+.Pp
+.Dl user@mailbox-offset
+.Pp
+If the
+.Em user
+specified is logged in to the system and the associated terminal has
+the owner execute bit turned on (by a
+.Dq Li biff y ) ,
+the
+.Em offset
+is used as a seek offset into the appropriate mailbox file and
+the first 7 lines or 560 characters of the message are printed
+on the user's terminal.  Lines which appear to be part of
+the message header other than the
+.Dq From ,
+.Dq \&To ,
+.Dq Date ,
+or
+.Dq Subject
+lines are not included in the displayed message.
+.Sh FILES
+.Bl -tag -width /var/run/utmp -compact
+.It Pa /var/run/utmp
+to find out who's logged on and on what terminals
+.El
+.Sh SEE ALSO
+.Xr biff 1 ,
+.Xr inetd 8
+.Sh BUGS
+The message header filtering is prone to error.
+The density of the information presented is near the theoretical minimum.
+.Pp
+Users should be notified of mail which arrives on other
+machines than the one to which they are currently logged in.
+.Pp
+The notification should appear in a separate window so it
+does not mess up the screen.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.2 .
diff --git a/usr/src/libexec/comsat/comsat.c b/usr/src/libexec/comsat/comsat.c
new file mode 100644 (file)
index 0000000..1bcd4d1
--- /dev/null
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 1980 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1980 Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)comsat.c   5.24 (Berkeley) 2/25/91";
+#endif /* not lint */
+
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <sys/wait.h>
+
+#include <netinet/in.h>
+
+#include <stdio.h>
+#include <sgtty.h>
+#include <utmp.h>
+#include <signal.h>
+#include <errno.h>
+#include <netdb.h>
+#include <syslog.h>
+#include <ctype.h>
+#include <string.h>
+#include <paths.h>
+
+int    debug = 0;
+#define        dsyslog if (debug) syslog
+
+#define MAXIDLE        120
+
+char   hostname[MAXHOSTNAMELEN];
+struct utmp *utmp = NULL;
+time_t lastmsgtime, time();
+int    nutmp, uf;
+
+/* ARGSUSED */
+main(argc, argv)
+       int argc;
+       char **argv;
+{
+       extern int errno;
+       register int cc;
+       char msgbuf[100];
+       struct sockaddr_in from;
+       int fromlen;
+       void onalrm(), reapchildren();
+
+       /* verify proper invocation */
+       fromlen = sizeof(from);
+       if (getsockname(0, (struct sockaddr *)&from, &fromlen) < 0) {
+               (void)fprintf(stderr,
+                   "comsat: getsockname: %s.\n", strerror(errno));
+               exit(1);
+       }
+       openlog("comsat", LOG_PID, LOG_DAEMON);
+       if (chdir(_PATH_MAILDIR)) {
+               syslog(LOG_ERR, "chdir: %s: %m", _PATH_MAILDIR);
+               exit(1);
+       }
+       if ((uf = open(_PATH_UTMP, O_RDONLY, 0)) < 0) {
+               syslog(LOG_ERR, ".main: %s: %m", _PATH_UTMP);
+               (void) recv(0, msgbuf, sizeof(msgbuf) - 1, 0);
+               exit(1);
+       }
+       (void)time(&lastmsgtime);
+       (void)gethostname(hostname, sizeof(hostname));
+       onalrm();
+       (void)signal(SIGALRM, onalrm);
+       (void)signal(SIGTTOU, SIG_IGN);
+       (void)signal(SIGCHLD, reapchildren);
+       for (;;) {
+               cc = recv(0, msgbuf, sizeof(msgbuf) - 1, 0);
+               if (cc <= 0) {
+                       if (errno != EINTR)
+                               sleep(1);
+                       errno = 0;
+                       continue;
+               }
+               if (!nutmp)             /* no one has logged in yet */
+                       continue;
+               sigblock(sigmask(SIGALRM));
+               msgbuf[cc] = 0;
+               (void)time(&lastmsgtime);
+               mailfor(msgbuf);
+               sigsetmask(0L);
+       }
+}
+
+void
+reapchildren()
+{
+       while (wait3((int *)NULL, WNOHANG, (struct rusage *)NULL) > 0);
+}
+
+void
+onalrm()
+{
+       static u_int utmpsize;          /* last malloced size for utmp */
+       static u_int utmpmtime;         /* last modification time for utmp */
+       struct stat statbf;
+       off_t lseek();
+       char *malloc(), *realloc();
+
+       if (time((time_t *)NULL) - lastmsgtime >= MAXIDLE)
+               exit(0);
+       (void)alarm((u_int)15);
+       (void)fstat(uf, &statbf);
+       if (statbf.st_mtime > utmpmtime) {
+               utmpmtime = statbf.st_mtime;
+               if (statbf.st_size > utmpsize) {
+                       utmpsize = statbf.st_size + 10 * sizeof(struct utmp);
+                       if (utmp)
+                               utmp = (struct utmp *)realloc((char *)utmp, utmpsize);
+                       else
+                               utmp = (struct utmp *)malloc(utmpsize);
+                       if (!utmp) {
+                               syslog(LOG_ERR, "malloc failed");
+                               exit(1);
+                       }
+               }
+               (void)lseek(uf, 0L, L_SET);
+               nutmp = read(uf, utmp, (int)statbf.st_size)/sizeof(struct utmp);
+       }
+}
+
+mailfor(name)
+       char *name;
+{
+       register struct utmp *utp = &utmp[nutmp];
+       register char *cp;
+       off_t offset;
+
+       if (!(cp = index(name, '@')))
+               return;
+       *cp = '\0';
+       offset = atoi(cp + 1);
+       while (--utp >= utmp)
+               if (!strncmp(utp->ut_name, name, sizeof(utmp[0].ut_name)))
+                       notify(utp, offset);
+}
+
+static char *cr;
+
+notify(utp, offset)
+       register struct utmp *utp;
+       off_t offset;
+{
+       static char tty[20] = _PATH_DEV;
+       struct sgttyb gttybuf;
+       struct stat stb;
+       FILE *tp;
+       char name[sizeof(utmp[0].ut_name) + 1];
+
+       (void)strncpy(tty + sizeof(_PATH_DEV) - 1, utp->ut_line,
+           sizeof(utp->ut_line));
+       if (stat(tty, &stb) || !(stb.st_mode & S_IEXEC)) {
+               dsyslog(LOG_DEBUG, "%s: wrong mode on %s", utp->ut_name, tty);
+               return;
+       }
+       dsyslog(LOG_DEBUG, "notify %s on %s\n", utp->ut_name, tty);
+       if (fork())
+               return;
+       (void)signal(SIGALRM, SIG_DFL);
+       (void)alarm((u_int)30);
+       if ((tp = fopen(tty, "w")) == NULL) {
+               dsyslog(LOG_ERR, "fopen of tty %s failed", tty);
+               _exit(-1);
+       }
+       (void)ioctl(fileno(tp), TIOCGETP, &gttybuf);
+       cr = (gttybuf.sg_flags&CRMOD) && !(gttybuf.sg_flags&RAW) ?
+           "\n" : "\n\r";
+       (void)strncpy(name, utp->ut_name, sizeof(utp->ut_name));
+       name[sizeof(name) - 1] = '\0';
+       (void)fprintf(tp, "%s\007New mail for %s@%.*s\007 has arrived:%s----%s",
+           cr, name, sizeof(hostname), hostname, cr, cr);
+       jkfprintf(tp, name, offset);
+       (void)fclose(tp);
+       _exit(0);
+}
+
+jkfprintf(tp, name, offset)
+       register FILE *tp;
+       char name[];
+       off_t offset;
+{
+       register char *cp, ch;
+       register FILE *fi;
+       register int linecnt, charcnt, inheader;
+       char line[BUFSIZ];
+
+       if ((fi = fopen(name, "r")) == NULL)
+               return;
+       (void)fseek(fi, offset, L_SET);
+       /*
+        * Print the first 7 lines or 560 characters of the new mail
+        * (whichever comes first).  Skip header crap other than
+        * From, Subject, To, and Date.
+        */
+       linecnt = 7;
+       charcnt = 560;
+       inheader = 1;
+       while (fgets(line, sizeof(line), fi) != NULL) {
+               if (inheader) {
+                       if (line[0] == '\n') {
+                               inheader = 0;
+                               continue;
+                       }
+                       if (line[0] == ' ' || line[0] == '\t' ||
+                           strncmp(line, "From:", 5) &&
+                           strncmp(line, "Subject:", 8))
+                               continue;
+               }
+               if (linecnt <= 0 || charcnt <= 0) {
+                       (void)fprintf(tp, "...more...%s", cr);
+                       return;
+               }
+               /* strip weird stuff so can't trojan horse stupid terminals */
+               for (cp = line; (ch = *cp) && ch != '\n'; ++cp, --charcnt) {
+                       ch = toascii(ch);
+                       if (!isprint(ch) && !isspace(ch))
+                               ch |= 0x40;
+                       (void)fputc(ch, tp);
+               }
+               (void)fputs(cr, tp);
+               --linecnt;
+       }
+       (void)fprintf(tp, "----%s\n", cr);
+}
diff --git a/usr/src/libexec/fingerd/fingerd.8 b/usr/src/libexec/fingerd/fingerd.8
new file mode 100644 (file)
index 0000000..a8e5ec3
--- /dev/null
@@ -0,0 +1,109 @@
+.\" Copyright (c) 1980, 1991 The Regents of the University of California.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\"    must display the following acknowledgement:
+.\"    This product includes software developed by the University of
+.\"    California, Berkeley and its contributors.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\"    may be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\"     @(#)fingerd.8  6.4 (Berkeley) 3/16/91
+.\"
+.Dd March 16, 1991
+.Dt FINGERD 8
+.Os BSD 4.3
+.Sh NAME
+.Nm fingerd
+.Nd remote user information server
+.Sh SYNOPSIS
+.Nm fingerd
+.Sh DESCRIPTION
+.Nm Fingerd
+is a simple protocol based on
+.%T RFC742
+that provides an interface to the
+Name and Finger programs at several 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.
+There is no required format and the
+protocol consists mostly of specifying a single
+.Dq command line .
+.Pp
+.Nm Fingerd
+listens for
+.Tn TCP
+requests at port 79.
+Once connected it reads a single command line
+terminated by a
+.Aq Tn CRLF
+which is passed to
+.Xr finger 1 .
+.Nm Fingerd
+closes its connections as soon as the output is finished.
+.Pp
+If the line is null (i.e. just a
+.Aq Tn CRLF
+is sent) then 
+.Xr finger
+returns a
+.Dq default
+report that lists all people logged into
+the system at that moment.
+.Pp
+If a user name is specified (e.g.
+.Pf eric Aq Tn CRLF )
+then the
+response lists more extended information for only that particular user,
+whether logged in or not.
+Allowable
+.Dq names
+in the command line include both
+.Dq login names
+and
+.Dq user names .
+If a name is ambiguous, all possible derivations are returned.
+.Sh SEE ALSO
+.Xr finger 1
+.Sh BUGS
+Connecting directly to the server from a
+.Tn TIP
+or an equally narrow-minded
+.Tn TELNET Ns \-protocol
+user program can result
+in meaningless attempts at option negotiation being sent to the
+server, which will foul up the command line interpretation.
+.Nm Fingerd
+should be taught to filter out
+.Tn IAC Ns \'s
+and perhaps even respond
+negatively
+.Pq Tn IAC WON'T
+to all option commands received.
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.3 .
diff --git a/usr/src/libexec/fingerd/fingerd.c b/usr/src/libexec/fingerd/fingerd.c
new file mode 100644 (file)
index 0000000..ec81c2b
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 1983 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+char copyright[] =
+"@(#) Copyright (c) 1983 The Regents of the University of California.\n\
+ All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+static char sccsid[] = "@(#)fingerd.c  5.6 (Berkeley) 6/1/90";
+#endif /* not lint */
+
+#include <stdio.h>
+#include "pathnames.h"
+
+main()
+{
+       register FILE *fp;
+       register int ch;
+       register char *lp;
+       int p[2];
+#define        ENTRIES 50
+       char **ap, *av[ENTRIES + 1], line[1024], *strtok();
+
+#ifdef LOGGING                                 /* unused for now */
+#include <netinet/in.h>
+       struct sockaddr_in sin;
+       int sval;
+
+       sval = sizeof(sin);
+       if (getpeername(0, &sin, &sval) < 0)
+               fatal("getpeername");
+#endif
+
+       if (!fgets(line, sizeof(line), stdin))
+               exit(1);
+
+       av[0] = "finger";
+       for (lp = line, ap = &av[1];;) {
+               *ap = strtok(lp, " \t\r\n");
+               if (!*ap)
+                       break;
+               /* RFC742: "/[Ww]" == "-l" */
+               if ((*ap)[0] == '/' && ((*ap)[1] == 'W' || (*ap)[1] == 'w'))
+                       *ap = "-l";
+               if (++ap == av + ENTRIES)
+                       break;
+               lp = NULL;
+       }
+
+       if (pipe(p) < 0)
+               fatal("pipe");
+
+       switch(fork()) {
+       case 0:
+               (void)close(p[0]);
+               if (p[1] != 1) {
+                       (void)dup2(p[1], 1);
+                       (void)close(p[1]);
+               }
+               execv(_PATH_FINGER, av);
+               _exit(1);
+       case -1:
+               fatal("fork");
+       }
+       (void)close(p[1]);
+       if (!(fp = fdopen(p[0], "r")))
+               fatal("fdopen");
+       while ((ch = getc(fp)) != EOF) {
+               if (ch == '\n')
+                       putchar('\r');
+               putchar(ch);
+       }
+       exit(0);
+}
+
+fatal(msg)
+       char *msg;
+{
+       extern int errno;
+       char *strerror();
+
+       fprintf(stderr, "fingerd: %s: %s\r\n", msg, strerror(errno));
+       exit(1);
+}
diff --git a/usr/src/libexec/fingerd/pathnames.h b/usr/src/libexec/fingerd/pathnames.h
new file mode 100644 (file)
index 0000000..306f742
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 1989 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ *     @(#)pathnames.h 5.3 (Berkeley) 6/1/90
+ */
+
+#define        _PATH_FINGER    "/usr/bin/finger"