167d4b
From 23dfa2e35bec9c0f6c3d579e7dc2e1d0ce636aa2 Mon Sep 17 00:00:00 2001
167d4b
From: Andreas Schneider <asn@samba.org>
167d4b
Date: Fri, 19 Sep 2014 13:33:10 +0200
167d4b
Subject: [PATCH] nsswitch: Skip groups we were not able to map.
167d4b
167d4b
If we have configured the idmap_ad backend it is possible that the user
167d4b
is in a group without a gid set. This will result in (uid_t)-1 as the
167d4b
gid. We return this invalid gid to NSS which is wrong.
167d4b
167d4b
BUG: https://bugzilla.samba.org/show_bug.cgi?id=10824
167d4b
167d4b
Signed-off-by: Andreas Schneider <asn@samba.org>
167d4b
Reviewed-by: David Disseldorp <ddiss@samba.org>
167d4b
167d4b
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
167d4b
Autobuild-Date(master): Fri Sep 19 17:57:14 CEST 2014 on sn-devel-104
167d4b
167d4b
(cherry picked from commit 7f59711f076e98ece099f6b38ff6da8c80fa6d5e)
167d4b
Signed-off-by: Andreas Schneider <asn@samba.org>
167d4b
---
167d4b
 nsswitch/winbind_nss_linux.c | 5 +++++
167d4b
 1 file changed, 5 insertions(+)
167d4b
167d4b
diff --git a/nsswitch/winbind_nss_linux.c b/nsswitch/winbind_nss_linux.c
167d4b
index 8d66a74..70ede3e 100644
167d4b
--- a/nsswitch/winbind_nss_linux.c
167d4b
+++ b/nsswitch/winbind_nss_linux.c
167d4b
@@ -1101,6 +1101,11 @@ _nss_winbind_initgroups_dyn(char *user, gid_t group, long int *start,
167d4b
 				continue;
167d4b
 			}
167d4b
 
167d4b
+			/* Skip groups without a mapping */
167d4b
+			if (gid_list[i] == (uid_t)-1) {
167d4b
+				continue;
167d4b
+			}
167d4b
+
167d4b
 			/* Filled buffer ? If so, resize. */
167d4b
 
167d4b
 			if (*start == *size) {
167d4b
-- 
167d4b
2.1.0
167d4b