logdaemon 5.6 rlogind/rshd/telnetd NEWS-OS 4 support patch
==========================================================

* ABSOLUTELY NO WARRANTY
* tested: NEWS-OS 4.2.1a+R (news3800) with cc
* NEWS-OS 4's inetd is logging exit status of daemons (via syslogd). 
  This is an example:

    Feb 10 16:20:21 mimas inetd[173]: /etc/telnetd: exit status 1

  Normally, many daemons (rlogind, telnetd, ftpd, ...) exit with status 
  1, and inetd log it.  I don't like this feature.

  If you apply this patch and define NORMAL_EXIT_IS_0, normal exit 
  status of rlogind/telnetd changed to 0.  This effect only define 
  both NEWSOS4 and NORMAL_EXIT_IS_0.

Have fun!

- KOJIMA Hajime <kjm@rins.ryukoku.ac.jp>

Only in logdaemon-5.6/lib: fixenv.o
Only in logdaemon-5.6/lib: libutil.a
Only in logdaemon-5.6/lib: login.o
Only in logdaemon-5.6/lib: logout.o
Only in logdaemon-5.6/lib: logwtmp.o
Only in logdaemon-5.6/lib: open_limit.o
Only in logdaemon-5.6/lib: rcmd.o
Only in logdaemon-5.6/lib: utmp_host.o
diff -ur ../logdaemon-5.6/rlogind/Makefile logdaemon-5.6/rlogind/Makefile
--- ../logdaemon-5.6/rlogind/Makefile	Fri Apr  5 18:56:08 1996
+++ logdaemon-5.6/rlogind/Makefile	Mon Feb 10 17:06:06 1997
@@ -30,7 +30,7 @@
 	@$(MAKE) all SYS=$@ XFLAGS=-DHPUX9
 
 newsos4:
-	@echo newsos4 has not been tested.
+	@$(MAKE) all SYS=$@ XFLAGS=-DNEWSOS4
 
 decosf1:
 	@echo decosf1 has not been tested
Only in logdaemon-5.6/rlogind: rlogind
diff -ur ../logdaemon-5.6/rlogind/rlogind.c logdaemon-5.6/rlogind/rlogind.c
--- ../logdaemon-5.6/rlogind/rlogind.c	Thu Oct 31 23:59:33 1996
+++ logdaemon-5.6/rlogind/rlogind.c	Mon Feb 10 17:33:22 1997
@@ -114,7 +114,7 @@
 #define LOG_AUTH        0
 #endif
 
-#ifdef ultrix
+#if defined(ultrix) || defined(NEWSOS4)
 #define setsid()	setpgrp(0,0)
 #endif
 
@@ -134,6 +134,10 @@
 int	pty;
 #endif /* CLOSE_PTY_MASTER */
 
+#ifndef O_NOCTTY
+#define O_NOCTTY	0
+#endif
+
 main(argc, argv)
 	int argc;
 	char **argv;
@@ -609,7 +613,11 @@
 	close(pty);
 #endif /* CLOSE_PTY_MASTER */
 	shutdown(netf, 2);
+#if defined(NEWSOS4) && defined(NORMAL_EXIT_IS_0)
+	exit(0);
+#else
 	exit(1);
+#endif
 }
 
 fatal(f, msg)
Only in logdaemon-5.6/rlogind: rlogind.o
diff -ur ../logdaemon-5.6/rshd/Makefile logdaemon-5.6/rshd/Makefile
--- ../logdaemon-5.6/rshd/Makefile	Wed Jan 24 04:11:51 1996
+++ logdaemon-5.6/rshd/Makefile	Mon Feb 10 17:05:32 1997
@@ -26,7 +26,7 @@
 	@$(MAKE) all SYS=$@ XFLAGS=-DHPUX9
 
 newsos4:
-	@echo newsos4 has not been tested.
+	@$(MAKE) all SYS=bsd44 XFLAGS=-DNEWSOS4
 
 decosf1:
 	@$(MAKE) all SYS=$@ XFLAGS=-DDECOSF1
Only in logdaemon-5.6/rshd: rshd
diff -ur ../logdaemon-5.6/rshd/rshd.c logdaemon-5.6/rshd/rshd.c
--- ../logdaemon-5.6/rshd/rshd.c	Fri Mar 22 19:37:53 1996
+++ logdaemon-5.6/rshd/rshd.c	Mon Feb 10 17:07:15 1997
@@ -75,7 +75,7 @@
 #define LOG_ODELAY	0
 #endif
 
-#ifdef ultrix
+#if defined(ultrix) || defined(NEWSOS4)
 #define setsid()	setpgrp(0,0)
 #endif
 
diff -ur ../logdaemon-5.6/telnetd/Makefile logdaemon-5.6/telnetd/Makefile
--- ../logdaemon-5.6/telnetd/Makefile	Fri Apr  5 18:54:16 1996
+++ logdaemon-5.6/telnetd/Makefile	Mon Feb 10 17:05:49 1997
@@ -24,6 +24,9 @@
 bsd44 freebsd bsdi:
 	@$(MAKE) all SYS=bsd44 XFLAGS=-DBSD44
 
+newsos4:
+	@$(MAKE) all SYS=$@ XFLAGS=-DNEWSOS4
+
 decosf1:
 	@echo decosf1 has not been tested
 
Only in logdaemon-5.6/telnetd: telnetd
diff -ur ../logdaemon-5.6/telnetd/telnetd.c logdaemon-5.6/telnetd/telnetd.c
--- ../logdaemon-5.6/telnetd/telnetd.c	Sun Apr 14 19:55:26 1996
+++ logdaemon-5.6/telnetd/telnetd.c	Mon Feb 10 17:33:38 1997
@@ -93,7 +93,7 @@
 #define LOG_ODELAY	0
 #endif
 
-#ifdef ultrix
+#if defined(ultrix) || defined(NEWSOS4)
 #define setsid()	setpgrp(0,0)
 #endif
 
@@ -154,6 +154,10 @@
 #define BANNER	"\r\n\r\Digital UNIX (%s)\r\n\r\r\n\r"
 #endif
 
+#ifdef NEWSOS4
+#define	BANNER	"\r\n\r\n%s (%s)\r\n\r\r\n\r"
+#endif
+
 #ifndef BANNER
 #define	BANNER	"\r\n\r\n4.3 BSD UNIX (%s)\r\n\r\r\n\r"
 #endif
@@ -200,6 +204,10 @@
 
 #define	settimer(x)	(clocks.x = ++clocks.system)
 #define	sequenceIs(x,y)	(clocks.x < clocks.y)
+
+#ifndef O_NOCTTY
+#define O_NOCTTY       0
+#endif
 
 main(argc, argv)
 	char *argv[];
@@ -585,7 +593,30 @@
 			putf(IM, ptyibuf+1);
 	} else {
 #endif
+#ifdef NEWSOS4
+	{
+		char osversion[BUFSIZ];
+		FILE *version_file;
+		char *nl;
+
+		if ((version_file = fopen("/etc/osversion", "r")) != NULL) {
+
+		    fgets(osversion, BUFSIZ, version_file);
+		    fclose(version_file);
+
+		    if ((nl = index(osversion, '\n')) != NULL) {
+			*nl = '\0';
+		    }
+
+		    sprintf(ptyibuf+1, BANNER, osversion, hostname);
+		} else {
+		    sprintf(ptyibuf+1, BANNER, "NEWS-OS Release 4.x", hostname);
+		}
+	}
+	;
+#else
 		sprintf(ptyibuf+1, BANNER, hostname);
+#endif
 #if 0
 	}
 #endif
@@ -1492,7 +1523,11 @@
 	close(pty);
 #endif /* CLOSE_PTY_MASTER */
 	shutdown(net, 2);
+#if defined(NEWSOS4) && defined(NORMAL_EXIT_IS_0)
+	exit(0);
+#else
 	exit(1);
+#endif
 }
 
 char	editedhost[32];
Only in logdaemon-5.6/telnetd: telnetd.o
