]> granicus.if.org Git - sudo/commitdiff
Add support for set_logname run-time default
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 23 Mar 2000 00:20:56 +0000 (00:20 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 23 Mar 2000 00:20:56 +0000 (00:20 +0000)
sudo.c

diff --git a/sudo.c b/sudo.c
index faee77df4423ee2cf4eb3bdf9d339cdc1a90f5e5..2c340ffc4d961d56241d290076c697980315ade6 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -943,17 +943,19 @@ set_perms(perm, sudo_mode)
                                    }
 
                                    /* Set $USER and $LOGNAME to target user */
-                                   if (sudo_setenv("USER", pw->pw_name)) {
-                                       (void) fprintf(stderr,
-                                           "%s: cannot allocate memory!\n",
-                                           Argv[0]);
-                                       exit(1);
-                                   }
-                                   if (sudo_setenv("LOGNAME", pw->pw_name)) {
-                                       (void) fprintf(stderr,
-                                           "%s: cannot allocate memory!\n",
-                                           Argv[0]);
-                                       exit(1);
+                                   if (def_flag(I_LOGNAME)) {
+                                       if (sudo_setenv("USER", pw->pw_name)) {
+                                           (void) fprintf(stderr,
+                                               "%s: cannot allocate memory!\n",
+                                               Argv[0]);
+                                           exit(1);
+                                       }
+                                       if (sudo_setenv("LOGNAME", pw->pw_name)) {
+                                           (void) fprintf(stderr,
+                                               "%s: cannot allocate memory!\n",
+                                               Argv[0]);
+                                           exit(1);
+                                       }
                                    }
 
                                    if (def_flag(I_LOGINCLASS)) {