From 35b7c67f5e82d3de8f83ce844db3557b8791bed3 Mon Sep 17 00:00:00 2001 From: Alexander Ried Date: Wed, 5 Oct 2016 18:29:53 +0200 Subject: [v2] user-classify: fix logic for getusershell --- src/user-classify.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/user-classify.c b/src/user-classify.c index b79a35f..97766ce 100644 --- a/src/user-classify.c +++ b/src/user-classify.c @@ -122,6 +122,9 @@ is_invalid_shell (const char *shell) int ret = FALSE; #ifdef HAVE_GETUSERSHELL + /* getusershell returns a whitelist of valid shells. + * assume the shell is invalid unless there is a match */ + ret = TRUE; char *valid_shell; setusershell (); @@ -129,10 +132,12 @@ is_invalid_shell (const char *shell) if (g_strcmp0 (shell, valid_shell) != 0) continue; ret = FALSE; + break; } endusershell (); #endif + /* always check for false and nologin since they are commonly included by getusershell */ basename = g_path_get_basename (shell); nologin_basename = g_path_get_basename (PATH_NOLOGIN); false_basename = g_path_get_basename (PATH_FALSE); -- 2.9.3