]> git.sur5r.net Git - openldap/commitdiff
Implementation of slapi_send_ldap_search_reference()
authorLuke Howard <lukeh@openldap.org>
Fri, 26 Sep 2003 17:10:03 +0000 (17:10 +0000)
committerLuke Howard <lukeh@openldap.org>
Fri, 26 Sep 2003 17:10:03 +0000 (17:10 +0000)
servers/slapd/slapi/proto-slapi.h
servers/slapd/slapi/slapi_utils.c

index f607a17d63a6f36b57277d2b5cb275747f652677..9d330d91dfa82b4c06bfe423dd13c7f857de7434 100644 (file)
@@ -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);
index ab531019eb8f49e79366c1b3f99a8b988aeb1fc5..8d3d735e16e9451729f2b4963b1f8b42fed5317e 100644 (file)
@@ -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 )