mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
Pass correct credentials in slapd-bind
This commit is contained in:
parent
f5bef58cae
commit
dfbeb82442
1 changed files with 11 additions and 10 deletions
|
|
@ -41,8 +41,8 @@
|
||||||
#include "slapd-common.h"
|
#include "slapd-common.h"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_bind( struct tester_conn_args *config, char *dn, int maxloop,
|
do_bind( struct tester_conn_args *config, char *dn, int maxloop, int force,
|
||||||
int force, int noinit, LDAP **ldp, int action_type, void *action );
|
int noinit, LDAP **ldp, struct berval *pass, int action_type, void *action );
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_base( struct tester_conn_args *config, char *dn, char *base, char *filter, char *pwattr,
|
do_base( struct tester_conn_args *config, char *dn, char *base, char *filter, char *pwattr,
|
||||||
|
|
@ -187,7 +187,7 @@ main( int argc, char **argv )
|
||||||
filter, pwattr, force, noinit, -1, NULL );
|
filter, pwattr, force, noinit, -1, NULL );
|
||||||
} else {
|
} else {
|
||||||
rc = do_bind( config, config->binddn,
|
rc = do_bind( config, config->binddn,
|
||||||
config->loops, force, noinit, NULL, -1, NULL );
|
config->loops, force, noinit, NULL, &config->pass, -1, NULL );
|
||||||
}
|
}
|
||||||
if ( rc == LDAP_SERVER_DOWN )
|
if ( rc == LDAP_SERVER_DOWN )
|
||||||
break;
|
break;
|
||||||
|
|
@ -198,8 +198,8 @@ main( int argc, char **argv )
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
do_bind( struct tester_conn_args *config, char *dn, int maxloop,
|
do_bind( struct tester_conn_args *config, char *dn, int maxloop, int force,
|
||||||
int force, int noinit, LDAP **ldp, int action_type, void *action )
|
int noinit, LDAP **ldp, struct berval *pass, int action_type, void *action )
|
||||||
{
|
{
|
||||||
LDAP *ld = ldp ? *ldp : NULL;
|
LDAP *ld = ldp ? *ldp : NULL;
|
||||||
char *bindfunc = "ldap_sasl_bind_s";
|
char *bindfunc = "ldap_sasl_bind_s";
|
||||||
|
|
@ -277,7 +277,7 @@ do_bind( struct tester_conn_args *config, char *dn, int maxloop,
|
||||||
#ifdef HAVE_CYRUS_SASL
|
#ifdef HAVE_CYRUS_SASL
|
||||||
bindfunc = "ldap_sasl_interactive_bind_s";
|
bindfunc = "ldap_sasl_interactive_bind_s";
|
||||||
rc = ldap_sasl_interactive_bind_s( ld,
|
rc = ldap_sasl_interactive_bind_s( ld,
|
||||||
config->binddn,
|
dn,
|
||||||
config->mech,
|
config->mech,
|
||||||
NULL, NULL,
|
NULL, NULL,
|
||||||
LDAP_SASL_QUIET,
|
LDAP_SASL_QUIET,
|
||||||
|
|
@ -290,8 +290,8 @@ do_bind( struct tester_conn_args *config, char *dn, int maxloop,
|
||||||
} else if ( config->authmethod == LDAP_AUTH_SIMPLE ) {
|
} else if ( config->authmethod == LDAP_AUTH_SIMPLE ) {
|
||||||
bindfunc = "ldap_sasl_bind_s";
|
bindfunc = "ldap_sasl_bind_s";
|
||||||
rc = ldap_sasl_bind_s( ld,
|
rc = ldap_sasl_bind_s( ld,
|
||||||
config->binddn, LDAP_SASL_SIMPLE,
|
dn, LDAP_SASL_SIMPLE,
|
||||||
&config->pass, NULL, NULL, NULL );
|
pass, NULL, NULL, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( rc ) {
|
if ( rc ) {
|
||||||
|
|
@ -477,6 +477,7 @@ novals:;
|
||||||
|
|
||||||
/* Ok, got list of DNs, now start binding to each */
|
/* Ok, got list of DNs, now start binding to each */
|
||||||
for ( i = 0; i < config->loops; i++ ) {
|
for ( i = 0; i < config->loops; i++ ) {
|
||||||
|
struct berval *pass = &config->pass;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
#if 0 /* use high-order bits for better randomness (Numerical Recipes in "C") */
|
#if 0 /* use high-order bits for better randomness (Numerical Recipes in "C") */
|
||||||
|
|
@ -485,10 +486,10 @@ novals:;
|
||||||
j = ((double)ndns)*rand()/(RAND_MAX + 1.0);
|
j = ((double)ndns)*rand()/(RAND_MAX + 1.0);
|
||||||
|
|
||||||
if ( creds && !BER_BVISEMPTY( &creds[j] ) ) {
|
if ( creds && !BER_BVISEMPTY( &creds[j] ) ) {
|
||||||
config->pass = creds[j];
|
pass = &creds[j];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( do_bind( config, dns[j], 1, force, noinit, &ld,
|
if ( do_bind( config, dns[j], 1, force, noinit, &ld, pass,
|
||||||
action_type, action ) && !force )
|
action_type, action ) && !force )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue