Blame SOURCES/sudo-1.8.19p2-lecture-boolean.patch

0e1944
commit 631d458b6fc7341363a121c390e086cf676ecc83
0e1944
Author: Todd C. Miller <Todd.Miller@courtesan.com>
0e1944
Date:   Wed May 3 09:28:36 2017 -0600
0e1944
0e1944
    Allow a tuple to be set to boolean true.  Regression introduced by
0e1944
    refactor of set_default_entry() in sudo 1.8.18.
0e1944
0e1944
diff --git a/plugins/sudoers/defaults.c b/plugins/sudoers/defaults.c
0e1944
index 89788477..91b47eeb 100644
0e1944
--- a/plugins/sudoers/defaults.c
0e1944
+++ b/plugins/sudoers/defaults.c
0e1944
@@ -238,19 +238,31 @@ parse_default_entry(struct sudo_defs_types *def, const char *val, int op,
0e1944
     int rc;
0e1944
     debug_decl(parse_default_entry, SUDOERS_DEBUG_DEFAULTS)
0e1944
 
0e1944
-    if (val == NULL && !ISSET(def->type, T_FLAG)) {
0e1944
-	/* Check for bogus boolean usage or missing value if non-boolean. */
0e1944
-	if (!ISSET(def->type, T_BOOL) || op != false) {
0e1944
-	    if (!quiet) {
0e1944
-		if (lineno > 0) {
0e1944
-		    sudo_warnx(U_("%s:%d no value specified for \"%s\""),
0e1944
-			file, lineno, def->name);
0e1944
-		} else {
0e1944
-		    sudo_warnx(U_("%s: no value specified for \"%s\""),
0e1944
-			file, def->name);
0e1944
+    /*
0e1944
+     * If no value specified, the boolean flag must be set for non-flags.
0e1944
+     * Only flags and tuples support boolean "true".
0e1944
+     */
0e1944
+    if (val == NULL) {
0e1944
+	switch (def->type & T_MASK) {
0e1944
+	case T_FLAG:
0e1944
+	    break;
0e1944
+	case T_TUPLE:
0e1944
+	    if (ISSET(def->type, T_BOOL))
0e1944
+		break;
0e1944
+	    /* FALLTHROUGH */
0e1944
+	default:
0e1944
+	    if (!ISSET(def->type, T_BOOL) || op != false) {
0e1944
+		if (!quiet) {
0e1944
+		    if (lineno > 0) {
0e1944
+			sudo_warnx(U_("%s:%d no value specified for \"%s\""),
0e1944
+			    file, lineno, def->name);
0e1944
+		    } else {
0e1944
+			sudo_warnx(U_("%s: no value specified for \"%s\""),
0e1944
+			    file, def->name);
0e1944
+		    }
0e1944
 		}
0e1944
+		debug_return_bool(false);
0e1944
 	    }
0e1944
-	    debug_return_bool(false);
0e1944
 	}
0e1944
     }
0e1944