krb5 commit: Fix creation/rename of top-level profile sections

Greg Hudson ghudson at MIT.EDU
Tue Jul 29 10:56:55 EDT 2014


https://github.com/krb5/krb5/commit/590df2f41f84e0f9492e08f7dbd26fbcd3118ea0
commit 590df2f41f84e0f9492e08f7dbd26fbcd3118ea0
Author: Greg Hudson <ghudson at mit.edu>
Date:   Wed Jul 16 16:30:26 2014 -0400

    Fix creation/rename of top-level profile sections
    
    profile_rename_section should demand only one name.
    
    profile_add_relation should demand only one name if it is creating a
    new section.  It aso needs to reset state before calling
    profile_find_node for the section, in case it didn't look up any
    parent sections previously.
    
    ticket: 7972 (new)
    target_version: 1.12.2
    tags: pullup

 src/util/profile/prof_set.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/util/profile/prof_set.c b/src/util/profile/prof_set.c
index b210236..af4b2f8 100644
--- a/src/util/profile/prof_set.c
+++ b/src/util/profile/prof_set.c
@@ -207,7 +207,7 @@ profile_rename_section(profile_t profile, const char **names,
     if (retval)
         return retval;
 
-    if (names == 0 || names[0] == 0 || names[1] == 0)
+    if (names == 0 || names[0] == 0)
         return PROF_BAD_NAMESET;
 
     k5_mutex_lock(&profile->first_file->data->lock);
@@ -264,7 +264,8 @@ profile_add_relation(profile_t profile, const char **names,
     if (retval)
         return retval;
 
-    if (names == 0 || names[0] == 0 || names[1] == 0)
+    /* Require at least two names for a new relation, one for a new section. */
+    if (names == 0 || names[0] == 0 || (names[1] == 0 && new_value))
         return PROF_BAD_NAMESET;
 
     k5_mutex_lock(&profile->first_file->data->lock);
@@ -282,6 +283,7 @@ profile_add_relation(profile_t profile, const char **names,
     }
 
     if (new_value == 0) {
+        state = 0;
         retval = profile_find_node(section, *cpp, 0, 1, &state, 0);
         if (retval == 0) {
             k5_mutex_unlock(&profile->first_file->data->lock);


More information about the cvs-krb5 mailing list