]> git.sur5r.net Git - openldap/commitdiff
SASL version check
authorKurt Zeilenga <kurt@openldap.org>
Thu, 29 Aug 2002 03:40:22 +0000 (03:40 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 29 Aug 2002 03:40:22 +0000 (03:40 +0000)
libraries/libldap/cyrus.c

index 5310903c0ea570f59d59c2395ab7139e8bf6399f..1e6e9f42cf31f5d322753bd82766dc7f09b196d9 100644 (file)
@@ -56,6 +56,28 @@ int ldap_int_sasl_init( void )
                { 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)
+
+       { int rc;
+       sasl_version( NULL, &rc );
+       if ( ((rc >> 16) != ((SASL_VERSION_MAJOR << 8)|SASL_VERSION_MINOR)) ||
+               (rc & 0xffff) < SASL_VERSION_STEP) {
+
+#ifdef NEW_LOGGING
+               LDAP_LOG( TRANSPORT, INFO,
+               "ldap_int_sasl_init: SASL version mismatch, got %x, wanted %x.\n",
+                       rc, SASL_BUILD_VERSION, 0 );
+#else
+               Debug( LDAP_DEBUG_ANY,
+               "ldap_int_sasl_init: SASL version mismatch, got %x, wanted %x.\n",
+                       rc, SASL_BUILD_VERSION, 0 );
+#endif
+               return -1;
+       }
+       }
+#endif
        if ( sasl_initialized ) {
                return 0;
        }
@@ -83,6 +105,10 @@ int ldap_int_sasl_init( void )
                return 0;
        }
 
+#if SASL_VERSION_MAJOR < 2
+       /* A no-op to make sure we link with Cyrus 1.5 */
+       sasl_client_auth( NULL, NULL, NULL, 0, NULL, NULL );
+#endif
        return -1;
 }