From 04150a407f65b63ea5117bc8b7297a5fbefc7487 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Mon, 15 May 2023 10:57:33 -0400 Subject: refactor cmd names --- command/su.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'command/su.c') 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"); -- cgit v1.2.3-freya