[1116] in Kerberos-V5-bugs

home help back first fref pref prev next nref lref last post

Changes to appl/bsd for dec OSF 1 V2.1

daemon@ATHENA.MIT.EDU (epeisach@MIT.EDU)
Mon Mar 6 11:51:14 1995

From: epeisach@MIT.EDU
Date: Mon, 6 Mar 1995 11:51:00 -0500
To: krb5-bugs@MIT.EDU


configure.in:
	Need to check for setlogin and openpty
	Could reduce all AC_FUNC_CHECK (obsolete) to one AC_CHECK_FUNCS

krlogind.c:
	Use openpty if present... (Otherwise would get streams interface
if use /dev/ptmx).  The danger here is that there is a streams interface
in the OS which might not be configured.. 

krsh.c:
	include ext-proto.h for stdlib.h (malloc) and string.h. Probably
other files need this as well.

login.c:
	stdio.h needs to be before grp.h (prototypes in grp.h need FILE *)
	Call setlogin if present...
		(I wrote a simple program which showed that getlogin
		returned my username, but a kerberized rlogin did not)

logutil.c:
	update_wtmp is broken to use setutent route. The pututline
searches the file for the matching line and will modify it... For wtmp
functions, you want to append to the file - not search it. 
	Also, fix a bug in the append method... (was writing garbage).


	Ezra




===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/configure.in,v
retrieving revision 5.44
diff -c -r5.44 configure.in
*** 5.44	1995/03/01 21:44:57
--- configure.in	1995/03/06 15:05:42
***************
*** 32,39 ****
  AC_FUNC_CHECK(waitpid,AC_DEFINE(HAVE_WAITPID))
  AC_FUNC_CHECK(setsid,AC_DEFINE(HAVE_SETSID))
  AC_FUNC_CHECK(line_push,AC_DEFINE(HAVE_LINE_PUSH))
! AC_FUNC_CHECK(ptsname,AC_DEFINE(HAVE_PTSNAME))
! AC_FUNC_CHECK(grantpt,AC_DEFINE(HAVE_GRANTPT))
  AC_HAVE_HEADERS(sys/filio.h sys/sockio.h unistd.h stdlib.h sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h)
  AC_REPLACE_FUNCS(getdtablesize)
  CHECK_SIGNALS
--- 32,38 ----
  AC_FUNC_CHECK(waitpid,AC_DEFINE(HAVE_WAITPID))
  AC_FUNC_CHECK(setsid,AC_DEFINE(HAVE_SETSID))
  AC_FUNC_CHECK(line_push,AC_DEFINE(HAVE_LINE_PUSH))
! AC_CHECK_FUNCS(ptsname grantpt openpty setlogin)
  AC_HAVE_HEADERS(sys/filio.h sys/sockio.h unistd.h stdlib.h sys/label.h sys/tty.h ttyent.h lastlog.h sys/select.h sys/ptyvar.h)
  AC_REPLACE_FUNCS(getdtablesize)
  CHECK_SIGNALS
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/krlogind.c,v
retrieving revision 5.46
diff -c -r5.46 krlogind.c
*** 5.46	1995/02/28 09:43:23
--- krlogind.c	1995/03/06 16:30:21
***************
*** 427,433 ****
  	     exit(2);
  	 }
  	 
! 	 if ((fd = accept(s, &from, &fromlen)) < 0) {
  	     fprintf(stderr, "Error in accept: %s\n", strerror(errno));
  	     exit(2);
  	 }
--- 427,433 ----
  	     exit(2);
  	 }
  	 
! 	 if ((fd = accept(s, (struct sockaddr *) &from, &fromlen)) < 0) {
  	     fprintf(stderr, "Error in accept: %s\n", strerror(errno));
  	     exit(2);
  	 }
***************
*** 1371,1376 ****
--- 1371,1384 ----
      int i,ptynum;
      struct stat stb;
  
+ #ifdef HAVE_OPENPTY
+     int slavefd;
+ 
+     if(openpty(fd, &slavefd, slave, (struct termios *) 0, 
+ 	       (struct winsize *) 0)) return 1;
+     return 0;
+ #else
+ 
      *fd = open("/dev/ptmx", O_RDWR|O_NDELAY);	/* Solaris, IRIX */
      if (*fd < 0) *fd = open("/dev/ptc", O_RDWR|O_NDELAY); /* AIX */
      if (*fd < 0) *fd = open("/dev/pty", O_RDWR|O_NDELAY); /* sysvimp */
***************
*** 1419,1424 ****
--- 1427,1433 ----
  	}
  	return 1;
      }
+ #endif /* HAVE_OPENPTY */
  }
  
  
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/krsh.c,v
retrieving revision 5.20
diff -c -r5.20 krsh.c
*** 5.20	1995/02/28 09:43:26
--- krsh.c	1995/03/05 18:14:10
***************
*** 58,63 ****
--- 58,64 ----
  #include "krb5.h"
  #include "com_err.h"
  #include "defines.h"
+ #include "ext-proto.h"
  #endif /* KERBEROS */
       
  /*
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/login.c,v
retrieving revision 5.24
diff -c -r5.24 login.c
*** 5.24	1994/12/30 23:40:15
--- login.c	1995/03/06 16:30:34
***************
*** 82,91 ****
  #include <ttyent.h>
  #endif
  #include <syslog.h>
  #include <grp.h>
  #include <pwd.h>
  #include <setjmp.h>
- #include <stdio.h>
  #include <string.h>
  
  #ifdef HAVE_SHADOW
--- 82,91 ----
  #include <ttyent.h>
  #endif
  #include <syslog.h>
+ #include <stdio.h>
  #include <grp.h>
  #include <pwd.h>
  #include <setjmp.h>
  #include <string.h>
  
  #ifdef HAVE_SHADOW
***************
*** 814,819 ****
--- 814,825 ----
  #ifdef OQUOTA
  	quota(Q_DOWARN, pwd->pw_uid, (dev_t)-1, 0);
  #endif
+ 
+ #ifdef HAVE_SETLOGIN
+ 	if (setlogin(pwd->pw_name) < 0)
+ 		syslog(LOG_ERR, "setlogin() failure %d",errno);
+ #endif
+ 
  #ifdef __SCO__
  	/* this is necessary when C2 mode is enabled, but not otherwise */
  	setluid((uid_t) pwd->pw_uid);
===================================================================
RCS file: /mit/krb5/.cvsroot/src/appl/bsd/logutil.c,v
retrieving revision 5.16
diff -c -r5.16 logutil.c
*** 5.16	1995/01/11 07:16:51
--- logutil.c	1995/03/06 16:28:12
***************
*** 140,150 ****
  void update_wtmp(ent)
      struct utmp *ent;
  {
- #ifndef HAVE_SETUTENT
-     struct utmp ut;
      struct stat statb;
      int fd;
- #endif /* !HAVE_SETUTENT */
  #ifdef HAVE_SETUTXENT
      struct utmpx utx;
  
--- 140,147 ----
***************
*** 155,176 ****
  #ifdef HAVE_UPDWTMP
      updwtmp(WTMP_FILE, ent);
  #else /* HAVE_UPDWTMP */
- #ifdef HAVE_SETUTENT
-     utmpname(WTMP_FILE);
-     setutent();
-     pututline(ent);
-     endutent();
- #else /* HAVE_SETUTENT */
  
      if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) >= 0) {
  	if (!fstat(fd, &statb)) {
! 	    if (write(fd, (char *)&ut, sizeof(struct utmp)) !=
  		sizeof(struct utmp))
  	      (void)ftruncate(fd, statb.st_size);
  	}
  	(void)close(fd);
      }
- #endif /* HAVE_SETUTENT */
  #endif /* HAVE_UPDWTMP */
  }
  
--- 152,166 ----
  #ifdef HAVE_UPDWTMP
      updwtmp(WTMP_FILE, ent);
  #else /* HAVE_UPDWTMP */
  
      if ((fd = open(WTMP_FILE, O_WRONLY|O_APPEND, 0)) >= 0) {
  	if (!fstat(fd, &statb)) {
! 	    if (write(fd, (char *)ent, sizeof(struct utmp)) !=
  		sizeof(struct utmp))
  	      (void)ftruncate(fd, statb.st_size);
  	}
  	(void)close(fd);
      }
  #endif /* HAVE_UPDWTMP */
  }
  

home help back first fref pref prev next nref lref last post