mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-26 17:49:59 -05:00
First pass at converting bind to struct bervals
This commit is contained in:
parent
29ffe05902
commit
d474789d0d
15 changed files with 96 additions and 119 deletions
|
|
@ -20,11 +20,11 @@ bdb_bind(
|
|||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
char** edn
|
||||
struct berval *edn
|
||||
)
|
||||
{
|
||||
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
|
||||
|
|
@ -40,12 +40,10 @@ bdb_bind(
|
|||
|
||||
AttributeDescription *password = slap_schema.si_ad_userPassword;
|
||||
|
||||
Debug( LDAP_DEBUG_ARGS, "==> bdb_bind: dn: %s\n", dn, 0, 0);
|
||||
|
||||
*edn = NULL;
|
||||
Debug( LDAP_DEBUG_ARGS, "==> bdb_bind: dn: %s\n", dn->bv_val, 0, 0);
|
||||
|
||||
/* get entry */
|
||||
rc = bdb_dn2entry( be, NULL, ndn, &e, &matched, 0 );
|
||||
rc = bdb_dn2entry( be, NULL, ndn->bv_val, &e, &matched, 0 );
|
||||
|
||||
switch(rc) {
|
||||
case DB_NOTFOUND:
|
||||
|
|
@ -67,7 +65,7 @@ bdb_bind(
|
|||
|
||||
refs = is_entry_referral( matched )
|
||||
? get_entry_referrals( be, conn, op, matched,
|
||||
dn, LDAP_SCOPE_DEFAULT )
|
||||
dn->bv_val, LDAP_SCOPE_DEFAULT )
|
||||
: NULL;
|
||||
|
||||
bdb_entry_return( be, matched );
|
||||
|
|
@ -75,14 +73,14 @@ bdb_bind(
|
|||
|
||||
} else {
|
||||
refs = referral_rewrite( default_referral,
|
||||
NULL, dn, LDAP_SCOPE_DEFAULT );
|
||||
NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
|
||||
}
|
||||
|
||||
/* allow noauth binds */
|
||||
rc = 1;
|
||||
if ( method == LDAP_AUTH_SIMPLE ) {
|
||||
if ( be_isroot_pw( be, conn, ndn, cred ) ) {
|
||||
*edn = ch_strdup( be_root_dn( be ) );
|
||||
ber_dupbv( edn, be_root_dn( be ) );
|
||||
rc = LDAP_SUCCESS; /* front end will send result */
|
||||
|
||||
} else if ( refs != NULL ) {
|
||||
|
|
@ -109,7 +107,7 @@ bdb_bind(
|
|||
return rc;
|
||||
}
|
||||
|
||||
*edn = ch_strdup( e->e_dn );
|
||||
ber_dupbv( edn, &e->e_name );
|
||||
|
||||
/* check for deleted */
|
||||
|
||||
|
|
@ -127,7 +125,7 @@ bdb_bind(
|
|||
if ( is_entry_referral( e ) ) {
|
||||
/* entry is a referral, don't allow bind */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
conn, op, e, dn, LDAP_SCOPE_DEFAULT );
|
||||
conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "entry is referral\n", 0,
|
||||
0, 0 );
|
||||
|
|
@ -151,8 +149,8 @@ bdb_bind(
|
|||
/* check for root dn/passwd */
|
||||
if ( be_isroot_pw( be, conn, ndn, cred ) ) {
|
||||
/* front end will send result */
|
||||
if(*edn != NULL) free( *edn );
|
||||
*edn = ch_strdup( be_root_dn( be ) );
|
||||
if(edn->bv_val != NULL) free( edn->bv_val );
|
||||
ber_dupbv( edn, be_root_dn( be ) );
|
||||
rc = LDAP_SUCCESS;
|
||||
goto done;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,25 +21,25 @@ dnssrv_back_bind(
|
|||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
char **edn )
|
||||
struct berval *edn )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "DNSSRV: bind %s (%d)\n",
|
||||
dn == NULL ? "" : dn,
|
||||
dn->bv_val == NULL ? "" : dn->bv_val,
|
||||
method, NULL );
|
||||
|
||||
if( method == LDAP_AUTH_SIMPLE && cred != NULL && cred->bv_len ) {
|
||||
Statslog( LDAP_DEBUG_STATS,
|
||||
"conn=%ld op=%d DNSSRV BIND dn=\"%s\" provided passwd\n",
|
||||
op->o_connid, op->o_opid,
|
||||
dn == NULL ? "" : dn , 0, 0 );
|
||||
dn->bv_val == NULL ? "" : dn->bv_val , 0, 0 );
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"DNSSRV: BIND dn=\"%s\" provided cleartext password\n",
|
||||
dn == NULL ? "" : dn, 0, 0 );
|
||||
dn->bv_val == NULL ? "" : dn->bv_val, 0, 0 );
|
||||
|
||||
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
|
||||
NULL, "you shouldn\'t send strangers your password",
|
||||
|
|
@ -47,7 +47,7 @@ dnssrv_back_bind(
|
|||
|
||||
} else {
|
||||
Debug( LDAP_DEBUG_TRACE, "DNSSRV: BIND dn=\"%s\"\n",
|
||||
dn == NULL ? "" : dn, 0, 0 );
|
||||
dn->bv_val == NULL ? "" : dn->bv_val, 0, 0 );
|
||||
|
||||
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
|
||||
NULL, "anonymous bind expected",
|
||||
|
|
|
|||
|
|
@ -54,11 +54,11 @@ ldap_back_bind(
|
|||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
char **edn
|
||||
struct berval *edn
|
||||
)
|
||||
{
|
||||
struct ldapinfo *li = (struct ldapinfo *) be->be_private;
|
||||
|
|
@ -67,8 +67,6 @@ ldap_back_bind(
|
|||
char *mdn = NULL;
|
||||
int rc = 0;
|
||||
|
||||
*edn = NULL;
|
||||
|
||||
lc = ldap_back_getconn(li, conn, op);
|
||||
if ( !lc ) {
|
||||
return( -1 );
|
||||
|
|
@ -78,17 +76,17 @@ ldap_back_bind(
|
|||
* Rewrite the bind dn if needed
|
||||
*/
|
||||
#ifdef ENABLE_REWRITE
|
||||
switch ( rewrite_session( li->rwinfo, "bindDn", dn, conn, &mdn ) ) {
|
||||
switch ( rewrite_session( li->rwinfo, "bindDn", dn->bv_val, conn, &mdn ) ) {
|
||||
case REWRITE_REGEXEC_OK:
|
||||
if ( mdn == NULL ) {
|
||||
mdn = ( char * )dn;
|
||||
mdn = ( char * )dn->bv_val;
|
||||
}
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
|
||||
"[rw] bindDn: \"%s\" -> \"%s\"\n", dn, mdn ));
|
||||
"[rw] bindDn: \"%s\" -> \"%s\"\n", dn->bv_val, mdn ));
|
||||
#else /* !NEW_LOGGING */
|
||||
Debug( LDAP_DEBUG_ARGS, "rw> bindDn: \"%s\" -> \"%s\"\n%s",
|
||||
dn, mdn, "" );
|
||||
dn->bv_val, mdn, "" );
|
||||
#endif /* !NEW_LOGGING */
|
||||
break;
|
||||
|
||||
|
|
@ -103,7 +101,7 @@ ldap_back_bind(
|
|||
return( -1 );
|
||||
}
|
||||
#else /* !ENABLE_REWRITE */
|
||||
mdn = ldap_back_dn_massage( li, ch_strdup( dn ), 0 );
|
||||
mdn = ldap_back_dn_massage( li, ch_strdup( dn->bv_val ), 0 );
|
||||
#endif /* !ENABLE_REWRITE */
|
||||
|
||||
rc = ldap_bind_s(lc->ld, mdn, cred->bv_val, method);
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ ldbm_back_bind(
|
|||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
char** edn
|
||||
struct berval *edn
|
||||
)
|
||||
{
|
||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
||||
|
|
@ -45,17 +45,16 @@ ldbm_back_bind(
|
|||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
|
||||
"ldbm_back_bind: dn: %s.\n", dn ));
|
||||
"ldbm_back_bind: dn: %s.\n", dn->bv_val ));
|
||||
#else
|
||||
Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_bind: dn: %s\n", dn, 0, 0);
|
||||
Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_bind: dn: %s\n", dn->bv_val, 0, 0);
|
||||
#endif
|
||||
|
||||
|
||||
*edn = NULL;
|
||||
dn = ndn;
|
||||
|
||||
/* get entry with reader lock */
|
||||
if ( (e = dn2entry_r( be, dn, &matched )) == NULL ) {
|
||||
if ( (e = dn2entry_r( be, dn->bv_val, &matched )) == NULL ) {
|
||||
char *matched_dn = NULL;
|
||||
struct berval **refs = NULL;
|
||||
|
||||
|
|
@ -64,21 +63,21 @@ ldbm_back_bind(
|
|||
|
||||
refs = is_entry_referral( matched )
|
||||
? get_entry_referrals( be, conn, op, matched,
|
||||
dn, LDAP_SCOPE_DEFAULT )
|
||||
dn->bv_val, LDAP_SCOPE_DEFAULT )
|
||||
: NULL;
|
||||
|
||||
cache_return_entry_r( &li->li_cache, matched );
|
||||
|
||||
} else {
|
||||
refs = referral_rewrite( default_referral,
|
||||
NULL, dn, LDAP_SCOPE_DEFAULT );
|
||||
NULL, dn->bv_val, LDAP_SCOPE_DEFAULT );
|
||||
}
|
||||
|
||||
/* allow noauth binds */
|
||||
rc = 1;
|
||||
if ( method == LDAP_AUTH_SIMPLE ) {
|
||||
if ( be_isroot_pw( be, conn, dn, cred ) ) {
|
||||
*edn = ch_strdup( be_root_dn( be ) );
|
||||
ber_dupbv( edn, be_root_dn( be ) );
|
||||
rc = 0; /* front end will send result */
|
||||
|
||||
} else if ( refs != NULL ) {
|
||||
|
|
@ -104,7 +103,7 @@ ldbm_back_bind(
|
|||
return( rc );
|
||||
}
|
||||
|
||||
*edn = ch_strdup( e->e_dn );
|
||||
ber_dupbv( edn, &e->e_name );
|
||||
|
||||
/* check for deleted */
|
||||
|
||||
|
|
@ -129,7 +128,7 @@ ldbm_back_bind(
|
|||
if ( is_entry_referral( e ) ) {
|
||||
/* entry is a referral, don't allow bind */
|
||||
struct berval **refs = get_entry_referrals( be,
|
||||
conn, op, e, dn, LDAP_SCOPE_DEFAULT );
|
||||
conn, op, e, dn->bv_val, LDAP_SCOPE_DEFAULT );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
|
||||
|
|
@ -160,8 +159,8 @@ ldbm_back_bind(
|
|||
/* check for root dn/passwd */
|
||||
if ( be_isroot_pw( be, conn, dn, cred ) ) {
|
||||
/* front end will send result */
|
||||
if(*edn != NULL) free( *edn );
|
||||
*edn = ch_strdup( be_root_dn( be ) );
|
||||
if(edn->bv_val != NULL) free( edn->bv_val );
|
||||
ber_dupbv( edn, be_root_dn( be ) );
|
||||
rc = 0;
|
||||
goto return_results;
|
||||
}
|
||||
|
|
@ -220,7 +219,7 @@ ldbm_back_bind(
|
|||
/*
|
||||
* no krbname values present: check against DN
|
||||
*/
|
||||
if ( strcasecmp( dn, krbname ) == 0 ) {
|
||||
if ( strcasecmp( dn->bv_val, krbname ) == 0 ) {
|
||||
rc = 0;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,11 +82,11 @@ meta_back_bind(
|
|||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
char **edn
|
||||
struct berval *edn
|
||||
)
|
||||
{
|
||||
struct metainfo *li = ( struct metainfo * )be->be_private;
|
||||
|
|
@ -96,36 +96,34 @@ meta_back_bind(
|
|||
int op_type = META_OP_ALLOW_MULTIPLE;
|
||||
int err = LDAP_SUCCESS;
|
||||
|
||||
char *realdn = (char *)dn;
|
||||
char *realndn = (char *)ndn;
|
||||
char *realdn = (char *)dn->bv_val;
|
||||
char *realndn = (char *)ndn->bv_val;
|
||||
char *realcred = cred->bv_val;
|
||||
int realmethod = method;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
|
||||
"meta_back_bind: dn: %s.\n", dn ));
|
||||
"meta_back_bind: dn: %s.\n", dn->bv_val ));
|
||||
#else /* !NEW_LOGGING */
|
||||
Debug( LDAP_DEBUG_ARGS, "meta_back_bind: dn: %s.\n%s%s", dn, "", "" );
|
||||
Debug( LDAP_DEBUG_ARGS, "meta_back_bind: dn: %s.\n%s%s", dn->bv_val, "", "" );
|
||||
#endif /* !NEW_LOGGING */
|
||||
|
||||
*edn = NULL;
|
||||
|
||||
if ( method == LDAP_AUTH_SIMPLE
|
||||
&& be_isroot_pw( be, conn, ndn, cred ) ) {
|
||||
isroot = 1;
|
||||
*edn = ch_strdup( be_root_dn( be ) );
|
||||
ber_dupbv( edn, be_root_dn( be ) );
|
||||
op_type = META_OP_REQUIRE_ALL;
|
||||
}
|
||||
lc = meta_back_getconn( li, conn, op, op_type, ndn, NULL );
|
||||
lc = meta_back_getconn( li, conn, op, op_type, ndn->bv_val, NULL );
|
||||
if ( !lc ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_NOTICE,
|
||||
"meta_back_bind: no target for dn %s.\n",
|
||||
dn ));
|
||||
dn->bv_val ));
|
||||
#else /* !NEW_LOGGING */
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"meta_back_bind: no target for dn %s.\n%s%s",
|
||||
dn, "", "");
|
||||
dn->bv_val, "", "");
|
||||
#endif /* !NEW_LOGGING */
|
||||
send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR,
|
||||
NULL, NULL, NULL, NULL );
|
||||
|
|
@ -136,7 +134,7 @@ meta_back_bind(
|
|||
* Each target is scanned ...
|
||||
*/
|
||||
lc->bound_target = META_BOUND_NONE;
|
||||
ndnlen = strlen( ndn );
|
||||
ndnlen = ndn->bv_len;
|
||||
for ( i = 0; i < li->ntargets; i++ ) {
|
||||
int lerr;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ monitor_back_bind(
|
|||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
char** edn
|
||||
struct berval *edn
|
||||
|
||||
)
|
||||
{
|
||||
|
|
@ -62,15 +62,15 @@ monitor_back_bind(
|
|||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
|
||||
"monitor_back_bind: dn: %s.\n", dn ));
|
||||
"monitor_back_bind: dn: %s.\n", dn->bv_val ));
|
||||
#else
|
||||
Debug(LDAP_DEBUG_ARGS, "==> monitor_back_bind: dn: %s\n%s%s",
|
||||
dn, "", "");
|
||||
dn->bv_val, "", "");
|
||||
#endif
|
||||
|
||||
if ( method == LDAP_AUTH_SIMPLE
|
||||
&& be_isroot_pw( be, conn, ndn, cred ) ) {
|
||||
*edn = ch_strdup( be_root_dn( be ) );
|
||||
ber_dupbv( edn, be_root_dn( be ) );
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,11 +33,11 @@ perl_back_bind(
|
|||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
char** edn
|
||||
struct berval *edn
|
||||
)
|
||||
{
|
||||
int return_code;
|
||||
|
|
@ -45,8 +45,6 @@ perl_back_bind(
|
|||
|
||||
PerlBackend *perl_back = (PerlBackend *) be->be_private;
|
||||
|
||||
*edn = NULL;
|
||||
|
||||
ldap_pvt_thread_mutex_lock( &perl_interpreter_mutex );
|
||||
|
||||
{
|
||||
|
|
@ -54,7 +52,7 @@ perl_back_bind(
|
|||
|
||||
PUSHMARK(sp);
|
||||
XPUSHs( perl_back->pb_obj_ref );
|
||||
XPUSHs(sv_2mortal(newSVpv( dn , 0)));
|
||||
XPUSHs(sv_2mortal(newSVpv( dn->bv_val , 0)));
|
||||
XPUSHs(sv_2mortal(newSVpv( cred->bv_val , cred->bv_len)));
|
||||
PUTBACK;
|
||||
|
||||
|
|
@ -63,7 +61,7 @@ perl_back_bind(
|
|||
SPAGAIN;
|
||||
|
||||
if (count != 1) {
|
||||
croak("Big trouble in back_search\n");
|
||||
croak("Big trouble in back_bind\n");
|
||||
}
|
||||
|
||||
return_code = POPi;
|
||||
|
|
|
|||
|
|
@ -20,19 +20,17 @@ shell_back_bind(
|
|||
Backend *be,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
char **edn
|
||||
struct berval *edn
|
||||
)
|
||||
{
|
||||
struct shellinfo *si = (struct shellinfo *) be->be_private;
|
||||
FILE *rfp, *wfp;
|
||||
int rc;
|
||||
|
||||
*edn = NULL;
|
||||
|
||||
if ( si->si_bind == NULL ) {
|
||||
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
|
||||
"bind not implemented", NULL, NULL );
|
||||
|
|
@ -50,7 +48,7 @@ shell_back_bind(
|
|||
fprintf( wfp, "BIND\n" );
|
||||
fprintf( wfp, "msgid: %ld\n", (long) op->o_msgid );
|
||||
print_suffixes( wfp, be );
|
||||
fprintf( wfp, "dn: %s\n", dn );
|
||||
fprintf( wfp, "dn: %s\n", dn->bv_val );
|
||||
fprintf( wfp, "method: %d\n", method );
|
||||
fprintf( wfp, "credlen: %lu\n", cred->bv_len );
|
||||
fprintf( wfp, "cred: %s\n", cred->bv_val ); /* XXX */
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#include "entry-id.h"
|
||||
|
||||
int backsql_bind(BackendDB *be,Connection *conn,Operation *op,
|
||||
const char *dn,const char *ndn,int method,struct berval *cred,char** edn)
|
||||
struct berval *dn,struct berval *ndn,int method,struct berval *cred,struct berval *edn)
|
||||
{
|
||||
backsql_info *bi=(backsql_info*)be->be_private;
|
||||
backsql_entryID user_id,*res;
|
||||
|
|
@ -34,12 +34,12 @@ int backsql_bind(BackendDB *be,Connection *conn,Operation *op,
|
|||
|
||||
if ( be_isroot_pw( be, conn, ndn, cred ) )
|
||||
{
|
||||
*edn=ch_strdup(be_root_dn(be));
|
||||
ber_dupbv(edn, be_root_dn(be));
|
||||
Debug(LDAP_DEBUG_TRACE,"<==backsql_bind() root bind\n",0,0,0);
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
*edn=ch_strdup(ndn);
|
||||
ber_dupbv(edn, ndn);
|
||||
|
||||
if (method == LDAP_AUTH_SIMPLE)
|
||||
{
|
||||
|
|
@ -52,7 +52,7 @@ int backsql_bind(BackendDB *be,Connection *conn,Operation *op,
|
|||
return 1;
|
||||
}
|
||||
|
||||
res=backsql_dn2id(bi,&user_id,dbh,ndn);
|
||||
res=backsql_dn2id(bi,&user_id,dbh,ndn->bv_val);
|
||||
if (res==NULL)
|
||||
{
|
||||
Debug(LDAP_DEBUG_TRACE,"backsql_bind(): could not retrieve bind dn id - no such entry\n",0,0,0);
|
||||
|
|
@ -60,7 +60,7 @@ int backsql_bind(BackendDB *be,Connection *conn,Operation *op,
|
|||
return 1;
|
||||
}
|
||||
|
||||
backsql_init_search(&bsi,bi,(char*)ndn,LDAP_SCOPE_BASE,-1,-1,-1,NULL,dbh,
|
||||
backsql_init_search(&bsi,bi,(char*)ndn->bv_val,LDAP_SCOPE_BASE,-1,-1,-1,NULL,dbh,
|
||||
be,conn,op,NULL);
|
||||
e=backsql_id2entry(&bsi,&user_entry,&user_id);
|
||||
if (e==NULL)
|
||||
|
|
|
|||
|
|
@ -21,19 +21,17 @@ tcl_back_bind (
|
|||
Backend * be,
|
||||
Connection * conn,
|
||||
Operation * op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
char **edn
|
||||
struct berval *edn
|
||||
)
|
||||
{
|
||||
char *command, *suf_tcl, *results;
|
||||
int i, code, err = 0;
|
||||
struct tclinfo *ti = (struct tclinfo *) be->be_private;
|
||||
|
||||
*edn = NULL;
|
||||
|
||||
if (ti->ti_bind == NULL) {
|
||||
send_ldap_result (conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
|
||||
"bind not implemented", NULL, NULL );
|
||||
|
|
@ -45,9 +43,9 @@ tcl_back_bind (
|
|||
|
||||
command = (char *) ch_malloc (strlen (ti->ti_bind) + strlen
|
||||
(suf_tcl) +
|
||||
strlen (dn) + strlen (cred->bv_val) + 64);
|
||||
dn->bv_len + cred->bv_len + 64);
|
||||
sprintf (command, "%s BIND {%ld} {%s} {%s} {%d} {%lu} {%s}",
|
||||
ti->ti_bind, op->o_msgid, suf_tcl, dn, method, cred->bv_len,
|
||||
ti->ti_bind, op->o_msgid, suf_tcl, dn->bv_val, method, cred->bv_len,
|
||||
cred->bv_val);
|
||||
Tcl_Free (suf_tcl);
|
||||
|
||||
|
|
|
|||
|
|
@ -621,29 +621,21 @@ be_isupdate( Backend *be, struct berval *ndn )
|
|||
return strcmp( be->be_update_ndn.bv_val, ndn->bv_val ) ? 0 : 1;
|
||||
}
|
||||
|
||||
char *
|
||||
struct berval *
|
||||
be_root_dn( Backend *be )
|
||||
{
|
||||
if ( !be->be_rootdn.bv_len ) {
|
||||
return( "" );
|
||||
}
|
||||
|
||||
return be->be_rootdn.bv_val;
|
||||
return &be->be_rootdn;
|
||||
}
|
||||
|
||||
int
|
||||
be_isroot_pw( Backend *be,
|
||||
Connection *conn,
|
||||
const char *dn,
|
||||
struct berval *ndn,
|
||||
struct berval *cred )
|
||||
{
|
||||
int result;
|
||||
|
||||
struct berval ndn;
|
||||
ndn.bv_val = (char *) dn;
|
||||
ndn.bv_len = dn ? strlen( dn ) : 0;
|
||||
|
||||
if ( ! be_isroot( be, &ndn ) ) {
|
||||
if ( ! be_isroot( be, ndn ) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -369,17 +369,17 @@ glue_back_bind (
|
|||
BackendDB *b0,
|
||||
Connection *conn,
|
||||
Operation *op,
|
||||
const char *dn,
|
||||
const char *ndn,
|
||||
struct berval *dn,
|
||||
struct berval *ndn,
|
||||
int method,
|
||||
struct berval *cred,
|
||||
char **edn
|
||||
struct berval *edn
|
||||
)
|
||||
{
|
||||
BackendDB *be;
|
||||
int rc;
|
||||
|
||||
be = glue_back_select (b0, ndn);
|
||||
be = glue_back_select (b0, ndn->bv_val);
|
||||
|
||||
if (be && be->be_bind) {
|
||||
conn->c_authz_backend = be;
|
||||
|
|
|
|||
|
|
@ -488,21 +488,19 @@ do_bind(
|
|||
if ( be->be_bind ) {
|
||||
int ret;
|
||||
/* alias suffix */
|
||||
char *edn = NULL;
|
||||
struct berval edn = { 0, NULL };
|
||||
|
||||
/* deref suffix alias if appropriate */
|
||||
suffix_alias( be, ndn );
|
||||
|
||||
ret = (*be->be_bind)( be, conn, op,
|
||||
pdn->bv_val, ndn->bv_val,
|
||||
method, &cred, &edn );
|
||||
pdn, ndn, method, &cred, &edn );
|
||||
|
||||
if ( ret == 0 ) {
|
||||
ldap_pvt_thread_mutex_lock( &conn->c_mutex );
|
||||
|
||||
if(edn != NULL) {
|
||||
conn->c_dn.bv_val = edn;
|
||||
conn->c_dn.bv_len = strlen( edn );
|
||||
if(edn.bv_len) {
|
||||
conn->c_dn = edn;
|
||||
} else {
|
||||
conn->c_dn.bv_val = ch_strdup( pdn->bv_val );
|
||||
conn->c_dn.bv_len = pdn->bv_len;
|
||||
|
|
@ -537,8 +535,8 @@ do_bind(
|
|||
send_ldap_result( conn, op, LDAP_SUCCESS,
|
||||
NULL, NULL, NULL, NULL );
|
||||
|
||||
} else if (edn != NULL) {
|
||||
free( edn );
|
||||
} else if (edn.bv_val != NULL) {
|
||||
free( edn.bv_val );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -174,9 +174,9 @@ LDAP_SLAPD_F (int) be_issuffix LDAP_P(( Backend *be,
|
|||
LDAP_SLAPD_F (int) be_isroot LDAP_P(( Backend *be,
|
||||
struct berval *ndn ));
|
||||
LDAP_SLAPD_F (int) be_isroot_pw LDAP_P(( Backend *be,
|
||||
Connection *conn, const char *ndn, struct berval *cred ));
|
||||
Connection *conn, struct berval *ndn, struct berval *cred ));
|
||||
LDAP_SLAPD_F (int) be_isupdate LDAP_P(( Backend *be, struct berval *ndn ));
|
||||
LDAP_SLAPD_F (char *) be_root_dn LDAP_P(( Backend *be ));
|
||||
LDAP_SLAPD_F (struct berval *) be_root_dn LDAP_P(( Backend *be ));
|
||||
LDAP_SLAPD_F (int) be_entry_release_rw LDAP_P((
|
||||
BackendDB *be, Connection *c, Operation *o, Entry *e, int rw ));
|
||||
#define be_entry_release_r( be, c, o, e ) be_entry_release_rw( be, c, o, e, 0 )
|
||||
|
|
|
|||
|
|
@ -1033,8 +1033,8 @@ typedef int (BI_db_destroy) LDAP_P((Backend *bd));
|
|||
|
||||
typedef int (BI_op_bind) LDAP_P(( BackendDB *bd,
|
||||
struct slap_conn *c, struct slap_op *o,
|
||||
const char *dn, const char *ndn, int method,
|
||||
struct berval *cred, char** edn ));
|
||||
struct berval *dn, struct berval *ndn, int method,
|
||||
struct berval *cred, struct berval *edn ));
|
||||
typedef int (BI_op_unbind) LDAP_P((BackendDB *bd,
|
||||
struct slap_conn *c, struct slap_op *o ));
|
||||
typedef int (BI_op_search) LDAP_P((BackendDB *bd,
|
||||
|
|
|
|||
Loading…
Reference in a new issue