aboutsummaryrefslogtreecommitdiff
path: root/loginutils/su.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
commitcad5364599eb5062d59e0c397ed638ddd61a8d5d (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /loginutils/su.c
parente01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff)
downloadbusybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip
Major coreutils update.
Diffstat (limited to 'loginutils/su.c')
-rw-r--r--loginutils/su.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/loginutils/su.c b/loginutils/su.c
index 6d427262e..5e40cf2e4 100644
--- a/loginutils/su.c
+++ b/loginutils/su.c
@@ -94,7 +94,7 @@ int su_main ( int argc, char **argv )
94 opt_loginshell = 1; 94 opt_loginshell = 1;
95 break; 95 break;
96 default: 96 default:
97 show_usage ( ); 97 bb_show_usage( );
98 break; 98 break;
99 } 99 }
100 } 100 }
@@ -114,7 +114,7 @@ int su_main ( int argc, char **argv )
114 114
115 pw = getpwnam ( opt_username ); 115 pw = getpwnam ( opt_username );
116 if ( !pw ) 116 if ( !pw )
117 error_msg_and_die ( "user %s does not exist", opt_username ); 117 bb_error_msg_and_die ( "user %s does not exist", opt_username );
118 118
119 /* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER 119 /* Make sure pw->pw_shell is non-NULL. It may be NULL when NEW_USER
120 is a username that is retrieved via NIS (YP), but that doesn't have 120 is a username that is retrieved via NIS (YP), but that doesn't have
@@ -127,15 +127,15 @@ int su_main ( int argc, char **argv )
127 the static data through the getlogin call from log_su. */ 127 the static data through the getlogin call from log_su. */
128 pw_copy = *pw; 128 pw_copy = *pw;
129 pw = &pw_copy; 129 pw = &pw_copy;
130 pw-> pw_name = xstrdup ( pw-> pw_name ); 130 pw-> pw_name = bb_xstrdup ( pw-> pw_name );
131 pw-> pw_dir = xstrdup ( pw-> pw_dir ); 131 pw-> pw_dir = bb_xstrdup ( pw-> pw_dir );
132 pw-> pw_shell = xstrdup ( pw-> pw_shell ); 132 pw-> pw_shell = bb_xstrdup ( pw-> pw_shell );
133 133
134 if (( getuid ( ) == 0 ) || correct_password ( pw )) 134 if (( getuid ( ) == 0 ) || correct_password ( pw ))
135 log_su ( pw, 1 ); 135 log_su ( pw, 1 );
136 else { 136 else {
137 log_su ( pw, 0 ); 137 log_su ( pw, 0 );
138 error_msg_and_die ( "incorrect password" ); 138 bb_error_msg_and_die ( "incorrect password" );
139 } 139 }
140 140
141 if ( !opt_shell && opt_preserve ) 141 if ( !opt_shell && opt_preserve )
@@ -152,7 +152,7 @@ int su_main ( int argc, char **argv )
152 } 152 }
153 153
154 if ( !opt_shell ) 154 if ( !opt_shell )
155 opt_shell = xstrdup ( pw-> pw_shell ); 155 opt_shell = bb_xstrdup ( pw-> pw_shell );
156 156
157 change_identity ( pw ); 157 change_identity ( pw );
158 setup_environment ( opt_shell, opt_loginshell, !opt_preserve, pw ); 158 setup_environment ( opt_shell, opt_loginshell, !opt_preserve, pw );