From 7b64564fbeb32d4b1cd0f01c3cdb35953c9c4cff Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 4 Nov 2003 18:24:30 +0000 Subject: Fix for bug #703, try lowercase netgroups lookups. Jeremy. (This used to be commit b7ce6294bbff9ef82b34d900fe836ff2e3c5abe1) --- source3/lib/username.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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; } -- cgit