]> granicus.if.org Git - sudo/commitdiff
Handle escaped commas when skipping over the cn.
authorTodd C. Miller <Todd.Miller@sudo.ws>
Sun, 4 Mar 2018 14:03:38 +0000 (07:03 -0700)
committerTodd C. Miller <Todd.Miller@sudo.ws>
Sun, 4 Mar 2018 14:03:38 +0000 (07:03 -0700)
plugins/sudoers/cvtsudoers_ldif.c

index 92015235f0beeb1cba579a3c5977068d42f92297..563bde4fbad76eefb49b6ff0e46964f8b78963d9 100644 (file)
@@ -1099,13 +1099,18 @@ parse_ldif(const char *input_file, struct cvtsudoers_config *conf)
                char *cp = line + 3;
                while (isblank((unsigned char)*cp))
                    cp++;
+               /* Skip over cn if present. */
                if (strncasecmp(cp, "cn=", 3) == 0) {
                    cp += 3;
-                   /* XXX - handle escaped ','? */
-                   while (*cp != ',' && *cp != '\0')
-                       cp++;
-                   if (*cp == ',')
-                       cp++;
+                   while (*cp != '\0') {
+                       /* Handle escaped ',' chars. */
+                       if (*cp == '\\')
+                           cp++;
+                       if (*cp == ',') {
+                           cp++;
+                           break;
+                       }
+                   }
                }
                if (strcasecmp(cp, conf->sudoers_base) != 0) {
                    /* Doesn't match base, skip the rest of it. */