[2833] in Release_Engineering

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

xlogin/login: yet another attempt

daemon@ATHENA.MIT.EDU (Richard Basch)
Mon May 18 11:02:34 1992

Date: Mon, 18 May 92 11:02:05 -0400
To: epeisach@MIT.EDU, rel-eng@MIT.EDU, builder@MIT.EDU
From: "Richard Basch" <basch@MIT.EDU>


I doubt many explanations are required at this point... but an audit is...

-R


*** /tmp/,RCSt1NPgB4o	Mon May 18 11:01:00 1992
--- verify.c	Mon May 18 11:00:46 1992
***************
*** 5,10 ****
--- 5,11 ----
  #include <pwd.h>
  #include <grp.h>
  #include <strings.h>
+ #include <sys/types.h>
  #include <sys/file.h>
  #include <sys/param.h>
  #include <sys/dir.h>
***************
*** 13,22 ****
  #include <utmp.h>
  #include <netdb.h>
  #include <ttyent.h>
- #include <krb.h>
- #include <hesiod.h>
  #include <errno.h>
  #include <syslog.h>
  #ifdef XDM
  #include "dm.h"
  #endif
--- 14,25 ----
  #include <utmp.h>
  #include <netdb.h>
  #include <ttyent.h>
  #include <errno.h>
  #include <syslog.h>
+ 
+ #include <krb.h>
+ #include <hesiod.h>
+ 
  #ifdef XDM
  #include "dm.h"
  #endif
***************
*** 27,32 ****
--- 30,39 ----
  #include <sys/id.h>
  #endif
  
+ #ifdef ultrix
+ #include <sys/mount.h>
+ #endif
+ 
  #define SETPAG
  #ifdef SETPAG
  /* Allow for primary gid and PAG identifier */
***************
*** 537,543 ****
  			"Could not execute dettach command as user %s,\n",
  			pwd->pw_name);
  	    }
! 	    execlp("detach", "detach", "-quiet", pwd->pw_name, NULL);
  	    _exit(-1);
  	default:
  	    while (attach_state == -1)
--- 544,550 ----
  			"Could not execute dettach command as user %s,\n",
  			pwd->pw_name);
  	    }
! 	    execlp("fsid", "fsid", "-unmap", "-filsys", pwd->pw_name, NULL);
  	    _exit(-1);
  	default:
  	    while (attach_state == -1)
***************
*** 879,926 ****
  
  
  /* Function Name: IsRemoteDir
!  * Description: Stolen form athena's version of /bin/login
!  *              returns true of this is an NFS directory.
!  * Arguments: dname - name of the directory.
   * Returns: true or false to the question (is remote dir).
   *
!  * The following lines rely on the behavior of Sun's NFS (present in
!  * 3.0 and 3.2) which causes a read on an NFS directory (actually any
!  * non-reg file) to return -1, and AFS which also returns a -1 on
!  * read (although with a different errno).  This is a fast, cheap
!  * way to discover whether a user's homedir is a remote filesystem.
!  * Naturally, if the NFS and/or AFS semantics change, this must also change.
   */
  
  IsRemoteDir(dir)
  char *dir;
  {
! #if !defined(_AIX)
      int f;
      char c;
      struct stat stbuf;
    
!     if (lstat(dir, &stbuf))
! 	return(FALSE);
!     if (!(stbuf.st_mode & S_IFDIR))
  	return(TRUE);
  
!     if ((f = open(dir, O_RDONLY, 0)) < 0)
! 	return(FALSE);
! 
!     if (read(f, &c, 1) < 0) {
! 	close(f);
  	return(TRUE);
      }
- 
-     close(f);
      return(FALSE);
! #else /* AIX */
!     struct stat stbuf;
  
!     if (statx(dir, &stbuf, 0, STX_NORMAL))
! 	return(FALSE);
!     return((stbuf.st_flag & FS_REMOTE) ? TRUE : FALSE);
  #endif
  }
  
--- 886,954 ----
  
  
  /* Function Name: IsRemoteDir
!  * Arguments: dir - name of the directory.
   * Returns: true or false to the question (is remote dir).
+  *    false may also indicate that no directory exists.
   *
!  * If we cannot stat the directory, we will assume the directory is
!  * remote.  Getting information about a directory may not be possible
!  * if the pre-requisite authentication has not yet been performed.
!  *
!  * Under AIX, we use stat and check the FS_REMOTE flag.
!  * Under Ultrix, we use statfs to determine the filesystem type.
!  * Under BSD, we check the device [0,1=AFS; 255,0=NFS].
!  *
!  * NOTE: This routine must be CHANGED whenever a new architecture
!  * is introduced or if any filesystem semantics change.
   */
  
  IsRemoteDir(dir)
  char *dir;
  {
! #ifdef _AIX
! #define REMOTEDONE
!     struct stat stbuf;
! 
!     if (statx(dir, &stbuf, 0, STX_NORMAL))
! 	return(TRUE);
!     return((stbuf.st_flag & FS_REMOTE) ? TRUE : FALSE);
! #endif
! 
! #ifdef ultrix
! #define REMOTEDONE
!     struct fs_data sbuf;
! 
!     if (statfs(dir, &sbuf) < 0)
! 	return(TRUE);
! 
!     switch(sbuf.fd_req.fstype) {
!     case GT_ULTRIX:
!     case GT_CDFS:
! 	return(FALSE);
!     }
!     return(TRUE);
! #endif
!     
! #if (defined(vax) || defined(ibm032)) && !defined(REMOTEDONE)
! #define REMOTEDONE
      int f;
      char c;
      struct stat stbuf;
    
!     if (stat(dir, &stbuf))
  	return(TRUE);
  
!     switch(stbuf.st_rdev) {
!     case 0x0001:				/* AFS */
!     case 0xff00:				/* NFS */
  	return(TRUE);
+ 	break;
      }
      return(FALSE);
! #endif
  
! #ifndef REMOTEDONE
!     ERROR --- ROUTINE NOT IMPLEMENTED ON THIS PLATFORM;
  #endif
  }
  

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