[2837] in Release_Engineering
login/xlogin
daemon@ATHENA.MIT.EDU (Richard Basch)
Mon May 18 14:38:33 1992
Date: Mon, 18 May 92 14:37:31 -0400
To: release@MIT.EDU, rel-eng@MIT.EDU
From: "Richard Basch" <basch@MIT.EDU>
John Carr pointed out a problem with my BSD test...
New patch...
athena/bin/login/login.c
athena/athena.etc/xdm/xlogin/verify.c
The patches for Xsession and tsm/athena.c are still the same as before
and have been excluded... (see previous message)
-R
*** /tmp/,RCSt1UtwAkZ Mon May 18 14:35:48 1992
--- login.c Mon May 18 14:35:32 1992
***************
*** 1392,1398 ****
setuid(pwd->pw_uid);
freopen("/dev/null","w",stdout);
freopen("/dev/null","w",stderr);
! execl("/bin/athena/detach","detach",lusername,0);
exit (-1);
}
while (wait(&status) != pid)
--- 1392,1399 ----
setuid(pwd->pw_uid);
freopen("/dev/null","w",stdout);
freopen("/dev/null","w",stderr);
! execl("/bin/athena/fsid", "fsid", "-quiet", "-unmap",
! "-filsys", lusername, 0);
exit (-1);
}
while (wait(&status) != pid)
***************
*** 1424,1460 ****
#endif notdef
}
! isremotedir(dname)
! char *dname;
{
! int fh, c;
! /*
! * 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 with errno set to EISDIR.
! *
! * This is a fast, cheap way to discover whether a user's
! * homedir is a remote NFS filesystem. Naturally, if the NFS semantics
! * change, this must also change.
! *
! * We return 1 if it is any remote filesystem so that the
! * attach_homedir command will run again (sending an "nfsid map"
! * command and cleaning up attachtab, if it happens to be out of sync.)
! *
! * Might want to handle RVD filesystems at some point...
! */
! fh = open(dname, O_RDONLY);
! if (fh < 0)
! return(0);
! if (read(fh, &c, 1) < 0 && errno == EISDIR) {
! close(fh);
! return(1);
! }
! close(fh);
! return(0);
}
goodhomedir()
--- 1425,1468 ----
#endif notdef
}
! isremotedir(dir)
! char *dir;
{
! #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);
!
! if ((unsigned short)stbuf.st_dev >= 0xff00)
! return(TRUE);
! if (stbuf.st_dev == 0x0001) /* AFS */
! return(TRUE);
!
! return(FALSE);
! #endif
!
! #ifndef REMOTEDONE
! ERROR --- ROUTINE NOT IMPLEMENTED ON THIS PLATFORM;
! #endif
}
goodhomedir()
*** /tmp/,RCSt1UtwHXr Mon May 18 14:35:49 1992
--- verify.c Mon May 18 14:35:09 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 */
***************
*** 534,543 ****
case 0:
if (setuid(pwd->pw_uid) != 0) {
fprintf(stderr,
! "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)
--- 541,550 ----
case 0:
if (setuid(pwd->pw_uid) != 0) {
fprintf(stderr,
! "Could not execute detach 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,953 ----
/* 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);
! if ((unsigned short)stbuf.st_dev >= 0xff00)
return(TRUE);
! if (stbuf.st_dev == 0x0001) /* AFS */
! return(TRUE);
return(FALSE);
! #endif
! #ifndef REMOTEDONE
! ERROR --- ROUTINE NOT IMPLEMENTED ON THIS PLATFORM;
#endif
}