]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/add.c
Confusingly, make SLAPI_OPERATION_AUTHTYPE return a pointer to
[openldap] / servers / slapd / add.c
index 58a99bfa3a409c6795414d778df0eb69c62147b3..0c5ea86c52f4c7d65ee3bbe2fc8508772c0cce04 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
@@ -226,28 +226,28 @@ do_add( Connection *conn, Operation *op )
        }
 
 #if defined( LDAP_SLAPI )
-       slapi_pblock_set( pb, SLAPI_BACKEND, (void *)be );
-       slapi_pblock_set( pb, SLAPI_CONNECTION, (void *)conn );
-       slapi_pblock_set( pb, SLAPI_OPERATION, (void *)op );
+       slapi_x_backend_set_pb( pb, be );
+       slapi_x_connection_set_pb( pb, conn );
+       slapi_x_operation_set_pb( pb, op );
        slapi_pblock_set( pb, SLAPI_ADD_ENTRY, (void *)e );
        slapi_pblock_set( pb, SLAPI_ADD_TARGET, (void *)dn.bv_val );
        slapi_pblock_set( pb, SLAPI_MANAGEDSAIT, (void *)(1) );
-       slapi_pblock_set( pb, SLAPI_REQCONTROLS, (void *)op->o_ctrls );
 
        rc = doPluginFNs( be, SLAPI_PLUGIN_PRE_ADD_FN, pb );
-       if ( rc != 0 && rc != LDAP_OTHER ) {
+       if ( rc != 0 ) {
                /*
-                * either there is no preOp (add) plugins
-                * or a plugin failed. Just log it
-                * 
-                * FIXME: is this correct?
+                * A preoperation plugin failure will abort the
+                * entire operation.
                 */
 #ifdef NEW_LOGGING
-               LDAP_LOG( OPERATION, INFO, "do_add: add preOps failed\n",
+               LDAP_LOG( OPERATION, INFO, "do_add: add preoperation plugin failed\n",
                                0, 0, 0);
 #else
-               Debug(LDAP_DEBUG_TRACE, "do_add: add preOps failed.\n",
+               Debug(LDAP_DEBUG_TRACE, "do_add: add preoperation plugin failed.\n",
                                0, 0, 0);
+               if ( slapi_pblock_get( pb, SLAPI_RESULT_CODE, (void *)&rc ) != 0 )
+                       rc = LDAP_OTHER;
+               goto done;
 #endif
        }
 #endif /* defined( LDAP_SLAPI ) */
@@ -339,19 +339,16 @@ do_add( Connection *conn, Operation *op )
        }
 
 #if defined( LDAP_SLAPI )
-       rc = doPluginFNs( be, SLAPI_PLUGIN_POST_ADD_FN, pb );
-       if ( rc != 0 && rc != LDAP_OTHER ) {
-               /*
-                * either there is no postOp (Add) plugins
-                * or a plugin failed. Just log it
-                *
-                * FIXME: is this correct?
-                */
+       /*
+        * Postoperation errors are silently ignored; the work has
+        * been done.
+        */
+       if ( doPluginFNs( be, SLAPI_PLUGIN_POST_ADD_FN, pb ) != 0) {
 #ifdef NEW_LOGGING
-               LDAP_LOG( OPERATION, INFO, "do_add: Add postOps failed\n",
+               LDAP_LOG( OPERATION, INFO, "do_add: Add postoperation plugins failed\n",
                                0, 0, 0);
 #else
-               Debug(LDAP_DEBUG_TRACE, "do_add: Add postOps failed.\n",
+               Debug(LDAP_DEBUG_TRACE, "do_add: Add postoperation plugins failed.\n",
                                0, 0, 0);
 #endif
        }