Endless loop with duplicate sudoers: entries in nsswitch.conf

Daniel Kopecek <[email protected]>
Newsgroups gmane.comp.tools.sudo.devel
Organization Red Hat, Inc.
Message-ID <[email protected]>
Hello, 
 the attached patch fixes an endless loop which can be triggered by
duplicate entries in the sudoers nsswitch.conf line.

Dan K.

____________________________________________________________
sudo-workers mailing list <[email protected]>
For list information, options, or to unsubscribe, visit:
http://www.sudo.ws/mailman/listinfo/sudo-workers
sudo-1.8.11b4-duplicatenssfix.patch (text/x-patch, 1 KB)
diff -up sudo-1.8.11b4/plugins/sudoers/sudo_nss.c.duplicatenssfix sudo-1.8.11b4/plugins/sudoers/sudo_nss.c
--- sudo-1.8.11b4/plugins/sudoers/sudo_nss.c.duplicatenssfix	2014-09-15 12:46:19.641551915 +0200
+++ sudo-1.8.11b4/plugins/sudoers/sudo_nss.c	2014-09-15 12:43:15.339766288 +0200
@@ -90,16 +90,16 @@ sudo_read_nss(void)
 	for ((cp = strtok(line + 8, " \t")); cp != NULL; (cp = strtok(NULL, " \t"))) {
 	    if (strcasecmp(cp, "files") == 0 && !saw_files) {
 		TAILQ_INSERT_TAIL(&snl, &sudo_nss_file, entries);
-		got_match = true;
+		got_match = saw_files = true;
 #ifdef HAVE_LDAP
 	    } else if (strcasecmp(cp, "ldap") == 0 && !saw_ldap) {
 		TAILQ_INSERT_TAIL(&snl, &sudo_nss_ldap, entries);
-		got_match = true;
+		got_match = saw_ldap = true;
 #endif
 #ifdef HAVE_SSSD
 	    } else if (strcasecmp(cp, "sss") == 0 && !saw_sss) {
 		TAILQ_INSERT_TAIL(&snl, &sudo_nss_sss, entries);
-		got_match = true;
+		got_match = saw_sss = true;
 #endif
 	    } else if (strcasecmp(cp, "[NOTFOUND=return]") == 0 && got_match) {
 		/* NOTFOUND affects the most recent entry */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.