]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Fix deleted node handling in libprofile
authorGreg Hudson <ghudson@mit.edu>
Wed, 16 Jul 2014 20:02:21 +0000 (16:02 -0400)
committerTom Yu <tlyu@mit.edu>
Thu, 7 Aug 2014 22:08:56 +0000 (18:08 -0400)
In profile_find_node, skip deleted nodes when finding the second
match.  Otherwise, profile_clear_nodes could return an error if a node
has some values to clear but the last one is deleted.

In profile_node_iterator, skip deleted nodes when looking up the
section names.  Otherwise we could iterate over a deleted section
and/or ignore its replacement.

(cherry picked from commit e7f50a1c11845ba73ce4ffa4729d10113563a247)

ticket: 7971
version_fixed: 1.12.2
status: resolved

src/util/profile/prof_tree.c

index cc5bdfd80b92dced8fa8bf1484c75505141a1a62..081f688e4ad31ef4e4547df0a3979b1d9df7a34b 100644 (file)
@@ -294,6 +294,8 @@ errcode_t profile_find_node(struct profile_node *section, const char *name,
             if (value && (strcmp(p->value, value)))
                 continue;
         }
+        if (p->deleted)
+            continue;
         /* A match! */
         break;
     }
@@ -519,7 +521,7 @@ get_new_file:
         assert(section != NULL);
         for (cpp = iter->names; cpp[iter->done_idx]; cpp++) {
             for (p=section->first_child; p; p = p->next) {
-                if (!strcmp(p->name, *cpp) && !p->value)
+                if (!strcmp(p->name, *cpp) && !p->value && !p->deleted)
                     break;
             }
             if (!p) {