From 74727139287c40cced39d34e40f5c5fe7babdad0 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 12 Feb 2004 03:41:19 +0000 Subject: [PATCH] Import ITS#2926 fix from HEAD --- libraries/libldap/cyrus.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 580fa5e7ed..cbfae04a3e 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -39,23 +39,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 #define SASL_BUILD_VERSION ((SASL_VERSION_MAJOR << 24) |\ (SASL_VERSION_MINOR << 16) | SASL_VERSION_STEP) @@ -101,7 +101,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; } @@ -474,9 +474,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 -- 2.39.5