From 0a8b02d0c733092f9c10ab2157e9b83475ead3fc Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 19 Dec 2011 09:17:54 -0700 Subject: [PATCH] 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 --- ldap/servers/slapd/ldaputil.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/ldap/servers/slapd/ldaputil.c b/ldap/servers/slapd/ldaputil.c index 34aa12e..c4cec12 100644 --- a/ldap/servers/slapd/ldaputil.c +++ b/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) { -- 1.7.1