summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-11-04 18:24:33 +0000
committerJeremy Allison <jra@samba.org>2003-11-04 18:24:33 +0000
commitb3b7cf12a07f78f0d8a76a583ac2db2654dd4d63 (patch)
treec87d2fe80bd7b9449692195eaa7144d0ac6ac176
parente4f1a321a4a7153d3e8adebea274c1ba0011c1b0 (diff)
downloadsamba-b3b7cf12a07f78f0d8a76a583ac2db2654dd4d63.tar.gz
samba-b3b7cf12a07f78f0d8a76a583ac2db2654dd4d63.tar.bz2
samba-b3b7cf12a07f78f0d8a76a583ac2db2654dd4d63.zip
Fix for bug #703, try lowercase netgroups lookups.
Jeremy. (This used to be commit 8b06385e008a9433fa6efb941b997f7d6b182a65)
-rw-r--r--source3/lib/username.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source3/lib/username.c b/source3/lib/username.c
index 6321d47021..40327f8168 100644
--- a/source3/lib/username.c
+++ b/source3/lib/username.c
@@ -293,13 +293,16 @@ struct passwd *Get_Pwnam(const char *user)
}
/****************************************************************************
- Check if a user is in a netgroup user list.
+ Check if a user is in a netgroup user list. If at first we don't succeed,
+ try lower case.
****************************************************************************/
static BOOL user_in_netgroup_list(const char *user, const char *ngname)
{
#ifdef HAVE_NETGROUP
static char *mydomain = NULL;
+ fstring lowercase_user, lowercase_ngname;
+
if (mydomain == NULL)
yp_get_default_domain(&mydomain);
@@ -315,6 +318,20 @@ static BOOL user_in_netgroup_list(const char *user, const char *ngname)
if (innetgr(ngname, NULL, user, mydomain))
return (True);
+
+ /*
+ * Ok, innetgr is case sensitive. Try once more with lowercase
+ * just in case. Attempt to fix #703. JRA.
+ */
+
+ fstrcpy(lowercase_user, user);
+ strlower_m(lowercase_user);
+ fstrcpy(lowercase_ngname, ngname);
+ strlower_m(lowercase_ngname);
+
+ if (innetgr(lowercase_ngname, NULL, lowercase_user, mydomain))
+ return (True);
+
#endif /* HAVE_NETGROUP */
return False;
}