aboutsummaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-03-26 13:35:09 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-03-26 13:35:09 +0000
commit53091ecd20c294f0e0757a5f4e0d5c8c7b23b555 (patch)
treef4ae0be26d5debff091d2c976e77fa8050c6758c /loginutils
parentec1a4b5a521b5adf295bc757c25231910f8c854b (diff)
downloadbusybox-w32-53091ecd20c294f0e0757a5f4e0d5c8c7b23b555.tar.gz
busybox-w32-53091ecd20c294f0e0757a5f4e0d5c8c7b23b555.tar.bz2
busybox-w32-53091ecd20c294f0e0757a5f4e0d5c8c7b23b555.zip
Attempt to get more applets compile for NOMMU.
TODO_config_nommu documents what I managed to compile so far (yay! msh works! cool). inetd, telnetd, httpd still do not compile. TODO Also make fork(), daemon() produce warnings on compile stage (in addition to erros on link stage).
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/login.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/loginutils/login.c b/loginutils/login.c
index 791e44d83..3d8b8e540 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -337,25 +337,24 @@ auth_failed:
337 fchown(0, pw->pw_uid, pw->pw_gid); 337 fchown(0, pw->pw_uid, pw->pw_gid);
338 fchmod(0, 0600); 338 fchmod(0, 0600);
339 339
340/* TODO: be nommu-friendly, use spawn? */
341 if (ENABLE_LOGIN_SCRIPTS) { 340 if (ENABLE_LOGIN_SCRIPTS) {
342 char *script = getenv("LOGIN_PRE_SUID_SCRIPT"); 341 char *t_argv[2];
343 if (script) { 342
344 char *t_argv[2] = { script, NULL }; 343 t_argv[0] = getenv("LOGIN_PRE_SUID_SCRIPT");
345 switch (fork()) { 344 if (t_argv[0]) {
346 case -1: break; 345 t_argv[1] = NULL;
347 case 0: /* child */ 346 setenv("LOGIN_TTY", full_tty, 1);
348 xchdir("/"); 347 setenv("LOGIN_USER", pw->pw_name, 1);
349 setenv("LOGIN_TTY", full_tty, 1); 348 setenv("LOGIN_UID", utoa(pw->pw_uid), 1);
350 setenv("LOGIN_USER", pw->pw_name, 1); 349 setenv("LOGIN_GID", utoa(pw->pw_gid), 1);
351 setenv("LOGIN_UID", utoa(pw->pw_uid), 1); 350 setenv("LOGIN_SHELL", pw->pw_shell, 1);
352 setenv("LOGIN_GID", utoa(pw->pw_gid), 1); 351 xspawn(argv); /* NOMMU-friendly */
353 setenv("LOGIN_SHELL", pw->pw_shell, 1); 352 unsetenv("LOGIN_TTY");
354 BB_EXECVP(script, t_argv); 353 unsetenv("LOGIN_USER");
355 exit(1); 354 unsetenv("LOGIN_UID");
356 default: /* parent */ 355 unsetenv("LOGIN_GID");
357 wait(NULL); 356 unsetenv("LOGIN_SHELL");
358 } 357 wait(NULL);
359 } 358 }
360 } 359 }
361 360