From: Howard Chu Date: Sat, 24 Jan 2004 03:33:44 +0000 (+0000) Subject: ITS#2926 from igor@ipass.net, slightly modified X-Git-Tag: OPENLDAP_REL_ENG_2_2_BP~449 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=02a6301f22459c3b1ac29a1aa95bf7a1b0ca416e;p=openldap ITS#2926 from igor@ipass.net, slightly modified --- diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 384f0d1e91..6cc4861ef5 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -49,23 +49,23 @@ ldap_pvt_thread_mutex_t ldap_int_sasl_mutex; * Various Cyrus SASL related stuff. */ +static const sasl_callback_t client_callbacks[] = { +#ifdef SASL_CB_GETREALM + { SASL_CB_GETREALM, NULL, NULL }, +#endif + { SASL_CB_USER, NULL, NULL }, + { SASL_CB_AUTHNAME, NULL, NULL }, + { SASL_CB_PASS, NULL, NULL }, + { SASL_CB_ECHOPROMPT, NULL, NULL }, + { SASL_CB_NOECHOPROMPT, NULL, NULL }, + { SASL_CB_LIST_END, NULL, NULL } +}; + int ldap_int_sasl_init( void ) { /* XXX not threadsafe */ static int sasl_initialized = 0; - static sasl_callback_t client_callbacks[] = { -#ifdef SASL_CB_GETREALM - { SASL_CB_GETREALM, NULL, NULL }, -#endif - { SASL_CB_USER, NULL, NULL }, - { SASL_CB_AUTHNAME, NULL, NULL }, - { SASL_CB_PASS, NULL, NULL }, - { SASL_CB_ECHOPROMPT, NULL, NULL }, - { SASL_CB_NOECHOPROMPT, NULL, NULL }, - { SASL_CB_LIST_END, NULL, NULL } - }; - #ifdef HAVE_SASL_VERSION /* stringify the version number, sasl.h doesn't do it for us */ #define VSTR0(maj, min, pat) #maj "." #min "." #pat @@ -118,7 +118,7 @@ int ldap_int_sasl_init( void ) ldap_pvt_thread_mutex_init( &ldap_int_sasl_mutex ); #endif - if ( sasl_client_init( client_callbacks ) == SASL_OK ) { + if ( sasl_client_init( NULL ) == SASL_OK ) { sasl_initialized = 1; return 0; } @@ -506,9 +506,9 @@ ldap_int_sasl_open( #if SASL_VERSION_MAJOR >= 2 rc = sasl_client_new( "ldap", host, NULL, NULL, - NULL, 0, &ctx ); + client_callbacks, 0, &ctx ); #else - rc = sasl_client_new( "ldap", host, NULL, + rc = sasl_client_new( "ldap", host, client_callbacks, SASL_SECURITY_LAYER, &ctx ); #endif