[hackers] [ubase] Set SHELL environment variable by default || sin

From: <git_AT_suckless.org>
Date: Fri, 18 Oct 2013 12:22:34 +0200

commit 7e59506b4b6c479cabc857bd79d89ec2b7dfe1e3
Author: sin <sin_AT_2f30.org>
Date: Fri Oct 18 11:20:59 2013 +0100

    Set SHELL environment variable by default
    
    If target user is not root also set USER and LOGNAME.

diff --git a/su.c b/su.c
index 1435b30..9d8f550 100644
--- a/su.c
+++ b/su.c
_AT_@ -101,6 +101,11 @@ main(int argc, char **argv)
         } else {
                 newargv = (char *const[]){pw->pw_shell, NULL};
                 setenv("HOME", pw->pw_dir, 1);
+ setenv("SHELL", pw->pw_dir, 1);
+ if (strcmp(pw->pw_name, "root") != 0) {
+ setenv("USER", pw->pw_name, 1);
+ setenv("LOGNAME", pw->pw_name, 1);
+ }
                 execve(pw->pw_shell, newargv, environ);
         }
         return (errno == ENOENT) ? 127 : 126;
Received on Fri Oct 18 2013 - 12:22:34 CEST

This archive was generated by hypermail 2.3.0 : Fri Oct 18 2013 - 12:24:24 CEST