]> git.sur5r.net Git - openldap/commitdiff
slapd API update
authorHoward Chu <hyc@openldap.org>
Mon, 31 Mar 2003 23:19:12 +0000 (23:19 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 31 Mar 2003 23:19:12 +0000 (23:19 +0000)
servers/slapd/back-perl/add.c
servers/slapd/back-perl/bind.c
servers/slapd/back-perl/compare.c
servers/slapd/back-perl/delete.c
servers/slapd/back-perl/modify.c
servers/slapd/back-perl/modrdn.c
servers/slapd/back-perl/search.c

index c4a54ef5fcd8c26a0f13d269fa6987fff54456a4..740b2969558c98e6ab48e4815077c7d348eb28a3 100644 (file)
 
 int
 perl_back_add(
-       Backend *be,
-       Connection      *conn,
        Operation       *op,
-       Entry   *e
-)
+       SlapReply       *rs )
 {
+       PerlBackend *perl_back = (PerlBackend *) op->o_bd->be_private;
        int len;
        int count;
-       int return_code;
-
-       PerlBackend *perl_back = (PerlBackend *) be->be_private;
 
        ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
        ldap_pvt_thread_mutex_lock( &entry2str_mutex );
@@ -45,7 +40,7 @@ perl_back_add(
 
                PUSHMARK(sp);
                XPUSHs( perl_back->pb_obj_ref );
-               XPUSHs(sv_2mortal(newSVpv( entry2str( e, &len ), 0 )));
+               XPUSHs(sv_2mortal(newSVpv( entry2str( op->ora_e, &len ), 0 )));
 
                PUTBACK;
 
@@ -61,7 +56,7 @@ perl_back_add(
                        croak("Big trouble in back_add\n");
                }
                                                         
-               return_code = POPi;
+               rs->sr_err = POPi;
 
                PUTBACK; FREETMPS; LEAVE;
        }
@@ -69,8 +64,7 @@ perl_back_add(
        ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
        ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );        
 
-       send_ldap_result( conn, op, return_code,
-               NULL, NULL, NULL, NULL );
+       send_ldap_result( op, rs );
 
        Debug( LDAP_DEBUG_ANY, "Perl ADD\n", 0, 0, 0 );
        return( 0 );
index 755a1329b9597a902562798df3818593d6bcd5f4..e6dce15893de5290ae512a09353fc634f4f82aa6 100644 (file)
  **********************************************************/
 int
 perl_back_bind(
-       Backend *be,
-       Connection *conn,
        Operation *op,
-       struct berval *dn,
-       struct berval *ndn,
-       int method,
-       struct berval *cred,
-       struct berval *edn
-)
+       SlapReply *rs )
 {
-       int return_code;
        int count;
 
-       PerlBackend *perl_back = (PerlBackend *) be->be_private;
+       PerlBackend *perl_back = (PerlBackend *) op->o_bd->be_private;
 
 #ifdef HAVE_WIN32_ASPERL
        PERL_SET_CONTEXT( PERL_INTERPRETER );
@@ -58,8 +50,8 @@ perl_back_bind(
 
                PUSHMARK(SP);
                XPUSHs( perl_back->pb_obj_ref );
-               XPUSHs(sv_2mortal(newSVpv( dn->bv_val , 0)));
-               XPUSHs(sv_2mortal(newSVpv( cred->bv_val , cred->bv_len)));
+               XPUSHs(sv_2mortal(newSVpv( op->o_req_dn.bv_val , 0)));
+               XPUSHs(sv_2mortal(newSVpv( op->orb_cred.bv_val , op->orb_cred.bv_len)));
                PUTBACK;
 
 #ifdef PERL_IS_5_6
@@ -74,7 +66,7 @@ perl_back_bind(
                        croak("Big trouble in back_bind\n");
                }
 
-               return_code = POPi;
+               rs->sr_err = POPi;
                                                         
 
                PUTBACK; FREETMPS; LEAVE;
@@ -82,11 +74,11 @@ perl_back_bind(
 
        ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );        
 
-       Debug( LDAP_DEBUG_ANY, "Perl BIND returned 0x%04x\n", return_code, 0, 0 );
+       Debug( LDAP_DEBUG_ANY, "Perl BIND returned 0x%04x\n", rs->sr_err, 0, 0 );
 
        /* frontend will send result on success (0) */
-       if( return_code != LDAP_SUCCESS )
-               send_ldap_result( conn, op, return_code, NULL, NULL, NULL, NULL );
+       if( rs->sr_err != LDAP_SUCCESS )
+               send_ldap_result( op, rs );
 
-       return ( return_code );
+       return ( rs->sr_err );
 }
index 41e2299103709266ddc44eca00a565a057f901fd..e03c486cd55d989560df1cf3e8d9da0e5867f04e 100644 (file)
 
 int
 perl_back_compare(
-       Backend *be,
-       Connection      *conn,
        Operation       *op,
-       struct berval   *dn,
-       struct berval   *ndn,
-       AttributeAssertion              *ava
-)
+       SlapReply       *rs )
 {
-       int return_code;
        int count;
        char *avastr, *ptr;
 
-       PerlBackend *perl_back = (PerlBackend *)be->be_private;
+       PerlBackend *perl_back = (PerlBackend *)op->o_bd->be_private;
 
-       avastr = ch_malloc( ava->aa_desc->ad_cname.bv_len + 1 +
-               ava->aa_value.bv_len + 1 );
+       avastr = ch_malloc( op->orc_ava->aa_desc->ad_cname.bv_len + 1 +
+               op->orc_ava->aa_value.bv_len + 1 );
        
        lutil_strcopy( lutil_strcopy( lutil_strcopy( avastr,
-               ava->aa_desc->ad_cname.bv_val ), "=" ),
-               ava->aa_value.bv_val );
+               op->orc_ava->aa_desc->ad_cname.bv_val ), "=" ),
+               op->orc_ava->aa_value.bv_val );
 
        ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );  
 
@@ -59,7 +53,7 @@ perl_back_compare(
 
                PUSHMARK(sp);
                XPUSHs( perl_back->pb_obj_ref );
-               XPUSHs(sv_2mortal(newSVpv( dn->bv_val , 0)));
+               XPUSHs(sv_2mortal(newSVpv( op->o_req_dn.bv_val , 0)));
                XPUSHs(sv_2mortal(newSVpv( avastr , 0)));
                PUTBACK;
 
@@ -75,8 +69,8 @@ perl_back_compare(
                        croak("Big trouble in back_compare\n");
                }
 
-               return_code = POPi;
-                                                        
+               rs->sr_err = POPi;
+
                PUTBACK; FREETMPS; LEAVE;
        }
 
@@ -84,8 +78,7 @@ perl_back_compare(
 
        ch_free( avastr );
 
-       send_ldap_result( conn, op, return_code,
-               NULL, NULL, NULL, NULL );
+       send_ldap_result( op, rs );
 
        Debug( LDAP_DEBUG_ANY, "Perl COMPARE\n", 0, 0, 0 );
 
index e07d3abf18368a932dec48537ef713f49a341f52..74531fde271f35a1cbcb34e204f68fbd747ca5c3 100644 (file)
 
 int
 perl_back_delete(
-       Backend *be,
-       Connection      *conn,
        Operation       *op,
-       struct berval   *dn,
-       struct berval   *ndn
-)
+       SlapReply       *rs )
 {
-       int len;
+       PerlBackend *perl_back = (PerlBackend *) op->o_bd->be_private;
        int count;
-       int return_code;
-
-       PerlBackend *perl_back = (PerlBackend *) be->be_private;
 
        ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );  
 
@@ -45,7 +38,7 @@ perl_back_delete(
 
                PUSHMARK(sp);
                XPUSHs( perl_back->pb_obj_ref );
-               XPUSHs(sv_2mortal(newSVpv( dn->bv_val , 0 )));
+               XPUSHs(sv_2mortal(newSVpv( op->o_req_dn.bv_val , 0 )));
 
                PUTBACK;
 
@@ -60,16 +53,15 @@ perl_back_delete(
                if (count != 1) {
                        croak("Big trouble in perl-back_delete\n");
                }
-                                                        
-               return_code = POPi;
+
+               rs->sr_err = POPi;
 
                PUTBACK; FREETMPS; LEAVE;
        }
 
        ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );        
 
-       send_ldap_result( conn, op, return_code,
-                       NULL, NULL, NULL, NULL );
+       send_ldap_result( op, rs );
 
        Debug( LDAP_DEBUG_ANY, "Perl DELETE\n", 0, 0, 0 );
        return( 0 );
index 5d13518fe67ebddb0fdb59c921237b234da372f2..17b0597305ef319040d7481d063f0cb486e2de13 100644 (file)
 
 int
 perl_back_modify(
-       Backend *be,
-       Connection      *conn,
        Operation       *op,
-       struct berval   *dn,
-       struct berval   *ndn,
-       Modifications   *modlist
-)
+       SlapReply       *rs )
 {
-       char test[500];
-       int return_code;
+       PerlBackend *perl_back = (PerlBackend *)op->o_bd->be_private;
+       Modifications *modlist = op->orm_modlist;
        int count;
        int i;
-       int err = 0;
-       char *matched = NULL, *info = NULL;
 
-       PerlBackend *perl_back = (PerlBackend *)be->be_private;
 
        ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );  
 
@@ -49,7 +41,7 @@ perl_back_modify(
                
                PUSHMARK(sp);
                XPUSHs( perl_back->pb_obj_ref );
-               XPUSHs(sv_2mortal(newSVpv( dn->bv_val , 0)));
+               XPUSHs(sv_2mortal(newSVpv( op->o_req_dn.bv_val , 0)));
 
                for (; modlist != NULL; modlist = modlist->sml_next ) {
                        Modification *mods = &modlist->sml_mod;
@@ -93,15 +85,14 @@ perl_back_modify(
                        croak("Big trouble in back_modify\n");
                }
                                                         
-               return_code = POPi;
+               rs->sr_err = POPi;
 
                PUTBACK; FREETMPS; LEAVE;
        }
 
        ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
 
-       send_ldap_result( conn, op, return_code,
-               NULL, NULL, NULL, NULL );
+       send_ldap_result( op, rs );
 
        Debug( LDAP_DEBUG_ANY, "Perl MODIFY\n", 0, 0, 0 );
        return( 0 );
index 32db575665b898aab01540d95a1e1b870dcd77b8..c167018e5fd2b2c07a1a138824f3dfd23da75bb0 100644 (file)
 
 int
 perl_back_modrdn(
-       Backend *be,
-       Connection      *conn,
        Operation       *op,
-       struct berval   *dn,
-       struct berval   *ndn,
-       struct berval   *newrdn,
-       struct berval   *nnewrdn,
-       int             deleteoldrdn,
-       struct berval   *newSuperior,
-       struct berval   *nnewSuperior
-)
+       SlapReply       *rs )
 {
-       int len;
+       PerlBackend *perl_back = (PerlBackend *) op->o_bd->be_private;
        int count;
-       int return_code;
-
-       PerlBackend *perl_back = (PerlBackend *) be->be_private;
 
        ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );  
 
@@ -63,11 +51,11 @@ perl_back_modrdn(
                
                PUSHMARK(sp) ;
                XPUSHs( perl_back->pb_obj_ref );
-               XPUSHs(sv_2mortal(newSVpv( dn->bv_val , 0 )));
-               XPUSHs(sv_2mortal(newSVpv( newrdn->bv_val , 0 )));
-               XPUSHs(sv_2mortal(newSViv( deleteoldrdn )));
-               if ( newSuperior != NULL ) {
-                       XPUSHs(sv_2mortal(newSVpv( newSuperior->bv_val , 0 )));
+               XPUSHs(sv_2mortal(newSVpv( op->o_req_dn.bv_val , 0 )));
+               XPUSHs(sv_2mortal(newSVpv( op->orr_newrdn.bv_val , 0 )));
+               XPUSHs(sv_2mortal(newSViv( op->orr_deleteoldrdn )));
+               if ( op->orr_newSup != NULL ) {
+                       XPUSHs(sv_2mortal(newSVpv( op->orr_newSup->bv_val , 0 )));
                }
                PUTBACK ;
 
@@ -83,15 +71,14 @@ perl_back_modrdn(
                        croak("Big trouble in back_modrdn\n") ;
                }
                                                         
-               return_code = POPi;
+               rs->sr_err = POPi;
 
                PUTBACK; FREETMPS; LEAVE ;
        }
 
        ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );
        
-       send_ldap_result( conn, op, return_code,
-               NULL, NULL, NULL, NULL );
+       send_ldap_result( op, rs );
 
        Debug( LDAP_DEBUG_ANY, "Perl MODRDN\n", 0, 0, 0 );
        return( 0 );
index dea77e5b089f849fefd425f5819db52438fe1d60..176b6fb69759357b73d313564fd28ee069e7f680 100644 (file)
  **********************************************************/
 int
 perl_back_search(
-       Backend *be,
-       Connection *conn,
        Operation *op,
-       struct berval *base,
-       struct berval *nbase,
-       int scope,
-       int deref,
-       int sizelimit,
-       int timelimit,
-       Filter *filter,
-       struct berval *filterstr,
-       AttributeName *attrs,
-       int attrsonly
-       )
+       SlapReply *rs )
 {
-       char test[500];
+       PerlBackend *perl_back = (PerlBackend *)op->o_bd->be_private;
        int count ;
-       int err = 0;
-       char *matched = NULL, *info = NULL;
-       PerlBackend *perl_back = (PerlBackend *)be->be_private;
        AttributeName *an;
        Entry   *e;
        char *buf;
        int i;
-       int return_code;
 
        ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );  
 
@@ -63,15 +47,15 @@ perl_back_search(
 
                PUSHMARK(sp) ;
                XPUSHs( perl_back->pb_obj_ref );
-               XPUSHs(sv_2mortal(newSVpv( nbase->bv_val , 0)));
-               XPUSHs(sv_2mortal(newSViv( scope )));
-               XPUSHs(sv_2mortal(newSViv( deref )));
-               XPUSHs(sv_2mortal(newSViv( sizelimit )));
-               XPUSHs(sv_2mortal(newSViv( timelimit )));
-               XPUSHs(sv_2mortal(newSVpv( filterstr->bv_val , 0)));
-               XPUSHs(sv_2mortal(newSViv( attrsonly )));
-
-               for ( an = attrs; an && an->an_name.bv_val; an++ ) {
+               XPUSHs(sv_2mortal(newSVpv( op->o_req_ndn.bv_val , 0)));
+               XPUSHs(sv_2mortal(newSViv( op->ors_scope )));
+               XPUSHs(sv_2mortal(newSViv( op->ors_deref )));
+               XPUSHs(sv_2mortal(newSViv( op->ors_slimit )));
+               XPUSHs(sv_2mortal(newSViv( op->ors_tlimit )));
+               XPUSHs(sv_2mortal(newSVpv( op->ors_filterstr.bv_val , 0)));
+               XPUSHs(sv_2mortal(newSViv( op->ors_attrsonly )));
+
+               for ( an = op->ors_attrs; an && an->an_name.bv_val; an++ ) {
                        XPUSHs(sv_2mortal(newSVpv( an->an_name.bv_val , 0)));
                }
                PUTBACK;
@@ -101,13 +85,14 @@ perl_back_search(
                                        int send_entry;
 
                                        if (perl_back->pb_filter_search_results)
-                                               send_entry = (test_filter( be, conn, op, e, filter ) == LDAP_COMPARE_TRUE);
+                                               send_entry = (test_filter( op, e, op->ors_filter ) == LDAP_COMPARE_TRUE);
                                        else
                                                send_entry = 1;
 
                                        if (send_entry) {
-                                               send_search_entry( be, conn, op,
-                                                       e, attrs, attrsonly, NULL );
+                                               rs->sr_entry = e;
+                                               rs->sr_attrs = op->ors_attrs;
+                                               send_search_entry( op, rs );
                                        }
 
                                        entry_free( e );
@@ -124,7 +109,7 @@ perl_back_search(
                 * ex stack: <$res_2> <$res_1> <0>
                 */
 
-               return_code = POPi;
+               rs->sr_err = POPi;
 
 
 
@@ -133,8 +118,7 @@ perl_back_search(
 
        ldap_pvt_thread_mutex_unlock( &perl_interpreter_mutex );        
 
-       send_ldap_result( conn, op, return_code,
-               NULL, NULL, NULL, NULL );
+       send_ldap_result( op, rs );
 
        return 0;
 }