From: Luke Howard Date: Fri, 26 Sep 2003 17:10:03 +0000 (+0000) Subject: Implementation of slapi_send_ldap_search_reference() X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~649 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a57956ac0f178a22341aa92711bfe92229482cf2;p=openldap Implementation of slapi_send_ldap_search_reference() --- diff --git a/servers/slapd/slapi/proto-slapi.h b/servers/slapd/slapi/proto-slapi.h index f607a17d63..9d330d91df 100644 --- a/servers/slapd/slapi/proto-slapi.h +++ b/servers/slapd/slapi/proto-slapi.h @@ -165,6 +165,9 @@ extern int slapi_send_ldap_extended_response(Connection *conn, Operation *op, int errornum, char *respName, struct berval *response); extern int slapi_send_ldap_search_entry( Slapi_PBlock *pb, Slapi_Entry *e, LDAPControl **ectrls, char **attrs, int attrsonly ); +extern int slapi_send_ldap_search_reference( Slapi_PBlock *pb, Slapi_Entry *e, + struct berval **references, LDAPControl **ectrls, struct berval **v2refs ); + extern void slapi_register_supported_control(char *controloid, unsigned long controlops); extern int slapi_get_supported_controls(char ***ctrloidsp, unsigned long **ctrlopsp); diff --git a/servers/slapd/slapi/slapi_utils.c b/servers/slapd/slapi/slapi_utils.c index ab531019eb..8d3d735e16 100644 --- a/servers/slapd/slapi/slapi_utils.c +++ b/servers/slapd/slapi/slapi_utils.c @@ -1442,6 +1442,60 @@ slapi_send_ldap_search_entry( #endif /* LDAP_SLAPI */ } +int +slapi_send_ldap_search_reference( + Slapi_PBlock *pb, + Slapi_Entry *e, + struct berval **references, + LDAPControl **ectrls, + struct berval **v2refs + ) +{ +#ifdef LDAP_SLAPI + Operation *pOp; + SlapReply rs = { REP_SEARCHREF }; + int rc; + + rs.sr_err = LDAP_SUCCESS; + rs.sr_matched = NULL; + rs.sr_text = NULL; + + rc = bvptr2obj( references, &rs.sr_ref ); + if ( rc != LDAP_SUCCESS ) { + return rc; + } + + rs.sr_ctrls = ectrls; + rs.sr_attrs = NULL; + rs.sr_entry = e; + + if ( v2refs != NULL ) { + rc = bvptr2obj( v2refs, &rs.sr_v2ref ); + if ( rc != LDAP_SUCCESS ) { + slapi_ch_free( (void **)&rs.sr_ref ); + return rc; + } + } else { + rs.sr_v2ref = NULL; + } + + if ( slapi_pblock_get( pb, SLAPI_OPERATION, (void *)&pOp ) != 0 ) { + return LDAP_OTHER; + } + + rc = send_search_reference( pOp, &rs ); + + if ( rs.sr_ref != NULL ) + slapi_ch_free( (void **)&rs.sr_ref ); + + if ( rs.sr_v2ref != NULL ) + slapi_ch_free( (void **)&rs.sr_v2ref ); + + return rc; +#else + return -1; +#endif /* LDAP_SLAPI */ +} Slapi_Filter * slapi_str2filter( char *str )