mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
remove more unnecessary args
This commit is contained in:
parent
a9339c99f6
commit
dfbbd11bd3
@ -184,7 +184,7 @@ ldap_back_add(
|
||||
free( mdn.bv_val );
|
||||
}
|
||||
|
||||
return( ldap_back_op_result( li, lc, op, rs, msgid, j, 1 ) );
|
||||
return( ldap_back_op_result( lc, op, rs, msgid, j, 1 ) );
|
||||
}
|
||||
|
||||
#ifdef ENABLE_REWRITE
|
||||
|
@ -94,8 +94,8 @@ struct ldapinfo {
|
||||
struct ldapconn *ldap_back_getconn(struct slap_op *op, struct slap_rep *rs);
|
||||
int ldap_back_dobind(struct ldapconn *lc, Operation *op, SlapReply *rs);
|
||||
int ldap_back_map_result(int err);
|
||||
int ldap_back_op_result(struct ldapinfo *li, struct ldapconn *lc,
|
||||
Operation *op, SlapReply *rs, ber_int_t msgid, int rc, int sendok);
|
||||
int ldap_back_op_result(struct ldapconn *lc, Operation *op, SlapReply *rs,
|
||||
ber_int_t msgid, int rc, int sendok);
|
||||
int back_ldap_LTX_init_module(int argc, char *argv[]);
|
||||
|
||||
void ldap_back_dn_massage(struct ldapinfo *li, struct berval *dn,
|
||||
|
@ -115,7 +115,7 @@ ldap_back_bind(
|
||||
/* method is always LDAP_AUTH_SIMPLE if we got here */
|
||||
rc = ldap_sasl_bind(lc->ld, mdn.bv_val, LDAP_SASL_SIMPLE,
|
||||
&op->oq_bind.rb_cred, op->o_ctrls, NULL, &msgid);
|
||||
rc = ldap_back_op_result( li, lc, op, rs, msgid, rc, 1 );
|
||||
rc = ldap_back_op_result( lc, op, rs, msgid, rc, 1 );
|
||||
if (rc == LDAP_SUCCESS) {
|
||||
lc->bound = 1;
|
||||
if ( mdn.bv_val != op->o_req_dn.bv_val ) {
|
||||
@ -425,7 +425,6 @@ ldap_back_getconn(Operation *op, SlapReply *rs)
|
||||
int
|
||||
ldap_back_dobind( struct ldapconn *lc, Operation *op, SlapReply *rs )
|
||||
{
|
||||
struct ldapinfo *li = (struct ldapinfo *)op->o_bd->be_private;
|
||||
int rc;
|
||||
ber_int_t msgid;
|
||||
|
||||
@ -433,7 +432,7 @@ ldap_back_dobind( struct ldapconn *lc, Operation *op, SlapReply *rs )
|
||||
if ( !lc->bound ) {
|
||||
rc = ldap_sasl_bind(lc->ld, lc->bound_dn.bv_val,
|
||||
LDAP_SASL_SIMPLE, &lc->cred, NULL, NULL, &msgid);
|
||||
rc = ldap_back_op_result( li, lc, op, rs, msgid, rc, 0 );
|
||||
rc = ldap_back_op_result( lc, op, rs, msgid, rc, 0 );
|
||||
if (rc == LDAP_SUCCESS) {
|
||||
lc->bound = 1;
|
||||
}
|
||||
@ -506,9 +505,10 @@ ldap_back_map_result(int err)
|
||||
}
|
||||
|
||||
int
|
||||
ldap_back_op_result(struct ldapinfo *li, struct ldapconn *lc,
|
||||
Operation *op, SlapReply *rs, ber_int_t msgid, int err, int sendok)
|
||||
ldap_back_op_result(struct ldapconn *lc, Operation *op, SlapReply *rs,
|
||||
ber_int_t msgid, int err, int sendok)
|
||||
{
|
||||
struct ldapinfo *li = (struct ldapinfo *)op->o_bd->be_private;
|
||||
char *match = NULL;
|
||||
LDAPMessage *res;
|
||||
int rc;
|
||||
|
@ -119,5 +119,5 @@ ldap_back_compare(
|
||||
free( mdn.bv_val );
|
||||
}
|
||||
|
||||
return( ldap_back_op_result( li, lc, op, rs, msgid, rc, 1 ) );
|
||||
return( ldap_back_op_result( lc, op, rs, msgid, rc, 1 ) );
|
||||
}
|
||||
|
@ -101,5 +101,5 @@ ldap_back_delete(
|
||||
free( mdn.bv_val );
|
||||
}
|
||||
|
||||
return( ldap_back_op_result( li, lc, op, rs, msgid, rc, 1 ) );
|
||||
return( ldap_back_op_result( lc, op, rs, msgid, rc, 1 ) );
|
||||
}
|
||||
|
@ -166,6 +166,6 @@ cleanup:;
|
||||
ch_free( mods );
|
||||
ch_free( modv );
|
||||
|
||||
return ldap_back_op_result( li, lc, op, rs, msgid, rc, 1 );
|
||||
return ldap_back_op_result( lc, op, rs, msgid, rc, 1 );
|
||||
}
|
||||
|
||||
|
@ -148,5 +148,5 @@ ldap_back_modrdn(
|
||||
free( mnewSuperior.bv_val );
|
||||
}
|
||||
|
||||
return( ldap_back_op_result( li, lc, op, rs, msgid, rc, 1 ) );
|
||||
return( ldap_back_op_result( lc, op, rs, msgid, rc, 1 ) );
|
||||
}
|
||||
|
@ -148,6 +148,8 @@ ldap_back_search(
|
||||
case REWRITE_REGEXEC_OK:
|
||||
if ( mbase.bv_val == NULL ) {
|
||||
mbase = op->o_req_dn;
|
||||
} else {
|
||||
mbase.bv_len = strlen( mbase.bv_val );
|
||||
}
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( BACK_LDAP, DETAIL1,
|
||||
@ -205,7 +207,7 @@ ldap_back_search(
|
||||
: NULL, op->oq_search.rs_slimit, &msgid);
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
fail:;
|
||||
rc = ldap_back_op_result(li, lc, op, rs, msgid, rc, 0);
|
||||
rc = ldap_back_op_result(lc, op, rs, msgid, rc, 0);
|
||||
goto finish;
|
||||
}
|
||||
|
||||
@ -389,6 +391,10 @@ ldap_build_entry(
|
||||
struct berval *bv;
|
||||
const char *text;
|
||||
|
||||
/* safe assumptions ... */
|
||||
assert( ent );
|
||||
ent->e_bv.bv_val = NULL;
|
||||
|
||||
if ( ber_scanf( &ber, "{m{", bdn ) == LBER_ERROR ) {
|
||||
return LDAP_DECODING_ERROR;
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ meta_back_add( Operation *op, SlapReply *rs )
|
||||
/*
|
||||
* get the current connection
|
||||
*/
|
||||
lc = meta_back_getconn( li, op, rs, META_OP_REQUIRE_SINGLE,
|
||||
lc = meta_back_getconn( op, rs, META_OP_REQUIRE_SINGLE,
|
||||
&op->o_req_ndn, &candidate );
|
||||
if ( !lc ) {
|
||||
send_ldap_result( op, rs );
|
||||
|
@ -165,7 +165,6 @@ struct metainfo {
|
||||
#define META_OP_REQUIRE_ALL 0x02
|
||||
extern struct metaconn *
|
||||
meta_back_getconn(
|
||||
struct metainfo *li,
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
int op_type,
|
||||
|
@ -81,28 +81,13 @@ static LDAP_REBIND_PROC meta_back_rebind;
|
||||
|
||||
static int
|
||||
meta_back_do_single_bind(
|
||||
struct metainfo *li,
|
||||
struct metaconn *lc,
|
||||
Operation *op,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
struct berval *cred,
|
||||
int method,
|
||||
int candidate
|
||||
);
|
||||
|
||||
int
|
||||
meta_back_bind( Operation *op, SlapReply *rs )
|
||||
/*
|
||||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
struct berval *edn
|
||||
) */
|
||||
{
|
||||
struct metainfo *li = ( struct metainfo * )op->o_bd->be_private;
|
||||
struct metaconn *lc;
|
||||
@ -111,11 +96,6 @@ meta_back_bind( Operation *op, SlapReply *rs )
|
||||
int op_type = META_OP_ALLOW_MULTIPLE;
|
||||
int err = LDAP_SUCCESS;
|
||||
|
||||
struct berval *realdn = &op->o_req_dn;
|
||||
struct berval *realndn = &op->o_req_ndn;
|
||||
struct berval *realcred = &op->oq_bind.rb_cred;
|
||||
int realmethod = op->oq_bind.rb_method;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( BACK_META, ENTRY, "meta_back_bind: dn: %s.\n",
|
||||
op->o_req_dn.bv_val, 0, 0 );
|
||||
@ -129,7 +109,7 @@ meta_back_bind( Operation *op, SlapReply *rs )
|
||||
ber_dupbv( &op->oq_bind.rb_edn, be_root_dn( op->o_bd ) );
|
||||
op_type = META_OP_REQUIRE_ALL;
|
||||
}
|
||||
lc = meta_back_getconn( li, op, rs, op_type,
|
||||
lc = meta_back_getconn( op, rs, op_type,
|
||||
&op->o_req_ndn, NULL );
|
||||
if ( !lc ) {
|
||||
#ifdef NEW_LOGGING
|
||||
@ -151,7 +131,12 @@ meta_back_bind( Operation *op, SlapReply *rs )
|
||||
lc->bound_target = META_BOUND_NONE;
|
||||
ndnlen = op->o_req_ndn.bv_len;
|
||||
for ( i = 0; i < li->ntargets; i++ ) {
|
||||
int lerr;
|
||||
int lerr;
|
||||
struct berval orig_dn = op->o_req_dn;
|
||||
struct berval orig_ndn = op->o_req_ndn;
|
||||
struct berval orig_cred = op->oq_bind.rb_cred;
|
||||
int orig_method = op->oq_bind.rb_method;
|
||||
|
||||
|
||||
/*
|
||||
* Skip non-candidates
|
||||
@ -182,25 +167,24 @@ meta_back_bind( Operation *op, SlapReply *rs )
|
||||
}
|
||||
|
||||
if ( isroot && li->targets[ i ]->pseudorootdn.bv_val != NULL ) {
|
||||
realdn = &li->targets[ i ]->pseudorootdn;
|
||||
realndn = &li->targets[ i ]->pseudorootdn;
|
||||
realcred = &li->targets[ i ]->pseudorootpw;
|
||||
realmethod = LDAP_AUTH_SIMPLE;
|
||||
} else {
|
||||
realdn = &op->o_req_dn;
|
||||
realndn = &op->o_req_ndn;
|
||||
realcred = &op->oq_bind.rb_cred;
|
||||
realmethod = op->oq_bind.rb_method;
|
||||
op->o_req_dn = li->targets[ i ]->pseudorootdn;
|
||||
op->o_req_ndn = li->targets[ i ]->pseudorootdn;
|
||||
op->oq_bind.rb_cred = li->targets[ i ]->pseudorootpw;
|
||||
op->oq_bind.rb_method = LDAP_AUTH_SIMPLE;
|
||||
}
|
||||
|
||||
lerr = meta_back_do_single_bind( li, lc, op,
|
||||
realdn, realndn, realcred, realmethod, i );
|
||||
lerr = meta_back_do_single_bind( lc, op, i );
|
||||
if ( lerr != LDAP_SUCCESS ) {
|
||||
err = lerr;
|
||||
( void )meta_clear_one_candidate( &lc->conns[ i ], 1 );
|
||||
} else {
|
||||
rc = LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
op->o_req_dn = orig_dn;
|
||||
op->o_req_ndn = orig_ndn;
|
||||
op->oq_bind.rb_cred = orig_cred;
|
||||
op->oq_bind.rb_method = orig_method;
|
||||
}
|
||||
|
||||
if ( isroot ) {
|
||||
@ -241,16 +225,12 @@ meta_back_bind( Operation *op, SlapReply *rs )
|
||||
*/
|
||||
static int
|
||||
meta_back_do_single_bind(
|
||||
struct metainfo *li,
|
||||
struct metaconn *lc,
|
||||
Operation *op,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
struct berval *cred,
|
||||
int method,
|
||||
int candidate
|
||||
)
|
||||
{
|
||||
struct metainfo *li = ( struct metainfo * )op->o_bd->be_private;
|
||||
struct berval mdn = { 0, NULL };
|
||||
int rc;
|
||||
ber_int_t msgid;
|
||||
@ -259,18 +239,22 @@ meta_back_do_single_bind(
|
||||
* Rewrite the bind dn if needed
|
||||
*/
|
||||
switch ( rewrite_session( li->targets[ candidate ]->rwinfo,
|
||||
"bindDn", dn->bv_val, lc->conn, &mdn.bv_val ) ) {
|
||||
"bindDn", op->o_req_dn.bv_val,
|
||||
lc->conn, &mdn.bv_val ) ) {
|
||||
case REWRITE_REGEXEC_OK:
|
||||
if ( mdn.bv_val == NULL ) {
|
||||
mdn = *dn;
|
||||
mdn = op->o_req_dn;
|
||||
} else {
|
||||
mdn.bv_len = strlen( mdn.bv_val );
|
||||
}
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG( BACK_META, DETAIL1,
|
||||
"[rw] bindDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn.bv_val, 0 );
|
||||
"[rw] bindDn: \"%s\" -> \"%s\"\n",
|
||||
op->o_req_dn.bv_val, mdn.bv_val, 0 );
|
||||
#else /* !NEW_LOGGING */
|
||||
Debug( LDAP_DEBUG_ARGS,
|
||||
"rw> bindDn: \"%s\" -> \"%s\"\n%s",
|
||||
dn->bv_val, mdn.bv_val, "" );
|
||||
op->o_req_dn.bv_val, mdn.bv_val, "" );
|
||||
#endif /* !NEW_LOGGING */
|
||||
break;
|
||||
|
||||
@ -291,33 +275,39 @@ meta_back_do_single_bind(
|
||||
}
|
||||
|
||||
rc = ldap_sasl_bind(lc->conns[ candidate ].ld, mdn.bv_val,
|
||||
LDAP_SASL_SIMPLE, cred, op->o_ctrls, NULL, &msgid);
|
||||
LDAP_SASL_SIMPLE, &op->oq_bind.rb_cred,
|
||||
op->o_ctrls, NULL, &msgid);
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
rc = ldap_back_map_result( rc );
|
||||
|
||||
} else {
|
||||
ber_dupbv( &lc->conns[ candidate ].bound_dn, dn );
|
||||
/*
|
||||
* FIXME: handle response!!!
|
||||
*/
|
||||
ber_dupbv( &lc->conns[ candidate ].bound_dn, &op->o_req_dn );
|
||||
lc->conns[ candidate ].bound = META_BOUND;
|
||||
lc->bound_target = candidate;
|
||||
|
||||
if ( li->savecred ) {
|
||||
if ( lc->conns[ candidate ].cred.bv_val )
|
||||
ch_free( lc->conns[ candidate ].cred.bv_val );
|
||||
ber_dupbv( &lc->conns[ candidate ].cred, cred );
|
||||
ber_dupbv( &lc->conns[ candidate ].cred,
|
||||
&op->oq_bind.rb_cred );
|
||||
ldap_set_rebind_proc( lc->conns[ candidate ].ld,
|
||||
meta_back_rebind,
|
||||
&lc->conns[ candidate ] );
|
||||
}
|
||||
|
||||
if ( li->cache.ttl != META_DNCACHE_DISABLED
|
||||
&& ndn->bv_len != 0 ) {
|
||||
&& op->o_req_ndn.bv_len != 0 ) {
|
||||
( void )meta_dncache_update_entry( &li->cache,
|
||||
ndn, candidate );
|
||||
&op->o_req_ndn, candidate );
|
||||
}
|
||||
}
|
||||
|
||||
return_results:;
|
||||
|
||||
if ( mdn.bv_val != dn->bv_val ) {
|
||||
if ( mdn.bv_val != op->o_req_dn.bv_val ) {
|
||||
free( mdn.bv_val );
|
||||
}
|
||||
|
||||
|
@ -1002,7 +1002,7 @@ metaConnect(
|
||||
{
|
||||
struct metaconn* lc;
|
||||
result->type = SUCCESS;
|
||||
lc = meta_back_getconn( li, conn, op, op_type, nbase, NULL );
|
||||
lc = meta_back_getconn( conn, op, op_type, nbase, NULL );
|
||||
if (!lc) {
|
||||
result->type = CONN_ERR;
|
||||
return 0;
|
||||
|
@ -86,7 +86,7 @@ meta_back_compare( Operation *op, SlapReply *rs )
|
||||
int cres = LDAP_SUCCESS, rres = LDAP_SUCCESS;
|
||||
int *msgid;
|
||||
|
||||
lc = meta_back_getconn( li, op, rs, META_OP_ALLOW_MULTIPLE,
|
||||
lc = meta_back_getconn( op, rs, META_OP_ALLOW_MULTIPLE,
|
||||
&op->o_req_ndn, NULL );
|
||||
if ( !lc ) {
|
||||
send_ldap_result( op, rs );
|
||||
|
@ -339,13 +339,13 @@ init_one_conn(
|
||||
*/
|
||||
struct metaconn *
|
||||
meta_back_getconn(
|
||||
struct metainfo *li,
|
||||
Operation *op,
|
||||
SlapReply *rs,
|
||||
int op_type,
|
||||
struct berval *ndn,
|
||||
int *candidate )
|
||||
{
|
||||
struct metainfo *li = ( struct metainfo * )op->o_bd->be_private;
|
||||
struct metaconn *lc, lc_curr;
|
||||
int cached = -1, i = -1, err = LDAP_SUCCESS;
|
||||
int new_conn = 0;
|
||||
|
@ -84,7 +84,7 @@ meta_back_delete( Operation *op, SlapReply *rs )
|
||||
|
||||
char *mdn = NULL;
|
||||
|
||||
lc = meta_back_getconn( li, op, rs, META_OP_REQUIRE_SINGLE,
|
||||
lc = meta_back_getconn( op, rs, META_OP_REQUIRE_SINGLE,
|
||||
&op->o_req_ndn, &candidate );
|
||||
if ( !lc ) {
|
||||
send_ldap_result( op, rs );
|
||||
|
@ -88,7 +88,7 @@ meta_back_modify( Operation *op, SlapReply *rs )
|
||||
char *mdn;
|
||||
struct berval mapped;
|
||||
|
||||
lc = meta_back_getconn( li, op, rs, META_OP_REQUIRE_SINGLE,
|
||||
lc = meta_back_getconn( op, rs, META_OP_REQUIRE_SINGLE,
|
||||
&op->o_req_ndn, &candidate );
|
||||
if ( !lc ) {
|
||||
rc = -1;
|
||||
|
@ -97,7 +97,7 @@ meta_back_modrdn( Operation *op, SlapReply *rs )
|
||||
char *mdn = NULL,
|
||||
*mnewSuperior = NULL;
|
||||
|
||||
lc = meta_back_getconn( li, op, rs, META_OP_REQUIRE_SINGLE,
|
||||
lc = meta_back_getconn( op, rs, META_OP_REQUIRE_SINGLE,
|
||||
&op->o_req_ndn, &candidate );
|
||||
if ( !lc ) {
|
||||
rc = -1;
|
||||
|
@ -136,7 +136,7 @@ meta_back_search( Operation *op, SlapReply *rs )
|
||||
* FIXME: in case of values return filter, we might want
|
||||
* to map attrs and maybe rewrite value
|
||||
*/
|
||||
lc = meta_back_getconn( li, op, rs, META_OP_ALLOW_MULTIPLE,
|
||||
lc = meta_back_getconn( op, rs, META_OP_ALLOW_MULTIPLE,
|
||||
&op->o_req_ndn, NULL );
|
||||
if ( !lc ) {
|
||||
send_ldap_result( op, rs );
|
||||
|
Loading…
Reference in New Issue
Block a user