diff options
Diffstat (limited to 'command/su.c')
-rw-r--r-- | command/su.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/command/su.c b/command/su.c index 942f37e..dc37652 100644 --- a/command/su.c +++ b/command/su.c @@ -14,7 +14,7 @@ static struct { static bool restricted_shell(const char *shell) { char *line; - int result = true; + bool result = true; while ((line = getusershell()) != NULL) { if (strcmp(line, shell) == 0) { @@ -54,7 +54,7 @@ static int short_arg (char c, char* next) { return ARG_UNUSED; } -COMMAND (su) { +COMMAND (su_main) { int start, res; uid_t cur_uid; @@ -78,15 +78,13 @@ COMMAND (su) { pw = xgetpwnam(flags.user); cur_uid = getuid(); - if (cur_uid != 0) { + if (cur_uid != 0) res = prompt_password(pw, "Password: "); - } else { + else res = PASSWORD_VALID; - } - if (res != PASSWORD_VALID) { + if (res != PASSWORD_VALID) error("invalid password"); - } if (flags.shell && cur_uid != 0 && pw->pw_shell && restricted_shell(pw->pw_shell)) { error_s("using restricted shell"); |