[389-commits] ldap/servers

Noriko Hosoi nhosoi at fedoraproject.org
Wed Jan 19 19:23:35 UTC 2011


 ldap/servers/slapd/configdse.c |   21 ++++++++++++++++++---
 ldap/servers/slapd/libglobs.c  |    2 +-
 2 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit f1899ba0ea425639932c373d3171ec8a9441f780
Author: Noriko Hosoi <nhosoi at redhat.com>
Date:   Wed Jan 19 10:52:24 2011 -0800

    Bug 616850 - ldapmodify failed to reject the replace operation
    if its targeted for an Unknown attribute
    
    https://bugzilla.redhat.com/show_bug.cgi?id=616850
    
    Description: Attempting to modify an unknown attribute in the
    config entry fails with LDAP_UNWILLING_TO_PERFORM, while starting
    up just ignores unknown attributes and the server successfully
    starts.

diff --git a/ldap/servers/slapd/configdse.c b/ldap/servers/slapd/configdse.c
index 4799145..faf1560 100644
--- a/ldap/servers/slapd/configdse.c
+++ b/ldap/servers/slapd/configdse.c
@@ -329,9 +329,12 @@ load_config_dse(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry* ignored, int *ret
 					retval = LDAP_SUCCESS;
 				}
 			} else {
-				if ((retval != LDAP_SUCCESS) &&
-					slapi_attr_flag_is_set(attr, SLAPI_ATTR_FLAG_OPATTR)) {
-					retval = LDAP_SUCCESS; /* ignore attempts to modify operational attrs */
+				if (((retval != LDAP_SUCCESS) &&
+					slapi_attr_flag_is_set(attr, SLAPI_ATTR_FLAG_OPATTR)) ||
+					(LDAP_NO_SUCH_ATTRIBUTE == retval)) {
+					/* ignore attempts to modify operational attrs and */
+					/* ignore attempts to modify unknown attributes for load. */
+					retval = LDAP_SUCCESS;
 				}
 			}
 		}
@@ -425,6 +428,12 @@ modify_config_dse(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, in
 				}
 				rc = config_set(config_attr, mods[i]->mod_bvalues, 
 								returntext, apply_mods);
+				if (LDAP_NO_SUCH_ATTRIBUTE == rc) {
+					/* config_set returns LDAP_NO_SUCH_ATTRIBUTE if the
+					 * attr is not defined for cn=config. 
+					 * map it to LDAP_UNWILLING_TO_PERFORM */
+					rc = LDAP_UNWILLING_TO_PERFORM;
+				}
 			} else if (SLAPI_IS_MOD_DELETE(mods[i]->mod_op)) {
 				/* Need to allow deleting some configuration attrs */
 			    if (allowed_to_delete_attrs(config_attr)) {
@@ -458,6 +467,12 @@ modify_config_dse(Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry* e, in
 
 				rc = config_set(config_attr, mods[i]->mod_bvalues, returntext,
 								apply_mods);
+				if (LDAP_NO_SUCH_ATTRIBUTE == rc) {
+					/* config_set returns LDAP_NO_SUCH_ATTRIBUTE if the
+					 * attr is not defined for cn=config. 
+					 * map it to LDAP_UNWILLING_TO_PERFORM */
+					rc = LDAP_UNWILLING_TO_PERFORM;
+				}
 			}
 		}
 	}
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
index 6a7e014..e547b47 100644
--- a/ldap/servers/slapd/libglobs.c
+++ b/ldap/servers/slapd/libglobs.c
@@ -5671,7 +5671,7 @@ config_set(const char *attr, struct berval **values, char *errorbuf, int apply)
 #endif
 		PR_snprintf ( errorbuf, SLAPI_DSE_RETURNTEXT_SIZE, "Unknown attribute %s will be ignored", attr);
 		slapi_log_error(SLAPI_LOG_FATAL, "config", "%s\n", errorbuf);
-		return retval;
+		return LDAP_NO_SUCH_ATTRIBUTE;
 	}
 
 	switch (cgas->config_var_type)




More information about the 389-commits mailing list