X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Flibldap%2Fsasl.c;h=93a52472f8e41630b0b8f01847e36cae27f9a7a9;hb=4a2b9b21951cb9966f98cd49064e856f6ff7e6a4;hp=2d47636b7c175e6dca2c4ad209451228ae2d26e9;hpb=978e417699699579fb0b858ad485f36399220c4d;p=openldap diff --git a/libraries/libldap/sasl.c b/libraries/libldap/sasl.c index 2d47636b7c..93a52472f8 100644 --- a/libraries/libldap/sasl.c +++ b/libraries/libldap/sasl.c @@ -1,6 +1,6 @@ /* $OpenLDAP$ */ /* - * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved. + * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved. * COPYING RESTRICTIONS APPLY, see COPYRIGHT file */ @@ -27,10 +27,10 @@ #include "portable.h" -#include #include #include +#include #include #include #include @@ -61,7 +61,11 @@ ldap_sasl_bind( BerElement *ber; int rc; +#ifdef NEW_LOGGING + LDAP_LOG (( "sasl", LDAP_LEVEL_ENTRY, "ldap_sasl_bind\n" )); +#else Debug( LDAP_DEBUG_TRACE, "ldap_sasl_bind\n", 0, 0, 0 ); +#endif assert( ld != NULL ); assert( LDAP_VALID( ld ) ); @@ -169,7 +173,11 @@ ldap_sasl_bind_s( LDAPMessage *result; struct berval *scredp = NULL; +#ifdef NEW_LOGGING + LDAP_LOG (( "sasl", LDAP_LEVEL_ENTRY, "ldap_sasl_bind_s\n" )); +#else Debug( LDAP_DEBUG_TRACE, "ldap_sasl_bind_s\n", 0, 0, 0 ); +#endif /* do a quick !LDAPv3 check... ldap_sasl_bind will do the rest. */ if( servercredp != NULL ) { @@ -186,6 +194,12 @@ ldap_sasl_bind_s( return( rc ); } +#ifdef LDAP_CONNECTIONLESS + if (LDAP_IS_UDP(ld)) { + return( rc ); + } +#endif + if ( ldap_result( ld, msgid, 1, NULL, &result ) == -1 ) { return( ld->ld_errno ); /* ldap_result sets ld_errno */ } @@ -245,7 +259,11 @@ ldap_parse_sasl_bind_result( ber_tag_t tag; BerElement *ber; +#ifdef NEW_LOGGING + LDAP_LOG (( "sasl", LDAP_LEVEL_ENTRY, "ldap_parse_sasl_bind_result\n" )); +#else Debug( LDAP_DEBUG_TRACE, "ldap_parse_sasl_bind_result\n", 0, 0, 0 ); +#endif assert( ld != NULL ); assert( LDAP_VALID( ld ) ); @@ -358,7 +376,11 @@ ldap_pvt_sasl_getmechs ( LDAP *ld, char **pmechlist ) char **values, *mechlist; int rc; +#ifdef NEW_LOGGING + LDAP_LOG (( "sasl", LDAP_LEVEL_ENTRY, "ldap_pvt_sasl_getmech\n" )); +#else Debug( LDAP_DEBUG_TRACE, "ldap_pvt_sasl_getmech\n", 0, 0, 0 ); +#endif rc = ldap_search_s( ld, "", LDAP_SCOPE_BASE, NULL, attrs, 0, &res ); @@ -423,7 +445,16 @@ ldap_sasl_interactive_bind_s( #if defined( LDAP_R_COMPILE ) && defined( HAVE_CYRUS_SASL ) ldap_pvt_thread_mutex_lock( &ldap_int_sasl_mutex ); #endif - +#ifdef LDAP_CONNECTIONLESS + if( LDAP_IS_UDP(ld) ) { + /* Just force it to simple bind, silly to make the user + * ask all the time. No, we don't ever actually bind, but I'll + * let the final bind handler take care of saving the cdn. + */ + rc = ldap_simple_bind(ld, dn, NULL); + return rc < 0 ? rc : 0; + } else +#endif if( mechs == NULL || *mechs == '\0' ) { char *smechs; @@ -433,16 +464,26 @@ ldap_sasl_interactive_bind_s( goto done; } +#ifdef NEW_LOGGING + LDAP_LOG (( "sasl", LDAP_LEVEL_DETAIL1, + "ldap_interactive_sasl_bind_s: server supports: %s\n", smechs )); +#else Debug( LDAP_DEBUG_TRACE, "ldap_interactive_sasl_bind_s: server supports: %s\n", smechs, 0, 0 ); +#endif mechs = smechs; } else { +#ifdef NEW_LOGGING + LDAP_LOG (( "sasl", LDAP_LEVEL_DETAIL1, + "ldap_interactive_sasl_bind_s: user selected: %s\n", mechs )); +#else Debug( LDAP_DEBUG_TRACE, "ldap_interactive_sasl_bind_s: user selected: %s\n", mechs, 0, 0 ); +#endif } rc = ldap_int_sasl_bind( ld, dn, mechs,