]> git.sur5r.net Git - openldap/commitdiff
ITS#2926 from igor@ipass.net, slightly modified
authorHoward Chu <hyc@openldap.org>
Sat, 24 Jan 2004 03:33:44 +0000 (03:33 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 24 Jan 2004 03:33:44 +0000 (03:33 +0000)
libraries/libldap/cyrus.c

index 384f0d1e9100a153bc292ee7464d593fda2a0de4..6cc4861ef5461294fd210e751c9938cbfae280a5 100644 (file)
@@ -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