[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

diffs for MiNTOS 1.4.1



When installing MiNTOS 1.4.1 I discovered some Bugs:

- login does not log syslog-messages because it closes all file
handles - also the syslog-filehandle
- login does not clear the rootlogin-variable - so if you once try to
log in as root and the login is refused you cannot login at all
- strcasecmp was broken.

I also added some new features:
- Mupfel (the shell from Gemini) does not understand '/' as
path-separator. So if the login-shell is Mupfel _unx2dos is called for
$HOME and $SHELL in login and su.
- I changed syslog to accept also internet-connections - so you can
use the loghost-feature. Just define SYSLOG_INET and MINTNET for
syslogd. You cannot use the `ifdef (LOGHOST)...' lines in
/etc/syslog.conf - just replace them with @loghost for non-loghosts and
with whatever you want for the loghost (exept @loghost of course)

Have fun, Bjarne


------------cut here--------------------
diff -r -u +ignore-all-space ..\old\mintos-1.4.1/lib/strcasecmp.c ./lib/strcasecmp.c
--- ..\old\mintos-1.4.1/lib/strcasecmp.c	Tue Aug  2 21:35:42 1994
+++ ./lib/strcasecmp.c	Fri May 20 18:43:18 1994
@@ -1,18 +1,17 @@
-/* from Henry Spencer's stringlib */
+/* derived from strcmp from Henry Spencer's stringlib */
 /* modified by ERS */
+/* i-changes by Alexander Lehmann */
+/* case-changes by Kay Roemer */
 
 #include <string.h>
 #include <ctype.h>
-#ifdef __LATTICE__
-#undef strcmp
-#endif
 
 /*
- * strcmp - compare string s1 to s2
+ * strcasecmp - compare string s1 to s2 without case sensitivity
+ *              result is equivalent to strcmp(strlwr(s1),strlwr(s2)),
+ *              but doesn't change anything
  */
 
-extern void *malloc();
-
 int				/* <0 for <, 0 for ==, >0 for > */
 strcasecmp(scan1, scan2)
 register const char *scan1;
@@ -19,35 +18,14 @@
 register const char *scan2;
 {
 	register char c1, c2;
-	register char *ptr1, *ptr2, *ptr3;
 
 	if (!scan1)
 		return scan2 ? -1 : 0;
 	if (!scan2) return 1;
 
-	if ((ptr1 = malloc(strlen(scan1))) == NULL)
-		return -1;
-	else
-	{
-		for (ptr3 = ptr1; *ptr3 != NULL; ptr3++)
-			if (islower(*ptr3))
-				*ptr3 = toupper(*ptr3);
-	}
-
-	if ((ptr2 = malloc(strlen(scan2))) == NULL)
-	{
-		free(ptr1);
-		return -1;
-	}
-	else
-	{
-		for (ptr3 = ptr2; *ptr3 != NULL; ptr3++)
-			if (islower(*ptr3))
-				*ptr3 = toupper(*ptr3);
-	}
-
 	do {
-		c1 = *ptr1++; c2 = *ptr2++;
+                c1 = *scan1++; c1=tolower(c1);
+                c2 = *scan2++; c2=tolower(c2);
 	} while (c1 && c1 == c2);
 
 	/*
diff -r -u +ignore-all-space ..\old\mintos-1.4.1/usrbin/login/login.c ./usrbin/login/login.c
--- ..\old\mintos-1.4.1/usrbin/login/login.c	Tue Aug  2 22:03:38 1994
+++ ./usrbin/login/login.c	Mon Nov  7 20:00:00 1994
@@ -122,6 +122,7 @@
 	time_t time();
 	off_t lseek();
 	void timedout();
+	int convertslash=0;
 
 	(void)signal(SIGALRM, timedout);
 	(void)alarm((u_int)timeout);
@@ -183,9 +184,13 @@
 	} else
 		ask = 1;
 
+	closelog();
+
 	for (cnt = getdtablesize(); cnt > 2; cnt--)
 		close(cnt);
 
+	openlog("login", LOG_ODELAY, LOG_AUTH);
+
 	ttyn = ttyname(0);
 	if (ttyn == NULL || *ttyn == '\0') {
 		(void)sprintf(tname, "%s??", _PATH_TTY);
@@ -200,6 +205,7 @@
 		if (ask) {
 			fflag = 0;
 			getloginname();
+			rootlogin=0;
 		}
 #ifdef	KERBEROS
 		if ((instance = index(username, '.')) != NULL) {
@@ -410,8 +416,23 @@
 			strcpy(term, ptr);
 	}
 #endif
+        if (strstr(pwd->pw_shell,"mupfel") ) convertslash=1;
+        {
+                char tmpstring[80];
+                if (convertslash)
+                {
+                        _unx2dos(pwd->pw_dir,tmpstring);
+                        (void)setenv("HOME", tmpstring, 1);
+                        _unx2dos(pwd->pw_shell,tmpstring);
+                        (void)setenv("SHELL", tmpstring, 1);
+                }
+                else
+                {
 	(void)setenv("HOME", pwd->pw_dir, 1);
 	(void)setenv("SHELL", pwd->pw_shell, 1);
+                }
+        }
+
 	if (term[0] == '\0')
 		strncpy(term, stypeof(tty), sizeof(term));
 	(void)setenv("TERM", term, 0);
@@ -467,6 +488,7 @@
 		(void) setuid(0);
 	else
 		(void) setuid(pwd->pw_uid);
+	closelog();
 #ifndef MINT
 	execlp(pwd->pw_shell, tbuf, 0);
 #else
@@ -532,7 +554,7 @@
 	register int fd, nchars;
 	sig_t oldint;
 	void sigint();
-	char tbuf[8192];
+	char tbuf[1024];
 
 	if ((fd = open(_PATH_MOTDFILE, O_RDONLY, 0)) < 0)
 		return;
diff -r -u +ignore-all-space ..\old\mintos-1.4.1/usrbin/su/su.c ./usrbin/su/su.c
--- ..\old\mintos-1.4.1/usrbin/su/su.c	Sat Jul  9 22:47:48 1994
+++ ./usrbin/su/su.c	Fri Nov 11 18:57:32 1994
@@ -257,9 +257,24 @@
 			(void)setenv("USER", pwd->pw_name, 1);
 		p = getenv("TERM");
 		(void)setenv("TERM", p, 1);
+		{
+			int convertslash=0;
+	                char tmpstring[80];
+		        if (strstr(shell,"mupfel") ) convertslash=1;
+	                if (convertslash)
+        	        {
+                	        _unx2dos(pwd->pw_dir,tmpstring);
+                        	(void)setenv("HOME", tmpstring, 1);
+	                        _unx2dos(shell,tmpstring);
+        	                (void)setenv("SHELL", tmpstring, 1);
+                	}
+	                else
+        	        {
 		(void)setenv("HOME", pwd->pw_dir, 1);
 		(void)setenv("SHELL", shell, 1);
 	}
+		}
+	}
 #ifndef BSD44
 	else
 	{
@@ -278,6 +293,8 @@
 		}
 	}
 #endif
+	endpwent();
+	endgrent();
 
 	if (iscsh == YES) {
 		if (fastlogin)
diff -r -u +ignore-all-space ..\old\mintos-1.4.1/usretc/syslog/Makefile ./usretc/syslog/Makefile
--- ..\old\mintos-1.4.1/usretc/syslog/Makefile	Wed Aug  3 15:38:00 1994
+++ ./usretc/syslog/Makefile	Tue Nov  8 17:39:54 1994
@@ -29,8 +29,8 @@
 #SYSLOGD_FLAGS = -DSYSLOG_KERNEL -DSYSLOG_UNIXAF
 #SYSLOG_FLAGS = -DSYSLOG_UNIXAF
 
-#SYSLOGD_FLAGS = -DSYSLOG_INET
-#SYSLOG_FLAGS = -DSYSLOG_INET
+SYSLOGD_FLAGS = -DSYSLOG_INET -DMINTNET
+SYSLOG_FLAGS = #-DSYSLOG_INET -DMINTNET
 
 CFLAGS= $(ADDITIONALCFLAGS) -DMINT -I$(BUILDDIR)/include -I.
 
@@ -41,7 +41,7 @@
 		syslog.o readlog.o 
 MAN	=	syslogd.0
 #LDFLAGS = -lsocket
-LDFLAGS = $(BUILDDIR)/lib/libusers.a
+LDFLAGS = $(BUILDDIR)/lib/libusers.a -lsocket
 #TARGETS =	syslogd syslog_test sendlog logger readlog libsyslog.a
 # logger won't build with the current mintlibs,
 #	readlog won't ever!
@@ -70,6 +70,9 @@
 syslogd: $(SYSLOGD_OBJS)
 	${CC} -o $@ ${CFLAGS} $(SYSLOGD_OBJS) ${LDFLAGS}
 	$(FASTRAMPRG) $@
+
+syslogd.sym: $(SYSLOGD_OBJS)
+	gcc -gl -mint -o $@ ${CFLAGS} $(SYSLOGD_OBJS) ${LDFLAGS}
 
 syslog_test: syslog_test.o syslog.o ${LIBS}
 	${CC} ${CFLAGS} -o syslog_test syslog_test.o syslog.o ${LDFLAGS}
diff -r -u +ignore-all-space ..\old\mintos-1.4.1/usretc/syslog/syslog.c ./usretc/syslog/syslog.c
--- ..\old\mintos-1.4.1/usretc/syslog/syslog.c	Sun May  1 23:49:44 1994
+++ ./usretc/syslog/syslog.c	Mon Nov  7 20:17:08 1994
@@ -39,6 +39,9 @@
  */
 
 #include <sys/types.h>
+#ifdef MINT
+#include <errno.h>
+#endif
 #if !defined(MINT) || defined(MINTNET)
 #include <sys/socket.h>
 #ifdef SYSLOG_INET
@@ -172,7 +175,15 @@
 #if !defined(MINT) || defined(MINTNET)
 	if (send(LogFile, outline, c, 0) >= 0)
 #else
-	if (write(LogFile, outline, c) >= 0)
+	if (write(LogFile, outline, c) < 0)
+	{
+		if (errno == EBADF)
+		{
+			LogFile = open(logname, O_RDWR);
+			if (LogFile >=0 && (write(LogFile, outline, c) >= 0) )
+				return;
+		}
+	} else
 #endif
 		return;
 	if (!(LogStat & LOG_CONS))
diff -r -u +ignore-all-space ..\old\mintos-1.4.1/usretc/syslog/syslog.h ./usretc/syslog/syslog.h
--- ..\old\mintos-1.4.1/usretc/syslog/syslog.h	Sun Sep 12 14:05:34 1993
+++ ./usretc/syslog/syslog.h	Mon Nov  7 18:19:00 1994
@@ -93,7 +93,7 @@
 /*
  * Where to log...
  */
-#define LOG_HOST 	"avalon"	/* name of host to log on */
+#define LOG_HOST 	"localhost"	/* name of host to log on */
 
 #ifdef atarist
 #define MAXLINE 960
diff -r -u +ignore-all-space ..\old\mintos-1.4.1/usretc/syslog/syslogd.c ./usretc/syslog/syslogd.c
--- ..\old\mintos-1.4.1/usretc/syslog/syslogd.c	Mon May  2 00:18:16 1994
+++ ./usretc/syslog/syslogd.c	Tue Nov  8 17:26:10 1994
@@ -114,7 +114,7 @@
 
 #if !defined(MINT) || defined(MINTNET)
 #include <netinet/in.h>
-#ifndef MINTNET
+#ifdef MINTNET
 #include <netdb.h>
 #endif
 #else
@@ -307,8 +307,8 @@
 {
 	register int i;
 	register char *p;
-	int funix = 0, unixm = 0, inetm = 0, fklog, klogm = 0, len;
-	int	fd, mask;
+	int funix = -1, unixm = 0, inetm = 0, fklog, klogm = 0, len;
+	int	fd, mask, funixm = 0;
 #ifdef SYSLOG_UNIXAF
 	struct sockaddr_un sunx, fromunix;
 #endif
@@ -318,7 +318,7 @@
 	FILE *fp;
 	int ch;
 	/* char line[MSG_BSIZE + 1]; */
-	char line[MAXLINE +1];
+	static char line[MAXLINE +1];
 	extern int optind, die(), domark(), reapchild();
 	extern char *optarg;
 
@@ -390,8 +390,8 @@
 	(void) alarm(TIMERINTVL);
 	(void) unlink(LogName);
 
-#ifndef SYSLOG_INET
-#if !defined(MINT) || defined(MINTNET)
+#if defined(SYSLOG_UNIXAF) || defined(MINT)
+#if !defined(MINT) || ( defined(MINTNET) && defined(SYSLOG_UNIXAF) )
 	sunx.sun_family = AF_UNIX;
 	(void) strncpy(sunx.sun_path, LogName, sizeof sunx.sun_path);
 	funix = socket(AF_UNIX, SOCK_DGRAM, 0);
@@ -411,9 +411,10 @@
 		die(0);
 #endif
 	}
+	if (funix >=0 ) funixm=FDMASK(funix);
 #endif /* SYSLOG_INET */
 
-#if defined(MINT) && !defined(MINTNET)
+#if defined(MINT) && ( !defined(MINTNET) || !defined(SYSLOG_UNIXAF) )
 	ioctl(funix, FIONREAD, &len);
 
 	if (len > 0)
@@ -439,7 +440,9 @@
 		}
 		sin.sin_family = AF_INET;
 		sin.sin_port = LogPort = sp->s_port;
+		sin.sin_addr.s_addr=INADDR_ANY;
 		if (bind(finet, &sin, sizeof(sin)) < 0) {
+			dprintf ("finet = %d, errno = %d\n",finet,errno);
 			logerror("bind");
 			if (!Debug)
 				die(0);
@@ -499,7 +502,7 @@
 #endif
 
 	for (;;) {
-		int nfds, readfds = FDMASK(funix) | unixm | inetm | klogm;
+		int nfds, readfds = funixm | unixm | inetm | klogm;
 
 		errno = 0;
 		dprintf("readfds = %#x\n", readfds);
@@ -531,7 +534,7 @@
 
 #ifdef SYSLOG_UNIXAF
 		/* Accept a new unix connection */
-		if (readfds & FDMASK(funix)) {
+		if (readfds & funixm ) {
 			len = sizeof fromunix;
 			if ((fd = accept(funix, &fromunix, &len)) > 0) {
 				unixm |= FDMASK(fd);
@@ -580,8 +583,8 @@
 		} 
 #endif
 
-#if defined(MINT) && !defined(MINTNET)
-		if (FDMASK(funix) & readfds) {
+#if defined(MINT) && ( !defined(MINTNET) || !defined(SYSLOG_UNIXAF) )
+		if (funixm & readfds) {
 			int len;
 
 			ioctl(funix, FIONREAD, &len);
@@ -903,14 +906,15 @@
 	case F_FORW:
 #if !defined(MINT) || defined(MINTNET)
 		dprintf(" %s\n", f->f_un.f_forw.f_hname);
-/*		(void) sprintf(line, "<%d>%.15s %s", f->f_prevpri,	ASP*/
-		(void) sprintf(line, "<%d> %s", LOG_PRI(f->f_prevpri),
-/*			iov[0].iov_base, iov[4].iov_base);	ASP*/
-			iov[4].iov_base);
+		(void) sprintf(line, "<%d>%.15s %s", f->f_prevpri,	/*ASP*/
+/*		(void) sprintf(line, "<%d> %s", LOG_PRI(f->f_prevpri), */
+			iov[0].iov_base, iov[4].iov_base);	/*ASP*/
+/*			iov[4].iov_base);*/
 		strcat(line, "\n");	/* ASP */
 		l = strlen(line);
 		if (l > MAXLINE)
 			l = MAXLINE;
+		dprintf(" send line: %s",line);
 		if (sendto(finet, line, l, 0, &f->f_un.f_forw.f_addr,
 		    sizeof f->f_un.f_forw.f_addr) != l) {
 			int e = errno;
diff -r -u +ignore-all-space ..\old\mintos-1.4.1/usrucb/finger/Makefile ./usrucb/finger/Makefile
--- ..\old\mintos-1.4.1/usrucb/finger/Makefile	Wed Aug  3 15:32:54 1994
+++ ./usrucb/finger/Makefile	Tue Nov  1 20:55:48 1994
@@ -1,7 +1,7 @@
 include ../../.builddir
 include ../../MakeVars
 
-CFLAGS = $(ADDITIONALCFLAGS) -DREMOTE
+CFLAGS = $(ADDITIONALCFLAGS) -DREMOTE -I../../include
 
 finger: finger.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -o finger finger.c