[sudo-workers] nscd does not handle "(none)" string

Tomas Sykora tosykora at redhat.com
Tue Sep 13 06:02:17 MDT 2016


Hi,

By default, when no domainname is set, the string "(none)" is returned by getdomainname.
nscd does not handle the "(none)" string, it's really using it to search for entries in its cache.
This domainname value is then used as the domain parameter in the triple (host,user,domain).

I wrote a patch to solve the problem:
diff -up ./plugins/sudoers/match.c.orig ./plugins/sudoers/match.c
--- ./plugins/sudoers/match.c.orig      2016-09-13 13:22:58.299760175 +0200
+++ ./plugins/sudoers/match.c   2016-09-13 13:25:29.874809099 +0200
@@ -1004,7 +1004,10 @@ sudo_getdomainname(void)
 # else
            rval = getdomainname(domain, host_name_max + 1); 
 # endif
-           if (rval != -1 && domain[0] != '\0') {
+           if (strncmp (domain, "(none)", 7) == 0) {
+               free(domain);
+               domain = NULL;
+           } else if (rval != -1 && domain[0] != '\0') {
                const char *cp;
 
                for (cp = domain; *cp != '\0'; cp++) {

Is it possible to add this to upstream?



More information about the sudo-workers mailing list