home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.sysv386:12485 biz.sco.general:2710
- Newsgroups: comp.unix.sysv386,biz.sco.general
- Path: sparky!uunet!kithrup!sef
- From: sef@kithrup.COM (Sean Eric Fagan)
- Subject: diffs to net/2 fingerd for SCO 3.2v2
- Organization: Kithrup Enterprises, Ltd.
- Date: Mon, 27 Jul 1992 11:08:55 GMT
- Message-ID: <1992Jul27.110855.1458@kithrup.COM>
- Sender: sef@kithrup.COM (Sean Eric Fagan)
- Lines: 121
-
- Here are some diffs to make the Net/2 fingerd compile and run under SCOnix,
- with logging via syslog. (That was about the major extent of the changes,
- actually.) Use at your own risk; I have tested somewhat, but not
- extensively. If you find any bugs, please let me know, but don't expect me
- to rush to fix them 8-).
-
- Diffs for the net/2 finger in the next posting.
-
- -- snip snip --
- *** fingerd/Makefile.~1~ Sun Jul 26 13:54:08 1992
- --- fingerd/Makefile Sun Jul 26 14:00:01 1992
- ***************
- *** 4,10 ****
- MAN8= fingerd.0
- OBJS= fingerd.o
- CC= gcc
- ! CFLAGS= -g
-
- fingerd: $(OBJS)
- $(CC) $(CFLAGS) -o fingerd $(OBJS) $(LIBS)
- --- 4,11 ----
- MAN8= fingerd.0
- OBJS= fingerd.o
- CC= gcc
- ! CFLAGS= -g -DLOGGING
- ! LIBS= -lsocket
-
- fingerd: $(OBJS)
- $(CC) $(CFLAGS) -o fingerd $(OBJS) $(LIBS)
- *** fingerd/fingerd.c.~1~ Sun Jul 26 13:10:04 1992
- --- fingerd/fingerd.c Sun Jul 26 19:55:30 1992
- ***************
- *** 43,49 ****
- --- 43,84 ----
-
- #include <stdio.h>
- #include "pathnames.h"
- + #ifdef LOGGING
- + # include <syslog.h>
- + # include <sys/types.h>
- + # include <netinet/in.h>
- + # include <sys/socket.h>
- + # include <netdb.h>
- + #endif /* LOGGING */
-
- + static char *
- + remote_hostname (struct sockaddr_in laddr) {
- + union {
- + unsigned long ul;
- + struct {
- + unsigned char uc[4];
- + } s;
- + } ip_addr;
- + static char ip_name[50];
- + char *name;
- + struct hostent *hp;
- +
- + /* ip_addr.ul = ntohl(laddr.sin_addr.s_addr); */
- + ip_addr.ul = laddr.sin_addr.s_addr;
- + if ((hp = gethostbyaddr ((char *)&laddr.sin_addr,
- + sizeof (laddr.sin_addr),
- + AF_INET)) == 0) {
- + sprintf (ip_name, "[%d.%d.%d.%d]",
- + ip_addr.s.uc[3],
- + ip_addr.s.uc[2],
- + ip_addr.s.uc[1],
- + ip_addr.s.uc[0]);
- + name = ip_name;
- + } else
- + name = hp->h_name;
- + return name;
- + }
- +
- main()
- {
- register FILE *fp;
- ***************
- *** 54,60 ****
- char **ap, *av[ENTRIES + 1], line[1024], *strtok();
-
- #ifdef LOGGING /* unused for now */
- ! #include <netinet/in.h>
- struct sockaddr_in sin;
- int sval;
-
- --- 89,95 ----
- char **ap, *av[ENTRIES + 1], line[1024], *strtok();
-
- #ifdef LOGGING /* unused for now */
- ! char *tline, *cp, *tcp;
- struct sockaddr_in sin;
- int sval;
-
- ***************
- *** 65,70 ****
- --- 100,119 ----
-
- if (!fgets(line, sizeof(line), stdin))
- exit(1);
- +
- + #ifdef LOGGING
- + openlog ("fingerd", LOG_PID, LOG_DAEMON);
- + setlogmask (LOG_UPTO (LOG_DEBUG));
- + tline = alloca (strlen (line) + 1);
- + strcpy (tline, line);
- +
- + for (cp = tline; *cp; cp++) {
- + if (*cp == '\n' || *cp == '\r')
- + *cp = ' ';
- + }
- + syslog (LOG_INFO, "%s: `%s'", remote_hostname(sin), tline);
- + closelog ();
- + #endif /* LOGGING */
-
- av[0] = "finger";
- for (lp = line, ap = &av[1];;) {
- --
- Sean Eric Fagan | "My psychiatrist says I have a messiah
- sef@kithrup.COM | complex. But I forgive him."
- -----------------+ -- Jim Carrey
- Any opinions expressed are my own, and generally unpopular with others.
-