From a3de0b3b86deb37c2adc993c6357c1a31b7ecb5b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 13 Apr 2017 13:04:05 +0200 Subject: libbb: make check_password() also return CHECKPASS_PW_HAS_EMPTY_PASSWORD Signed-off-by: Denys Vlasenko --- libbb/correct_password.c | 4 ++-- libbb/securetty.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'libbb') diff --git a/libbb/correct_password.c b/libbb/correct_password.c index 3436edc..f4635a5 100644 --- a/libbb/correct_password.c +++ b/libbb/correct_password.c @@ -63,7 +63,7 @@ static const char *get_passwd(const struct passwd *pw, char buffer[SHADOW_BUFSIZ } /* - * Return 1 if PW has an empty password. + * Return CHECKPASS_PW_HAS_EMPTY_PASSWORD if PW has an empty password. * Return 1 if the user gives the correct password for entry PW, * 0 if not. * NULL pw means "just fake it for login with bad username" @@ -77,7 +77,7 @@ int FAST_FUNC check_password(const struct passwd *pw, const char *plaintext) pw_pass = get_passwd(pw, buffer); if (!pw_pass[0]) { /* empty password field? */ - return 1; + return CHECKPASS_PW_HAS_EMPTY_PASSWORD; } encrypted = pw_encrypt(plaintext, /*salt:*/ pw_pass, 1); diff --git a/libbb/securetty.c b/libbb/securetty.c index 176cee1..67a1236 100644 --- a/libbb/securetty.c +++ b/libbb/securetty.c @@ -6,7 +6,7 @@ */ #include "libbb.h" -int FAST_FUNC check_securetty(const char *short_tty) +int FAST_FUNC is_tty_secure(const char *short_tty) { char *buf = (char*)"/etc/securetty"; /* any non-NULL is ok */ parser_t *parser = config_open2("/etc/securetty", fopen_for_read); @@ -17,6 +17,8 @@ int FAST_FUNC check_securetty(const char *short_tty) } config_close(parser); /* buf != NULL here if config file was not found, empty - * or line was found which equals short_tty */ + * or line was found which equals short_tty. + * In all these cases, we report "this tty is secure". + */ return buf != NULL; } -- cgit v1.1