change BEG header size info
[unix-history] / usr / src / usr.bin / login / login.c.1
index 84abf55..ffc597f 100644 (file)
@@ -1,4 +1,4 @@
-static char *sccsid = "@(#)login.c.1   4.5 (Berkeley) %G%";
+static char *sccsid = "@(#)login.c.1   4.9 (Berkeley) %G%";
 /*
  * login [ name ]
  */
 /*
  * login [ name ]
  */
@@ -11,6 +11,7 @@ static        char *sccsid = "@(#)login.c.1   4.5 (Berkeley) %G%";
 #include <stdio.h>
 #include <sys/stat.h>
 #include <lastlog.h>
 #include <stdio.h>
 #include <sys/stat.h>
 #include <lastlog.h>
+#include <whoami.h>
 #define SCPYN(a, b)    strncpy(a, b, sizeof(a))
 
 #define NMAX sizeof(utmp.ut_name)
 #define SCPYN(a, b)    strncpy(a, b, sizeof(a))
 
 #define NMAX sizeof(utmp.ut_name)
@@ -129,8 +130,10 @@ bad:
                }
        }
        sprintf(user, "USER=%.*s", NMAX, pwd->pw_name);
                }
        }
        sprintf(user, "USER=%.*s", NMAX, pwd->pw_name);
+#ifdef ERNIE
        if (pwd->pw_uid == 0 && ttyn[5] != 'c')
                goto bad;
        if (pwd->pw_uid == 0 && ttyn[5] != 'c')
                goto bad;
+#endif
        if (ttyn[LMAX] == 'd') {
                FILE *console = fopen("/dev/console", "w");
                if (console != NULL) {
        if (ttyn[LMAX] == 'd') {
                FILE *console = fopen("/dev/console", "w");
                if (console != NULL) {
@@ -155,8 +158,12 @@ bad:
                close(f);
        }
        if(chdir(pwd->pw_dir) < 0) {
                close(f);
        }
        if(chdir(pwd->pw_dir) < 0) {
+           printf("Logging with home=/\n");
+           pwd->pw_dir = "/";
+           if(chdir("/") < 0) {
                printf("No directory\n");
                goto loop;
                printf("No directory\n");
                goto loop;
+           }
        }
        time(&utmp.ut_time);
        t = ttyslot();
        }
        time(&utmp.ut_time);
        t = ttyslot();
@@ -186,7 +193,13 @@ bad:
                namep++;
        strcat(minusnam, namep);
        alarm(0);
                namep++;
        strcat(minusnam, namep);
        alarm(0);
-       umask(022);
+#ifdef ARPAVAX
+       if (pwd->pw_gid == 31)
+               umask(2);
+       else
+#else
+               umask(022);
+#endif
        showmotd();
        strcat(maildir, pwd->pw_name);
        if(access(maildir,4)==0) {
        showmotd();
        strcat(maildir, pwd->pw_name);
        if(access(maildir,4)==0) {