[1035] in SIPB_Linux_Development
Oops, screwed up that last one
daemon@ATHENA.MIT.EDU (Daniel Bromberg)
Wed Aug 2 20:04:32 1995
To: linux-dev@MIT.EDU
Reply-To: ddaniel@vigor.jpl.nasa.gov
Date: Wed, 02 Aug 1995 17:04:18 PDT
From: Daniel Bromberg <ddaniel@yugo.jpl.nasa.gov>
Sorry, there was some code I accidentally deleted and resulted in some
extra patch deletion stuff. Here's the real McCoy:
---start patch---
diff -bcdr /mit/linux-athena/login/athena.c /mit/ddaniel/src/login/athena.c
*** /mit/linux-athena/login/athena.c Thu Aug 25 22:08:58 1994
--- /mit/ddaniel/src/login/athena.c Wed Aug 2 19:28:37 1995
***************
*** 48,54 ****
int get_tickets (char *username, char *password, struct passwd *pwd);
int verify_krb_tgt (char *realm);
void encrypt_password (struct passwd *pwd, char *password);
! void athena_get_homedir (struct passwd *pwd);
int attach_homedir (struct passwd *pwd);
void detach_homedir (struct passwd *pwd);
int isremotedir (char *dir);
--- 48,54 ----
int get_tickets (char *username, char *password, struct passwd *pwd);
int verify_krb_tgt (char *realm);
void encrypt_password (struct passwd *pwd, char *password);
! void athena_get_homedir (struct passwd *pwd, char *aklogstr);
int attach_homedir (struct passwd *pwd);
void detach_homedir (struct passwd *pwd);
int isremotedir (char *dir);
***************
*** 305,318 ****
* athena_get_homedir () -- if the user needs a networked or temporary
* homedir, attach or create it.
*/
! void athena_get_homedir (struct passwd *pwd)
{
/* If we already have a homedir, use it.
* Otherwise, try to attach. If that fails,
* try to create.
*/
attachedflag = tmpdirflag = FALSE;
if (goodhomedir (pwd)) {
if (hesiod_user)
puts("\nWarning: Using local home directory.");
return;
--- 305,345 ----
* athena_get_homedir () -- if the user needs a networked or temporary
* homedir, attach or create it.
*/
! void athena_get_homedir (struct passwd *pwd, char *aklogstr)
{
/* If we already have a homedir, use it.
* Otherwise, try to attach. If that fails,
* try to create.
*/
+ char *realhome = malloc(MAXPATHLEN), *olddir = malloc(MAXPATHLEN),
+ *rootdir, *celldir;
+
attachedflag = tmpdirflag = FALSE;
if (goodhomedir (pwd)) {
+ /* the following is to figure out if we ought to aklog for an
+ already attached homedir. While public athena machines detach
+ users after logging out, therefore forcing an aklog during the
+ subsequent attach during login, private machines often _don't_
+ detach. Important though: we figure out that we want to aklog
+ here _but_ we do not do it until the setuid() in login.c since
+ tokens are not persistent across id changes, at least on linux.
+ Added by ddaniel@vigor.jpl.nasa.gov, 8/2/95 */
+ /* first get a real path to where the user's dir is. */
+ /* be nice: save the old path */
+ if ( (olddir = getcwd(NULL, MAXPATHLEN)) == NULL )
+ perror("Warning: couldn't get current directory");
+ if ( chdir(pwd->pw_dir) )
+ perror("Warning: could not change to home directory");
+ if ( (realhome = getcwd(NULL, MAXPATHLEN)) == NULL )
+ perror("Warning: could not get full home directory path");
+ if ( chdir(olddir) )
+ perror("Warning: couldn't return to old current directory");
+ rootdir = strtok(realhome, "/");
+ celldir = strtok(NULL, "/");
+ if ( ! strcmp(rootdir, "afs" ) )
+ /* we're in AFS, we should try to obtain tokens. This will get
+ done _after_ the setuid in login.c since we're not using PAGs */
+ sprintf(aklogstr, "/usr/athena/bin/aklog -cell %s", celldir);
if (hesiod_user)
puts("\nWarning: Using local home directory.");
return;
diff -bcdr /mit/linux-athena/login/login.c /mit/ddaniel/src/login/login.c
*** /mit/linux-athena/login/login.c Fri Aug 26 20:35:04 1994
--- /mit/ddaniel/src/login/login.c Wed Aug 2 19:58:21 1995
***************
*** 73,79 ****
extern int hesiod_user;
int athena_login (struct passwd **pwdp, char *username, char *password);
! void athena_get_homedir (struct passwd *pwd);
void athena_init_wgfile (void);
void athena_do_fork (struct passwd *pwd);
#endif
--- 73,79 ----
extern int hesiod_user;
int athena_login (struct passwd **pwdp, char *username, char *password);
! void athena_get_homedir (struct passwd *pwd, char *aklogstr);
void athena_init_wgfile (void);
void athena_do_fork (struct passwd *pwd);
#endif
***************
*** 104,109 ****
--- 104,114 ----
char *domain, *salt, *ttyn, *pp, *termenv;
char tbuf[MAXPATHLEN + 2], tname[sizeof(_PATH_TTY) + 10];
+ #ifdef ATHENA
+ /* see comments in athena.c near this variable */
+ char aklogstr[256] = "";
+ #endif
+
signal(SIGALRM, timedout);
alarm((unsigned int)timeout);
signal(SIGQUIT, SIG_IGN);
***************
*** 308,314 ****
athena_init_wgfile ();
if (! kerberos_user)
puts ("Warning: no Kerberos tickets obtained.");
! athena_get_homedir (pwd);
#endif
#ifdef ATHENA
--- 313,319 ----
athena_init_wgfile ();
if (! kerberos_user)
puts ("Warning: no Kerberos tickets obtained.");
! athena_get_homedir (pwd, aklogstr);
#endif
#ifdef ATHENA
***************
*** 398,404 ****
exit(1);
}
#endif
!
execlp(pwd->pw_shell, tbuf, (char *)0);
perror ("login: no shell");
exit(0);
--- 403,411 ----
exit(1);
}
#endif
! /* if aklogstr is non-empty we have determined we ought to aklog */
! if ( strlen(aklogstr) > 0 && system(aklogstr) )
! perror("Big-ass warning: could not obtain AFS tokens");
execlp(pwd->pw_shell, tbuf, (char *)0);
perror ("login: no shell");
exit(0);
diff -bcdr /mit/linux-athena/login/pathnames.h /mit/ddaniel/src/login/pathnames.h
*** /mit/linux-athena/login/pathnames.h Thu Aug 25 21:14:06 1994
--- /mit/ddaniel/src/login/pathnames.h Wed Aug 2 19:27:04 1995
***************
*** 9,15 ****
#define _PATH_USERTTY "/etc/usertty"
#define _PATH_NOLOGIN "/etc/nologin"
#ifndef _PATH_DEFPATH
! #define _PATH_DEFPATH "/usr/local/bin:/usr/bin:/bin:."
#endif
#ifndef _PATH_DEFPATH_ROOT
#define _PATH_DEFPATH_ROOT "/sbin:/bin:/usr/sbin:/usr/bin"
--- 9,15 ----
#define _PATH_USERTTY "/etc/usertty"
#define _PATH_NOLOGIN "/etc/nologin"
#ifndef _PATH_DEFPATH
! #define _PATH_DEFPATH "/usr/athena/bin:/usr/local/bin:/usr/bin:/bin:."
#endif
#ifndef _PATH_DEFPATH_ROOT
#define _PATH_DEFPATH_ROOT "/sbin:/bin:/usr/sbin:/usr/bin"
---end patch---