Browse Source

add a hack to disable sasl hostname canonicalization - helps with testing when you don't want to set up correct host name resolution and/or cannot set the default system hostname
Reviewed by: nhosoi (Thanks!)

Rich Megginson 14 years ago
parent
commit
6aaeb77220
1 changed files with 11 additions and 0 deletions
  1. 11 0
      ldap/servers/slapd/ldaputil.c

+ 11 - 0
ldap/servers/slapd/ldaputil.c

@@ -726,6 +726,17 @@ slapi_ldap_init_ext(
     /* must explicitly set version to 3 */
     ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &ldap_version3);
 
+#if defined(USE_OPENLDAP)
+    if (getenv("HACK_SASL_NOCANON")) {
+	/* the NONCANON flag tells openldap to use the hostname specified in
+	   the ldap_initialize command, rather than looking up the 
+	   hostname using gethostname or similar - this allows running
+	   sasl/gssapi tests on machines that don't have a canonical
+	   hostname (such as localhost.localdomain)
+	*/
+	ldap_set_option(ld, LDAP_OPT_X_SASL_NOCANON, LDAP_OPT_ON);
+    }
+#endif /* !USE_OPENLDAP */
     /* Update snmp interaction table */
     if (hostname) {
 	if (ld == NULL) {