Earlier setting a /bin/sh was impossible for users that had nothing set
as shell, as that was seen as no change.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
int main(int argc, char **argv)
{
char *oldshell;
+ int nullshell = 0;
const uid_t uid = getuid();
struct sinfo info = { 0 };
struct passwd *pw;
#endif
oldshell = pw->pw_shell;
- if (oldshell == NULL || *oldshell == '\0')
+ if (oldshell == NULL || *oldshell == '\0') {
oldshell = _PATH_BSHELL; /* default */
+ nullshell = 1;
+ }
/* reality check */
#ifdef HAVE_LIBUSER
if (check_shell(info.shell) < 0)
return EXIT_FAILURE;
- if (strcmp(oldshell, info.shell) == 0)
+ if (!nullshell && strcmp(oldshell, info.shell) == 0)
errx(EXIT_SUCCESS, _("Shell not changed."));
#ifdef HAVE_LIBUSER