Browse Source

Ticket 413 - "Server is unwilling to perform" when running ldapmodify on nsds5ReplicaStripAttrs

Bug Description:  trying to set nsds5ReplicaStripAttrs yields an error 53

Fix Description:  Needed to check for this new attribute when in the agmtlist modify
                  callback.  When it doesn't recognize the attribute it returns error 53.

https://fedorahosted.org/389/ticket/413

Reviewed by: Richm(Thanks!)
Mark Reynolds 13 years ago
parent
commit
e86013506d

+ 1 - 0
ldap/servers/plugins/replication/repl5.h

@@ -358,6 +358,7 @@ int agmt_has_protocol(Repl_Agmt *agmt);
 PRBool agmt_is_enabled(Repl_Agmt *ra);
 int agmt_set_enabled_from_entry(Repl_Agmt *ra, Slapi_Entry *e);
 char **agmt_get_attrs_to_strip(Repl_Agmt *ra);
+int agmt_set_attrs_to_strip(Repl_Agmt *ra, Slapi_Entry *e);
 
 typedef struct replica Replica;
 

+ 24 - 0
ldap/servers/plugins/replication/repl5_agmt.c

@@ -2547,3 +2547,27 @@ agmt_get_attrs_to_strip(Repl_Agmt *ra)
 		return NULL;
 	}
 }
+
+int
+agmt_set_attrs_to_strip(Repl_Agmt *ra, Slapi_Entry *e)
+{
+    char *tmpstr = NULL;
+
+    PR_Lock(ra->lock);
+
+    tmpstr = slapi_entry_attr_get_charptr(e, type_nsds5ReplicaStripAttrs);
+    if (NULL != tmpstr){
+        if(ra->attrs_to_strip){
+            slapi_ch_array_free(&ra->attrs_to_strip);
+        }
+        ra->attrs_to_strip = slapi_str2charray_ext(tmpstr, " ", 0);
+        PR_Unlock(ra->lock);
+        prot_notify_agmt_changed(ra->protocol, ra->long_name);
+        slapi_ch_free_string(&tmpstr);
+        return 0;
+    }
+
+    PR_Unlock(ra->lock);
+
+    return -1;
+}

+ 9 - 0
ldap/servers/plugins/replication/repl5_agmtlist.c

@@ -499,6 +499,15 @@ agmtlist_modify_callback(Slapi_PBlock *pb, Slapi_Entry *entryBefore, Slapi_Entry
                 rc = SLAPI_DSE_CALLBACK_ERROR;
             }
         }
+        else if (slapi_attr_types_equivalent(mods[i]->mod_type, type_nsds5ReplicaStripAttrs))
+        {
+            if(agmt_set_attrs_to_strip(agmt, e) != 0){
+                slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "agmtlist_modify_callback: "
+                    "failed to set replica agmt attributes to strip for %s\n",agmt_get_long_name(agmt));
+                *returncode = LDAP_OPERATIONS_ERROR;
+                rc = SLAPI_DSE_CALLBACK_ERROR;
+            }
+        }
         else if (0 == windows_handle_modify_agreement(agmt, mods[i]->mod_type, e))
         {
             slapi_log_error(SLAPI_LOG_REPL, repl_plugin_name, "agmtlist_modify_callback: "