mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
Fix unsigned * vs unsigned long * bugs
This commit is contained in:
parent
deac70a6de
commit
4e5992c190
@ -13,6 +13,8 @@
|
||||
#include <ac/ctype.h>
|
||||
#include <ac/time.h>
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#include "ldap-int.h"
|
||||
#include "ldap_defaults.h"
|
||||
|
||||
|
@ -496,7 +496,7 @@ static ber_slen_t sasl_write( Sockbuf *sb, void *buf, ber_len_t len )
|
||||
|
||||
static int sasl_close( Sockbuf *sb )
|
||||
{
|
||||
(ber_pvt_sb_io_tcp.sbi_close)( sb );
|
||||
return (ber_pvt_sb_io_tcp.sbi_close)( sb );
|
||||
}
|
||||
|
||||
static int
|
||||
@ -545,7 +545,7 @@ ldap_pvt_sasl_getmechs ( LDAP *ld, char **pmechlist )
|
||||
/* we need to query the server for supported mechs anyway */
|
||||
LDAPMessage *res, *e;
|
||||
char *attrs[] = { "supportedSASLMechanisms", NULL };
|
||||
char **values, *mechlist, **p;
|
||||
char **values, *mechlist;
|
||||
int rc;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_pvt_sasl_getmech\n", 0, 0, 0 );
|
||||
@ -598,7 +598,8 @@ ldap_pvt_sasl_bind(
|
||||
LDAPControl **cctrls )
|
||||
{
|
||||
const char *mech;
|
||||
int saslrc, rc, msgid, ssf = 0;
|
||||
int saslrc, rc, ssf = 0;
|
||||
unsigned credlen;
|
||||
struct berval ccred, *scred;
|
||||
char *host;
|
||||
sasl_interact_t *client_interact = NULL;
|
||||
@ -648,9 +649,11 @@ ldap_pvt_sasl_bind(
|
||||
NULL,
|
||||
&client_interact,
|
||||
&ccred.bv_val,
|
||||
(unsigned int *)&ccred.bv_len,
|
||||
&credlen,
|
||||
&mech );
|
||||
|
||||
ccred.bv_len = credlen;
|
||||
|
||||
if ( (saslrc != SASL_OK) && (saslrc != SASL_CONTINUE) ) {
|
||||
ld->ld_errno = sasl_err2ldap( saslrc );
|
||||
sasl_dispose( &ld->ld_sasl_context );
|
||||
@ -660,6 +663,7 @@ ldap_pvt_sasl_bind(
|
||||
scred = NULL;
|
||||
|
||||
do {
|
||||
unsigned credlen;
|
||||
sasl_interact_t *client_interact = NULL;
|
||||
|
||||
rc = ldap_sasl_bind_s( ld, dn, mech, &ccred, sctrls, cctrls, &scred );
|
||||
@ -683,8 +687,9 @@ ldap_pvt_sasl_bind(
|
||||
(scred == NULL) ? 0 : scred->bv_len,
|
||||
&client_interact,
|
||||
&ccred.bv_val,
|
||||
(unsigned int *)&ccred.bv_len );
|
||||
&credlen );
|
||||
|
||||
ccred.bv_len = credlen;
|
||||
ber_bvfree( scred );
|
||||
|
||||
if ( (saslrc != SASL_OK) && (saslrc != SASL_CONTINUE) ) {
|
||||
|
@ -239,18 +239,27 @@ int sasl_bind(
|
||||
send_ldap_result( conn, op, rc = LDAP_AUTH_METHOD_NOT_SUPPORTED,
|
||||
NULL, NULL, NULL, NULL );
|
||||
} else {
|
||||
unsigned reslen;
|
||||
conn->c_authmech = ch_strdup( mech );
|
||||
|
||||
sc = sasl_server_start( conn->c_sasl_bind_context, conn->c_authmech,
|
||||
cred->bv_val, cred->bv_len, (char **)&response.bv_val,
|
||||
(unsigned *)&response.bv_len, &errstr );
|
||||
cred->bv_val, cred->bv_len,
|
||||
(char **)&response.bv_val, &reslen, &errstr );
|
||||
|
||||
response.bv_len = reslen;
|
||||
|
||||
if ( (sc != SASL_OK) && (sc != SASL_CONTINUE) ) {
|
||||
send_ldap_result( conn, op, rc = slap_sasl_err2ldap( sc ),
|
||||
NULL, errstr, NULL, NULL );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unsigned reslen;
|
||||
sc = sasl_server_step( conn->c_sasl_bind_context, cred->bv_val, cred->bv_len,
|
||||
(char **)&response.bv_val, (unsigned *)&response.bv_len, &errstr );
|
||||
(char **)&response.bv_val, &reslen, &errstr );
|
||||
|
||||
response.bv_len = reslen;
|
||||
|
||||
if ( (sc != SASL_OK) && (sc != SASL_CONTINUE) ) {
|
||||
send_ldap_result( conn, op, rc = slap_sasl_err2ldap( sc ),
|
||||
NULL, errstr, NULL, NULL );
|
||||
|
Loading…
Reference in New Issue
Block a user