diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-08 21:22:45 +0400 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-09-08 21:22:45 +0400 |
commit | 2e502914b0a2281e5d87b5093da5fb9e9759a601 (patch) | |
tree | 4c02333e3a7fea88a5a44fb8a00ead25dad0b06e /loginutils/login.c | |
parent | dd93abeaffa79efcf3028489b7638f2c723020e8 (diff) |
login: style fixes
Diffstat (limited to 'loginutils/login.c')
-rw-r--r-- | loginutils/login.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/loginutils/login.c b/loginutils/login.c index 5b4edd8de..39d980fa8 100644 --- a/loginutils/login.c +++ b/loginutils/login.c @@ -15,6 +15,7 @@ #include <sys/resource.h> #include <sys/stat.h> #include <sys/types.h> +#include <sys/wait.h> #include <ctype.h> #include <time.h> @@ -258,6 +259,27 @@ auth_ok: chown ( full_tty, pw-> pw_uid, pw-> pw_gid ); chmod ( full_tty, 0600 ); + if (ENABLE_LOGIN_SCRIPTS) { + char *script = getenv("LOGIN_PRE_SUID_SCRIPT"); + if (script) { + char *t_argv[2] = { script, NULL }; + switch(fork()) { + case -1: break; + case 0: /* child */ + xchdir("/"); + setenv("LOGIN_TTY", full_tty, 1); + setenv("LOGIN_USER", pw->pw_name, 1); + setenv("LOGIN_UID", utoa(pw->pw_uid), 1); + setenv("LOGIN_GID", utoa(pw->pw_gid), 1); + setenv("LOGIN_SHELL", pw->pw_shell, 1); + execvp(script, t_argv); + exit(1); + default: /* parent */ + wait(NULL); + } + } + } + change_identity ( pw ); tmp = pw-> pw_shell; if(!tmp || !*tmp) |