diff options
| author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-06-14 16:36:45 +0000 |
|---|---|---|
| committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-06-14 16:36:45 +0000 |
| commit | 63aa40e98253c3e281ff24fcf01b5fc7532cf96d (patch) | |
| tree | 007d7f56a3b269a406bf7baedb19097a690d1418 | |
| parent | 5ed3a243feeda967cfe6bc523eb268b186780800 (diff) | |
| download | busybox-w32-63aa40e98253c3e281ff24fcf01b5fc7532cf96d.tar.gz busybox-w32-63aa40e98253c3e281ff24fcf01b5fc7532cf96d.tar.bz2 busybox-w32-63aa40e98253c3e281ff24fcf01b5fc7532cf96d.zip | |
- minor size tweak
text data bss dec hex filename
613 0 0 613 265 loginutils/su.o.orig
605 0 0 605 25d loginutils/su.o
git-svn-id: svn://busybox.net/trunk/busybox@15385 69ca8d6d-28ef-0310-b511-8ec308f3f277
| -rw-r--r-- | loginutils/su.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/loginutils/su.c b/loginutils/su.c index a6fcd739f..1273831ff 100644 --- a/loginutils/su.c +++ b/loginutils/su.c | |||
| @@ -65,8 +65,6 @@ static void log_su (const char *successful, const char *old_user, | |||
| 65 | int su_main ( int argc, char **argv ) | 65 | int su_main ( int argc, char **argv ) |
| 66 | { | 66 | { |
| 67 | unsigned long flags; | 67 | unsigned long flags; |
| 68 | int opt_preserve; | ||
| 69 | int opt_loginshell; | ||
| 70 | char *opt_shell = 0; | 68 | char *opt_shell = 0; |
| 71 | char *opt_command = 0; | 69 | char *opt_command = 0; |
| 72 | char *opt_username = DEFAULT_USER; | 70 | char *opt_username = DEFAULT_USER; |
| @@ -81,11 +79,12 @@ int su_main ( int argc, char **argv ) | |||
| 81 | 79 | ||
| 82 | flags = bb_getopt_ulflags(argc, argv, "mplc:s:", | 80 | flags = bb_getopt_ulflags(argc, argv, "mplc:s:", |
| 83 | &opt_command, &opt_shell); | 81 | &opt_command, &opt_shell); |
| 84 | opt_preserve = flags & 3; | 82 | #define SU_OPT_m (3) |
| 85 | opt_loginshell = (flags & 4 ? 1 : 0); | 83 | #define SU_OPT_p (3) |
| 84 | #define SU_OPT_l (4) | ||
| 86 | 85 | ||
| 87 | if (optind < argc && argv[optind][0] == '-' && argv[optind][1] == 0) { | 86 | if (optind < argc && argv[optind][0] == '-' && argv[optind][1] == 0) { |
| 88 | opt_loginshell = 1; | 87 | flags |= SU_OPT_l; |
| 89 | ++optind; | 88 | ++optind; |
| 90 | } | 89 | } |
| 91 | 90 | ||
| @@ -137,7 +136,7 @@ int su_main ( int argc, char **argv ) | |||
| 137 | closelog(); | 136 | closelog(); |
| 138 | #endif | 137 | #endif |
| 139 | 138 | ||
| 140 | if ( !opt_shell && opt_preserve ) | 139 | if ( !opt_shell && (flags & SU_OPT_p)) |
| 141 | opt_shell = getenv ( "SHELL" ); | 140 | opt_shell = getenv ( "SHELL" ); |
| 142 | 141 | ||
| 143 | if ( opt_shell && cur_uid && restricted_shell ( pw->pw_shell )) { | 142 | if ( opt_shell && cur_uid && restricted_shell ( pw->pw_shell )) { |
| @@ -153,11 +152,11 @@ int su_main ( int argc, char **argv ) | |||
| 153 | opt_shell = pw->pw_shell; | 152 | opt_shell = pw->pw_shell; |
| 154 | 153 | ||
| 155 | change_identity ( pw ); | 154 | change_identity ( pw ); |
| 156 | setup_environment ( opt_shell, opt_loginshell, !opt_preserve, pw ); | 155 | setup_environment(opt_shell, flags & SU_OPT_l, !(flags & SU_OPT_p), pw); |
| 157 | #if ENABLE_SELINUX | 156 | #if ENABLE_SELINUX |
| 158 | set_current_security_context(NULL); | 157 | set_current_security_context(NULL); |
| 159 | #endif | 158 | #endif |
| 160 | run_shell ( opt_shell, opt_loginshell, opt_command, (const char**)opt_args); | 159 | run_shell(opt_shell, flags & SU_OPT_l, opt_command, (const char**)opt_args); |
| 161 | 160 | ||
| 162 | return EXIT_FAILURE; | 161 | return EXIT_FAILURE; |
| 163 | } | 162 | } |
