From: Kurt Zeilenga Date: Tue, 16 May 2000 04:52:37 +0000 (+0000) Subject: Fix unsigned * vs unsigned long * bugs X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~2952 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4e5992c190a020c6be21ea3ccb54d7dd12e57297;p=openldap Fix unsigned * vs unsigned long * bugs --- diff --git a/libraries/libldap/init.c b/libraries/libldap/init.c index 1c882cf88b..820c951e95 100644 --- a/libraries/libldap/init.c +++ b/libraries/libldap/init.c @@ -13,6 +13,8 @@ #include #include +#include + #include "ldap-int.h" #include "ldap_defaults.h" diff --git a/libraries/libldap/sasl.c b/libraries/libldap/sasl.c index a28bce6028..00656001d9 100644 --- a/libraries/libldap/sasl.c +++ b/libraries/libldap/sasl.c @@ -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) ) { diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index a03b10181b..23d6d99608 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -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 );