more slapi cleanup

This commit is contained in:
Luke Howard 2005-07-23 13:21:28 +00:00
parent 35942c40ae
commit 69230b2b9f
3 changed files with 14 additions and 15 deletions

View File

@ -42,7 +42,7 @@ LDAP_SLAPI_F (int) slapi_int_access_allowed LDAP_P((Operation *op,
LDAP_SLAPI_F (char **) slapi_get_supported_extended_ops LDAP_P((void)); LDAP_SLAPI_F (char **) slapi_get_supported_extended_ops LDAP_P((void));
/* slapi_ops.c */ /* slapi_ops.c */
LDAP_SLAPI_F (int) slapi_int_connection_init LDAP_P((Slapi_PBlock *pb, SlapReply *rs, int OpType, Connection **pConn)); LDAP_SLAPI_F (int) slapi_int_connection_init LDAP_P((Slapi_PBlock *pb, int OpType, Connection **pConn));
LDAP_SLAPI_F (void) slapi_int_connection_destroy LDAP_P(( Connection **pConn )); LDAP_SLAPI_F (void) slapi_int_connection_destroy LDAP_P(( Connection **pConn ));
LDAP_SLAPI_F (int) slapi_int_response LDAP_P(( Slapi_Operation *op, SlapReply *rs )); LDAP_SLAPI_F (int) slapi_int_response LDAP_P(( Slapi_Operation *op, SlapReply *rs ));

View File

@ -176,10 +176,11 @@ slapi_int_response( Slapi_Operation *op, SlapReply *rs )
} }
static int static int
slapi_int_get_ctrls( Operation *op, SlapReply *rs, LDAPControl **controls ) slapi_int_get_ctrls( Operation *op, LDAPControl **controls )
{ {
LDAPControl **c; LDAPControl **c;
int rc; int rc;
SlapReply rs = { REP_RESULT };
op->o_ctrls = controls; op->o_ctrls = controls;
if ( op->o_ctrls == NULL ) { if ( op->o_ctrls == NULL ) {
@ -187,7 +188,7 @@ slapi_int_get_ctrls( Operation *op, SlapReply *rs, LDAPControl **controls )
} }
for ( c = op->o_ctrls; *c != NULL; c++ ) { for ( c = op->o_ctrls; *c != NULL; c++ ) {
rc = slap_parse_ctrl( op, rs, *c, &rs->sr_text ); rc = slap_parse_ctrl( op, &rs, *c, &rs.sr_text );
if ( rc != LDAP_SUCCESS ) if ( rc != LDAP_SUCCESS )
break; break;
} }
@ -259,7 +260,7 @@ slapi_int_pblock_get_connection( Slapi_PBlock *pb, Operation *op )
} }
static int static int
slapi_int_pblock_get_operation( Slapi_PBlock *pb, Operation *op, SlapReply *rs ) slapi_int_pblock_get_operation( Slapi_PBlock *pb, Operation *op )
{ {
int isRoot = 0; int isRoot = 0;
int isUpdateDn = 0; int isUpdateDn = 0;
@ -311,9 +312,9 @@ slapi_int_pblock_get_operation( Slapi_PBlock *pb, Operation *op, SlapReply *rs )
} }
slapi_pblock_get( pb, SLAPI_REQCONTROLS, (void **)&controls ); slapi_pblock_get( pb, SLAPI_REQCONTROLS, (void **)&controls );
rc = slapi_int_get_ctrls( op, rs, controls ); rc = slapi_int_get_ctrls( op, controls );
if ( rc != LDAP_SUCCESS ) { if ( rc != LDAP_SUCCESS ) {
return rs->sr_err; return rc;
} }
return LDAP_SUCCESS; return LDAP_SUCCESS;
@ -321,7 +322,6 @@ slapi_int_pblock_get_operation( Slapi_PBlock *pb, Operation *op, SlapReply *rs )
int int
slapi_int_connection_init( Slapi_PBlock *pb, slapi_int_connection_init( Slapi_PBlock *pb,
SlapReply *rs,
int OpType, int OpType,
Connection **pConn ) Connection **pConn )
{ {
@ -423,7 +423,7 @@ slapi_int_connection_init( Slapi_PBlock *pb,
op->o_conn = conn; op->o_conn = conn;
op->o_connid = conn->c_connid; op->o_connid = conn->c_connid;
rc = slapi_int_pblock_get_operation( pb, op, rs ); rc = slapi_int_pblock_get_operation( pb, op );
slapi_pblock_set( pb, SLAPI_OPERATION, op ); slapi_pblock_set( pb, SLAPI_OPERATION, op );
slapi_pblock_set( pb, SLAPI_CONNECTION, conn ); slapi_pblock_set( pb, SLAPI_CONNECTION, conn );
@ -483,7 +483,7 @@ slapi_delete_internal_pb( Slapi_PBlock *pb )
return -1; return -1;
} }
rs.sr_err = slapi_int_connection_init( pb, &rs, LDAP_REQ_DELETE, &conn ); rs.sr_err = slapi_int_connection_init( pb, LDAP_REQ_DELETE, &conn );
if ( rs.sr_err != LDAP_SUCCESS ) { if ( rs.sr_err != LDAP_SUCCESS ) {
slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err ); slapi_pblock_set( pb, SLAPI_PLUGIN_INTOP_RESULT, (void *)rs.sr_err );
return 0; return 0;
@ -535,7 +535,7 @@ slapi_add_internal_pb( Slapi_PBlock *pb )
goto cleanup; goto cleanup;
} }
rs.sr_err = slapi_int_connection_init( pb, &rs, LDAP_REQ_ADD, &conn ); rs.sr_err = slapi_int_connection_init( pb, LDAP_REQ_ADD, &conn );
if ( rs.sr_err != LDAP_SUCCESS ) { if ( rs.sr_err != LDAP_SUCCESS ) {
goto cleanup; goto cleanup;
} }
@ -625,7 +625,7 @@ slapi_modrdn_internal_pb( Slapi_PBlock *pb )
slapi_pblock_get( pb, SLAPI_MODRDN_NEWSUPERIOR, (void **)&newsuperior ); slapi_pblock_get( pb, SLAPI_MODRDN_NEWSUPERIOR, (void **)&newsuperior );
slapi_pblock_get( pb, SLAPI_MODRDN_DELOLDRDN, (void **)&deloldrdn ); slapi_pblock_get( pb, SLAPI_MODRDN_DELOLDRDN, (void **)&deloldrdn );
rs.sr_err = slapi_int_connection_init( pb, &rs, LDAP_REQ_MODRDN, &conn ); rs.sr_err = slapi_int_connection_init( pb, LDAP_REQ_MODRDN, &conn );
if ( rs.sr_err != LDAP_SUCCESS ) { if ( rs.sr_err != LDAP_SUCCESS ) {
goto cleanup; goto cleanup;
} }
@ -707,7 +707,7 @@ slapi_modify_internal_pb( Slapi_PBlock *pb )
goto cleanup; goto cleanup;
} }
rs.sr_err = slapi_int_connection_init( pb, &rs, LDAP_REQ_MODIFY, &conn ); rs.sr_err = slapi_int_connection_init( pb, LDAP_REQ_MODIFY, &conn );
if ( rs.sr_err != LDAP_SUCCESS ) { if ( rs.sr_err != LDAP_SUCCESS ) {
goto cleanup; goto cleanup;
} }
@ -832,7 +832,7 @@ slapi_search_internal_callback_pb( Slapi_PBlock *pb,
slapi_pblock_get( pb, SLAPI_SEARCH_ATTRS, (void **)&attrs ); slapi_pblock_get( pb, SLAPI_SEARCH_ATTRS, (void **)&attrs );
slapi_pblock_get( pb, SLAPI_SEARCH_ATTRSONLY, (void **)&attrsonly ); slapi_pblock_get( pb, SLAPI_SEARCH_ATTRSONLY, (void **)&attrsonly );
rs.sr_err = slapi_int_connection_init( pb, &rs, LDAP_REQ_SEARCH, &conn ); rs.sr_err = slapi_int_connection_init( pb, LDAP_REQ_SEARCH, &conn );
if ( rs.sr_err != LDAP_SUCCESS ) { if ( rs.sr_err != LDAP_SUCCESS ) {
goto cleanup; goto cleanup;
} }

View File

@ -538,13 +538,12 @@ slapi_entry_has_children(const Slapi_Entry *e)
int hasSubordinates = 0; int hasSubordinates = 0;
int rc; int rc;
Slapi_PBlock *pb; Slapi_PBlock *pb;
SlapReply rs = { REP_RESULT };
pb = slapi_pblock_new(); pb = slapi_pblock_new();
slapi_pblock_set( pb, SLAPI_TARGET_DN, slapi_entry_get_dn( (Entry *)e ) ); slapi_pblock_set( pb, SLAPI_TARGET_DN, slapi_entry_get_dn( (Entry *)e ) );
rc = slapi_int_connection_init( pb, &rs, LDAP_REQ_SEARCH, &conn ); rc = slapi_int_connection_init( pb, LDAP_REQ_SEARCH, &conn );
if ( rc != LDAP_SUCCESS ) { if ( rc != LDAP_SUCCESS ) {
slapi_pblock_destroy( pb ); slapi_pblock_destroy( pb );
return 0; return 0;