]> granicus.if.org Git - sudo/commitdiff
Handle parsing boolean options that have no explicit value.
authorTodd C. Miller <Todd.Miller@sudo.ws>
Fri, 2 Mar 2018 17:44:33 +0000 (10:44 -0700)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Fri, 2 Mar 2018 17:44:33 +0000 (10:44 -0700)
plugins/sudoers/cvtsudoers_ldif.c

index 5e9e6766624346a3b573e3705a8c4541e723db6f..f44d6e71f05adc13f14c7b12c3fae566d23033df 100644 (file)
@@ -731,12 +731,16 @@ ldif_store_options(struct ldif_str_list *options)
        TAILQ_INIT(d->binding);
        d->type = DEFAULTS;
        d->op = sudo_ldap_parse_option(ls->str, &var, &val);
-       d->var = strdup(var);
-       d->val = strdup(val);
-       if (d->var == NULL || d->val == NULL) {
+       if ((d->var = strdup(var)) == NULL) {
            sudo_fatalx(U_("%s: %s"), __func__,
                U_("unable to allocate memory"));
        }
+       if (val != NULL) {
+           if ((d->val = strdup(val)) == NULL) {
+               sudo_fatalx(U_("%s: %s"), __func__,
+                   U_("unable to allocate memory"));
+           }
+       }
        TAILQ_INSERT_TAIL(&defaults, d, entries);
     }
     debug_return;