diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c
index bf4d839e4420bf27e4bd2477b4604f77fab48044..19a7a078862c1b4d89cf6ca8db5a2d9406ece8c7 100644
--- a/libraries/libldap/cyrus.c
+++ b/libraries/libldap/cyrus.c
@@ -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;
 	}
diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c
index 740e33888ec0a23d3ce6e90824c8e8cda11d7952..8a5a468af165e6157970f6833c6d311e00138870 100644
--- a/servers/slapd/back-bdb/init.c
+++ b/servers/slapd/back-bdb/init.c
@@ -615,13 +615,14 @@ bdb_initialize(
 		{
 #ifdef NEW_LOGGING
 			LDAP_LOG( BACK_BDB, ERR, 
-				"bdb_db_initialize: version mismatch: "
-				"\texpected: %s \tgot: %s\n", DB_VERSION_STRING, version, 0 );
+				"bdb_initialize: BDB library version mismatch:"
+				" expected " DB_VERSION_STRING ","
+				" got %s\n", version, 0, 0 );
 #else
 			Debug( LDAP_DEBUG_ANY,
-				"bdb_initialize: version mismatch\n"
-				"\texpected: " DB_VERSION_STRING "\n"
-				"\tgot: %s \n", version, 0, 0 );
+				"bdb_initialize: BDB library version mismatch:"
+				" expected " DB_VERSION_STRING ","
+				" got %s\n", version, 0, 0 );
 #endif
 		}
 
diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c
index feb4d5ecb6385d94562446b43d7763095d7221e8..527e95cda90308bfdbe1eb1a1ad30aa886553931 100644
--- a/servers/slapd/sasl.c
+++ b/servers/slapd/sasl.c
@@ -965,21 +965,28 @@ int slap_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)
 
 	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,
-		"slap_sasl_init: SASL version mismatch, got %x, wanted %x.\n",
-			rc, SASL_BUILD_VERSION, 0 );
+		"slap_sasl_init: SASL library version mismatch:"
+		" expected " SASL_VERSION_STRING ","
+		" got %s\n", version, 0, 0 );
 #else
 		Debug( LDAP_DEBUG_ANY,
-		"slap_sasl_init: SASL version mismatch, got %x, wanted %x.\n",
-			rc, SASL_BUILD_VERSION, 0 );
+		"slap_sasl_init: SASL library version mismatch:"
+		" expected " SASL_VERSION_STRING ","
+		" got %s\n", version, 0, 0 );
 #endif
 		return -1;
 	}