]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/cyrus.c
Changes from HEAD for beta
[openldap] / libraries / libldap / cyrus.c
index bf4d839e4420bf27e4bd2477b4604f77fab48044..baf0d1b1d98987af7eecc413c1ad4068046db0e7 100644 (file)
@@ -57,22 +57,29 @@ int ldap_int_sasl_init( void )
        };
 
 #ifdef HAVE_SASL_VERSION
-#define SASL_BUILD_VERSION ((SASL_VERSION_MAJOR << 24) |\
-       (SASL_VERSION_MINOR << 16) | SASL_VERSION_STEP)
-
+       /* stringify the version number, sasl.h doesn't do it for us */
+#define VSTR0(maj, min, pat)   #maj "." #min "." #pat
+#define VSTR(maj, min, pat)    VSTR0(maj, min, pat)
+#define SASL_VERSION_STRING    VSTR(SASL_VERSION_MAJOR, SASL_VERSION_MINOR, \
+                               SASL_VERSION_STEP)
        { int rc;
        sasl_version( NULL, &rc );
        if ( ((rc >> 16) != ((SASL_VERSION_MAJOR << 8)|SASL_VERSION_MINOR)) ||
                (rc & 0xffff) < SASL_VERSION_STEP) {
+               char version[sizeof("xxx.xxx.xxxxx")];
+               sprintf( version, "%d.%d.%d", rc >> 24, rc >> 16 * 0xff,
+                       rc & 0xffff );
 
 #ifdef NEW_LOGGING
                LDAP_LOG( TRANSPORT, INFO,
-               "ldap_int_sasl_init: SASL version mismatch, got %x, wanted %x.\n",
-                       rc, SASL_BUILD_VERSION, 0 );
+               "ldap_int_sasl_init: SASL library version mismatch:"
+               " expected " SASL_VERSION_STRING ","
+               " got %s\n", version, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,
-               "ldap_int_sasl_init: SASL version mismatch, got %x, wanted %x.\n",
-                       rc, SASL_BUILD_VERSION, 0 );
+               "ldap_int_sasl_init: SASL library version mismatch:"
+               " expected " SASL_VERSION_STRING ","
+               " got %s\n", version, 0, 0 );
 #endif
                return -1;
        }
@@ -146,6 +153,9 @@ sb_sasl_setup( Sockbuf_IO_Desc *sbiod, void *arg )
        }
        sasl_getprop( p->sasl_context, SASL_MAXOUTBUF,
                (SASL_CONST void **) &p->sasl_maxbuf );
+           
+       if ( p->sasl_maxbuf == 0 )
+               p->sasl_maxbuf = SASL_MAX_BUFF_SIZE;
 
        sbiod->sbiod_pvt = p;