Issue 2926 - cyrus sasl callbacks patch
Summary: cyrus sasl callbacks patch
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: slapd (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-21 03:40 UTC by igor@ipass.net
Modified: 2014-08-01 21:06 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description igor@ipass.net 2004-01-21 03:40:12 UTC
Full_Name: Igor Brezac
Version: 2.1.25
OS: Solaris 9
URL: 
Submission from: (NULL) (209.170.129.80)


Please consider the following patch for improved sasl handling.  The following
setup does not work: sasl client -> cyrus imapd -> ldap auxprop.  The previously
established sasl_client_init() session (imapd) prevents the setup of global
callbacks for openldap libs which breaks ldap auxprop.  This patch sets up per
session callbacks and the above setup works.  I suppose the global setup of the
same callbacks would not hurt anything.

--- cyrus.c.orig        Tue Jan 20 22:27:03 2004
+++ cyrus.c     Tue Jan 20 22:26:54 2004
@@ -44,18 +44,6 @@
        /* 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 +89,7 @@
        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;
        }
@@ -465,6 +453,18 @@
        int rc;
        sasl_conn_t *ctx;
 
+       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 }
+       };
+
        assert( lc->lconn_sasl_ctx == NULL );
 
        if ( host == NULL ) {
@@ -474,7 +474,7 @@
 
 #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,
                SASL_SECURITY_LAYER, &ctx );

Comment 1 Howard Chu 2004-01-24 02:34:12 UTC
changed notes
changed state Open to Test
moved from Incoming to Software Bugs
Comment 2 Howard Chu 2004-02-12 02:41:50 UTC
changed notes
Comment 3 Kurt Zeilenga 2004-02-24 19:58:43 UTC
changed notes
changed state Test to Release
Comment 4 Kurt Zeilenga 2004-03-18 04:05:23 UTC
changed state Release to Closed
Comment 5 Howard Chu 2009-02-17 04:58:56 UTC
moved from Software Bugs to Archive.Software Bugs
Comment 6 OpenLDAP project 2014-08-01 21:06:30 UTC
fixed in HEAD, re21, re22