]> git.sur5r.net Git - openldap/commitdiff
Add read-only SLAPI_X_ADD_STRUCTURAL_CLASS pblock extension.
authorLuke Howard <lukeh@openldap.org>
Wed, 17 Aug 2005 07:25:27 +0000 (07:25 +0000)
committerLuke Howard <lukeh@openldap.org>
Wed, 17 Aug 2005 07:25:27 +0000 (07:25 +0000)
This is necessary to compensate for a regression in the SLAPI
implementation since it moved to an overlay: global add preop
plugins no longer have access to operational attributes,
because slap_mods_opattrs() is called by fe_op_add(), invoked
after the global SLAPI overlay.

(Some of our plugins need to the structural object class of the
to-be-added entry.)

I suppose an option would be to have the SLAPI overlay
optimistically call slap_mods_opattrs() (as long as this can be
called idempotently). If there are any other ideas let me know.

servers/slapd/slapi/slapi_pblock.c

index 1b4e5dab5621f1df9b535b7ec607195d104ba132..fa99303b0afc4a13e65137a1a251c029cc5f38f8 100644 (file)
@@ -277,6 +277,7 @@ pblock_get_param_class( int param )
        case SLAPI_X_GROUP_ATTRIBUTE:
        case SLAPI_X_GROUP_OPERATION_DN:
        case SLAPI_X_GROUP_TARGET_ENTRY:
+       case SLAPI_X_ADD_STRUCTURAL_CLASS:
        case SLAPI_PLUGIN_AUDIT_DATA:
        case SLAPI_IBM_PBLOCK:
        case SLAPI_PLUGIN_VERSION:
@@ -472,6 +473,20 @@ pblock_get( Slapi_PBlock *pb, int param, void **value )
                PBLOCK_ASSERT_OP( pb, 0 );
                *((int *)value) = get_no_schema_check( pb->pb_op );
                break;
+       case SLAPI_X_ADD_STRUCTURAL_CLASS:
+               PBLOCK_ASSERT_OP( pb, 0 );
+
+               if ( pb->pb_op->o_tag == LDAP_REQ_ADD ) {
+                       struct berval tmpval = BER_BVNULL;
+
+                       rc = mods_structural_class( pb->pb_op->ora_modlist,
+                               &tmpval, &pb->pb_rs->sr_text,
+                               pb->pb_textbuf, sizeof( pb->pb_textbuf ));
+                       *((char **)value) = tmpval.bv_val;
+               } else {
+                       rc = PBLOCK_ERROR;
+               }
+               break;
        case SLAPI_REQCONTROLS:
                PBLOCK_ASSERT_OP( pb, 0 );
                *((LDAPControl ***)value) = pb->pb_op->o_ctrls;
@@ -1203,6 +1218,7 @@ pblock_set( Slapi_PBlock *pb, int param, void *value )
        case SLAPI_X_CONN_CLIENTPATH:
        case SLAPI_CONN_SERVERIP:
        case SLAPI_X_CONN_SERVERPATH:
+       case SLAPI_X_ADD_STRUCTURAL_CLASS:
                /* These parameters cannot be set */
                rc = PBLOCK_ERROR;
                break;