]> git.sur5r.net Git - openldap/commitdiff
Fix unsigned * vs unsigned long * bugs
authorKurt Zeilenga <kurt@openldap.org>
Tue, 16 May 2000 04:52:37 +0000 (04:52 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 16 May 2000 04:52:37 +0000 (04:52 +0000)
libraries/libldap/init.c
libraries/libldap/sasl.c
servers/slapd/sasl.c

index 1c882cf88b7f348111f3db62c28a3ec76c5e0096..820c951e9597f44991f19bd3fc9f4ec4fcf41818 100644 (file)
@@ -13,6 +13,8 @@
 #include <ac/ctype.h>
 #include <ac/time.h>
 
+#include <limits.h>
+
 #include "ldap-int.h"
 #include "ldap_defaults.h"
 
index a28bce6028dd45a084287e82c8494260891fd066..00656001d9cbec9f2bb8331e2984d07f3bb89eb0 100644 (file)
@@ -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) ) {
index a03b10181bd719925f5bdba6574eafa1b3b76ab5..23d6d9960801f3ca7cbfc8e1558e6ddb3b327eab 100644 (file)
@@ -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 );