From d174f6720ab1b24a1a1d0f0a7468c531cd304032 Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Wed, 17 Aug 2005 07:25:27 +0000 Subject: [PATCH] Add read-only SLAPI_X_ADD_STRUCTURAL_CLASS pblock extension. 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 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/servers/slapd/slapi/slapi_pblock.c b/servers/slapd/slapi/slapi_pblock.c index 1b4e5dab56..fa99303b0a 100644 --- a/servers/slapd/slapi/slapi_pblock.c +++ b/servers/slapd/slapi/slapi_pblock.c @@ -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; -- 2.39.5