Skip to content
Snippets Groups Projects
Commit 8357a8b6 authored by Howard Chu's avatar Howard Chu
Browse files

slapd API update

parent 5a136d7e
No related branches found
No related tags found
No related merge requests found
......@@ -25,17 +25,12 @@
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 );
......
......@@ -32,20 +32,12 @@
**********************************************************/
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 );
}
......@@ -31,26 +31,20 @@
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 );
......
......@@ -25,18 +25,11 @@
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 );
......
......@@ -25,22 +25,14 @@
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 );
......
......@@ -38,23 +38,11 @@
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 );
......
......@@ -30,31 +30,15 @@
**********************************************************/
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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment