diff --git a/configure.ac b/configure.ac index 46bd58e3b..d7321b3cf 100644 --- a/configure.ac +++ b/configure.ac @@ -40,7 +40,7 @@ dnl shadow now uses the libc's shadow implementation AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])]) AC_CHECK_FUNCS(arc4random_buf futimes \ - getentropy getrandom getusershell \ + getentropy getrandom \ lckpwdf lutimes \ updwtmpx innetgr \ getspnam_r \ diff --git a/contrib/adduser.c b/contrib/adduser.c index 8061c76a4..5c3fec787 100644 --- a/contrib/adduser.c +++ b/contrib/adduser.c @@ -127,7 +127,6 @@ #define EXPIRE_VALS_SET /* If defined, 'normal' users can't change * password expiry values (if running suid root) */ -#define HAVE_GETUSERSHELL /* FIXME: Isn't this defined in config.h too? */ #define LOGGING /* If we want to log various things to syslog */ #define MAX_USRNAME 8 /* Longer usernames seem to work on my system.... * But they're probably a poor idea */ @@ -314,13 +313,13 @@ main (void) { char *sh; int ok = 0; -#ifdef HAVE_GETUSERSHELL + setusershell (); while ((sh = getusershell ()) != NULL) if (streq(shell, sh)) ok = 1; endusershell (); -#endif + if (!ok) { if (getuid () == 0) diff --git a/src/chsh.c b/src/chsh.c index ecd5749ab..b45dca714 100644 --- a/src/chsh.c +++ b/src/chsh.c @@ -196,9 +196,8 @@ static bool shell_is_listed (const char *sh) static bool shell_is_listed (const char *sh) { bool found = false; - -#ifdef HAVE_GETUSERSHELL char *cp; + setusershell (); while ((cp = getusershell ())) { if (streq(cp, sh)) { @@ -207,30 +206,7 @@ static bool shell_is_listed (const char *sh) } } endusershell (); -#else - char *buf = NULL; - FILE *fp; - size_t n = 0; - - fp = fopen (SHELLS_FILE, "r"); - if (NULL == fp) { - return false; - } - while (getline (&buf, &n, fp) != -1) { - if (buf[0] != '/') { - continue; - } - - if (streq(buf, sh)) { - found = true; - break; - } - } - - free(buf); - fclose (fp); -#endif return found; } #endif /* with HAVE_VENDORDIR */