mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
do not expose control until sssvlv overlay is actually instantiated at least once (ITS#6647)
This commit is contained in:
parent
1c5d78ec95
commit
85369497aa
@ -1158,6 +1158,38 @@ static int sssvlv_db_init(
|
||||
{
|
||||
slap_overinst *on = (slap_overinst *)be->bd_info;
|
||||
sssvlv_info *si;
|
||||
|
||||
if ( ov_count == 0 ) {
|
||||
int rc;
|
||||
|
||||
rc = register_supported_control2( LDAP_CONTROL_SORTREQUEST,
|
||||
SLAP_CTRL_SEARCH,
|
||||
NULL,
|
||||
sss_parseCtrl,
|
||||
1 /* replace */,
|
||||
&sss_cid );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "Failed to register Sort Request control '%s' (%d)\n",
|
||||
LDAP_CONTROL_SORTREQUEST, rc, 0 );
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = register_supported_control2( LDAP_CONTROL_VLVREQUEST,
|
||||
SLAP_CTRL_SEARCH,
|
||||
NULL,
|
||||
vlv_parseCtrl,
|
||||
1 /* replace */,
|
||||
&vlv_cid );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "Failed to register VLV Request control '%s' (%d)\n",
|
||||
LDAP_CONTROL_VLVREQUEST, rc, 0 );
|
||||
#ifdef SLAP_CONFIG_DELETE
|
||||
overlay_unregister_control( be, LDAP_CONTROL_SORTREQUEST );
|
||||
#endif /* SLAP_CONFIG_DELETE */
|
||||
unregister_supported_control( LDAP_CONTROL_SORTREQUEST );
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
si = (sssvlv_info *)ch_malloc(sizeof(sssvlv_info));
|
||||
on->on_bi.bi_private = si;
|
||||
@ -1195,6 +1227,9 @@ static int sssvlv_db_destroy(
|
||||
overlay_unregister_control( be, LDAP_CONTROL_SORTREQUEST );
|
||||
overlay_unregister_control( be, LDAP_CONTROL_VLVREQUEST );
|
||||
#endif /* SLAP_CONFIG_DELETE */
|
||||
if ( ov_count == 0 ) {
|
||||
unregister_supported_control( LDAP_CONTROL_SORTREQUEST );
|
||||
}
|
||||
|
||||
if ( si ) {
|
||||
ch_free( si );
|
||||
@ -1222,30 +1257,9 @@ int sssvlv_initialize()
|
||||
if ( rc )
|
||||
return rc;
|
||||
|
||||
rc = register_supported_control2( LDAP_CONTROL_SORTREQUEST,
|
||||
SLAP_CTRL_SEARCH,
|
||||
NULL,
|
||||
sss_parseCtrl,
|
||||
1 /* replace */,
|
||||
&sss_cid );
|
||||
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
rc = register_supported_control2( LDAP_CONTROL_VLVREQUEST,
|
||||
SLAP_CTRL_SEARCH,
|
||||
NULL,
|
||||
vlv_parseCtrl,
|
||||
1 /* replace */,
|
||||
&vlv_cid );
|
||||
}
|
||||
|
||||
if ( rc == LDAP_SUCCESS ) {
|
||||
rc = overlay_register( &sssvlv );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "Failed to register server side sort overlay\n", 0, 0, 0 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
Debug( LDAP_DEBUG_ANY, "Failed to register control %d\n", rc, 0, 0 );
|
||||
rc = overlay_register( &sssvlv );
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
Debug( LDAP_DEBUG_ANY, "Failed to register server side sort overlay\n", 0, 0, 0 );
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
Loading…
Reference in New Issue
Block a user