瀏覽代碼

Ticket #48837 - Replication: total init aborted

Bug Description: Commit 2ecc93781abc786be6a8b8443faf2598a6c30f97 to fix
ticket 48822 broke the logic and forced plugin_call_exop_plugins to
return an error even if the underlying extended plugin were successful.

Fix Description:
In plugin_call_exop_plugins,
- this patch honours the return value from the plugins.
- LDAP_SUCCESS is translated to SLAPI_PLUGIN_EXTENDED_SENT_RESULT.

The extop plugin multimaster_extop_NSDS50ReplicationEntry is fixed to
return SLAPI_PLUGIN_EXTENDED_SENT_RESULT in the case of success.

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

Reviewed by [email protected] and [email protected] (Thank you, Ludwig and William!)
Noriko Hosoi 9 年之前
父節點
當前提交
e6ba94f61c
共有 2 個文件被更改,包括 12 次插入15 次删除
  1. 3 2
      ldap/servers/plugins/replication/repl5_total.c
  2. 9 13
      ldap/servers/slapd/plugin.c

+ 3 - 2
ldap/servers/plugins/replication/repl5_total.c

@@ -866,8 +866,7 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock  *pb)
 						rc, connid, opid);
 	}
    
-    if (rc != 0)
-    {
+    if (rc) {
         /* just disconnect from the supplier. bulk import is stopped when
            connection object is destroyed */
         slapi_pblock_get (pb, SLAPI_CONNECTION, &conn);
@@ -881,6 +880,8 @@ multimaster_extop_NSDS50ReplicationEntry(Slapi_PBlock  *pb)
         {
             slapi_entry_free (e);
         }
+    } else {
+        rc = SLAPI_PLUGIN_EXTENDED_SENT_RESULT;
     }
 
 	return rc;

+ 9 - 13
ldap/servers/slapd/plugin.c

@@ -527,23 +527,19 @@ plugin_determine_exop_plugins( const char *oid, struct slapdplugin **plugin)
 int
 plugin_call_exop_plugins( Slapi_PBlock *pb, struct slapdplugin *p )
 {
-    int rc = LDAP_SUCCESS;
-    int lderr = SLAPI_PLUGIN_EXTENDED_NOT_HANDLED;
-
+    int rc;
     slapi_pblock_set( pb, SLAPI_PLUGIN, p );
     set_db_default_result_handlers( pb );
-    if ( (rc = (*p->plg_exhandler)( pb )) == SLAPI_PLUGIN_EXTENDED_SENT_RESULT ) {
-        return( rc );   /* result sent */
-    } else if ( rc != SLAPI_PLUGIN_EXTENDED_NOT_HANDLED ) {
-        /*
-         * simple merge: report last real error
+    rc = (*p->plg_exhandler)( pb );
+    if (LDAP_SUCCESS == rc) { 
+        /* 
+         * Some plugin may return LDAP_SUCCESS in the success case.
+         * It is translated to SLAPI_PLUGIN_EXTENDED_SENT_RESULT to
+         * reduce the unnecessary error logs.
          */
-        if ( rc != LDAP_SUCCESS ) {
-            lderr = rc;
-        }
+        rc = SLAPI_PLUGIN_EXTENDED_SENT_RESULT;
     }
-
-    return( lderr );
+    return (rc);
 }