diff options
author | Tomas Mraz <tmraz@fedoraproject.org> | 2011-10-10 14:05:03 +0200 |
---|---|---|
committer | Tomas Mraz <tmraz@fedoraproject.org> | 2011-10-10 14:05:03 +0200 |
commit | c5cbe7a04f82ac89372dd2765979aac66188dca1 (patch) | |
tree | a163c0a73fb3836b445721187ac0c7a314221ae0 | |
parent | 6eaacb1584c11373d96313dd17f72ab89cf5654d (diff) | |
download | pam-c5cbe7a04f82ac89372dd2765979aac66188dca1.tar.gz pam-c5cbe7a04f82ac89372dd2765979aac66188dca1.tar.bz2 pam-c5cbe7a04f82ac89372dd2765979aac66188dca1.zip |
If getdomainname() fails or domainname not set use NULL as domain in innetgr().
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | modules/pam_access/pam_access.c | 8 |
2 files changed, 6 insertions, 5 deletions
@@ -8,6 +8,9 @@ (network_netmask_match): Cache the getaddrinfo() result. (pam_sm_authenticate): Free the getaddrinfo() result. + * modules/pam_access/pam_access.c (netgroup_match): If getdomainname() + fails or domainname not set use NULL as domain in innetgr(). + 2011-09-30 Tomas Mraz <tm@t8m.info> * doc/man/pam.conf-syntax.xml: Improve documentation of the diff --git a/modules/pam_access/pam_access.c b/modules/pam_access/pam_access.c index 35b7d058..2669a5ec 100644 --- a/modules/pam_access/pam_access.c +++ b/modules/pam_access/pam_access.c @@ -478,12 +478,10 @@ netgroup_match (pam_handle_t *pamh, const char *netgroup, if (getdomainname (domainname_res, sizeof (domainname_res)) == 0) { - if (strcmp (domainname_res, "(none)") == 0) + if (domainname_res[0] != '\0' && strcmp (domainname_res, "(none)") != 0) { - /* If domainname is not set, some systems will return "(none)" */ - domainname_res[0] = '\0'; - } - mydomain = domainname_res; + mydomain = domainname_res; + } } #endif |