[2834] in Release_Engineering
login patches
daemon@ATHENA.MIT.EDU (Richard Basch)
Mon May 18 13:45:13 1992
Date: Mon, 18 May 92 13:44:30 -0400
To: builder@MIT.EDU, rel-eng@MIT.EDU
From: "Richard Basch" <basch@MIT.EDU>
Here are patches for:
athena/athena.etc/xdm/conf/Xsession
Aix-3.1/tsm/athena.c
athena/bin/login/login.c
athena/athena.etc/xdm/xlogin/verify.c
These patches are the complete set (the previous versions that I sent in
only dealt with one of the various paths... this now rounds it all out...)
I will send the quota patch in my next message (different bug report)...
-R
*** /tmp/,RCSt1FDsADV Mon May 18 13:42:03 1992
--- Xsession Mon May 18 13:41:45 1992
***************
*** 4,10 ****
#
# $Id: Xsession,v 1.1 92/05/18 13:40:21 probe Exp Locker: probe $
! trap 'kdestroy; unlog; exit 0' 1 2 15
initlib="/usr/athena/lib/init"
defsession=$1
--- 4,10 ----
#
# $Id: Xsession,v 1.1 92/05/18 13:40:21 probe Exp Locker: probe $
! trap "kdestroy; unlog; fsid -u -f $USER; exit 0" 1 2 15
initlib="/usr/athena/lib/init"
defsession=$1
***************
*** 53,59 ****
kdestroy # destroy tickets.
cd /tmp
- detach $USER > /dev/null 2>&1
unlog
sleep 3 # let them see any messages (quickly)
exit 0
--- 53,59 ----
kdestroy # destroy tickets.
cd /tmp
unlog
+ fsid -u -f $USER > /dev/null 2>&1
sleep 3 # let them see any messages (quickly)
exit 0
*** /tmp/,RCSt1FDsHQL Mon May 18 13:42:04 1992
--- athena.c Mon May 18 13:12:33 1992
***************
*** 39,44 ****
--- 39,45 ----
static int kauth = 0;
static int sig_flag = 0;
+ static int attach_state = 0;
/*
* NAME: user_add
***************
*** 331,338 ****
* NAME: user_cleanup
*
* FUNCTION:
! * Removes users tickets and tokens
! * Decrements ref. count on temporary users (and removes if necessary)
*/
int user_cleanup(char *user)
{
--- 332,339 ----
* NAME: user_cleanup
*
* FUNCTION:
! * Removes users tickets, tokens, and mappings to user's homedir.
! * Decrements ref. count on temporary users (and removes if necessary).
*/
int user_cleanup(char *user)
{
***************
*** 342,347 ****
--- 343,354 ----
getuserattr(user, S_ID, (void *)&uid, SEC_INT);
enduserdb();
+ /* Unmap to user's homedir */
+ if (attach_state) {
+ do_cmd(uid, "fsid", "-quiet", "-unmap", "-filsys", user, (char *)0);
+ attach_state = 0;
+ }
+
/* Destroy tokens and tickets */
setuidx(ID_REAL|ID_EFFECTIVE, uid);
dest_tkt();
***************
*** 382,387 ****
--- 389,395 ----
code = statx(home, &statb, STATXSIZE, STX_NORMAL);
if (kauth && (code || statb.st_flag & FS_REMOTE)) {
code = do_cmd(uid, "attach", "-quiet", "-nozephyr", user, (char *)0);
+ attach_state = 1;
}
/* Create temporary home directory if other directory is inaccessible */
*** /tmp/,RCSt1FDsLQL Mon May 18 13:42:05 1992
--- login.c Mon May 18 13:13:46 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)
*** /tmp/,RCSt1FDsODd Mon May 18 13:42:06 1992
--- verify.c Mon May 18 13:39:22 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,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
}