Revert "s3:auth: Fix user_in_list() for UNIX groups"
authorSamuel Cabrero <scabrero@samba.org>
Fri, 3 Jun 2022 12:01:36 +0000 (14:01 +0200)
committerJule Anger <janger@samba.org>
Sun, 12 Jun 2022 09:19:16 +0000 (09:19 +0000)
This partly reverts commit 6dc463d3e2eb229df1c4f620cfcaf22ac71738d4.

Reverted to allow next revert commits to apply cleanly. Do not recreate
selftest/knownfail.d/usernamemap file.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15087

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit dbf3d217e3424fae64d9bd00e4762dc4d2bda6c2)

source3/auth/user_util.c

index aa765c2a692844595d855c6ad5d60a42a2904f5d..70b4f320c5ec29768cfe83f39bf83f21daa0fa76 100644 (file)
@@ -143,11 +143,11 @@ bool user_in_list(TALLOC_CTX *ctx, const char *user, const char * const *list)
                return false;
        }
 
+       DBG_DEBUG("Checking user %s in list\n", user);
+
        while (*list) {
                const char *p = *list;
-               bool check_unix_group = false;
-
-               DBG_DEBUG("Checking user '%s' in list '%s'.\n", user, *list);
+               bool ok;
 
                /* Check raw username */
                if (strequal(user, p)) {
@@ -155,13 +155,11 @@ bool user_in_list(TALLOC_CTX *ctx, const char *user, const char * const *list)
                }
 
                while (*p == '@' || *p == '&' || *p == '+') {
-                       if (*p == '@' || *p == '+') {
-                               check_unix_group = true;
-                       }
                        p++;
                }
 
-               if (check_unix_group && user_in_group(user, p)) {
+               ok = user_in_group(user, p);
+               if (ok) {
                        return true;
                }