--- mod_ldap_userdir.c.orig 2006-04-27 12:23:04.000000000 -0600 +++ mod_ldap_userdir.c 2006-05-04 13:10:15.000000000 -0600 @@ -304,11 +304,11 @@ { ldap_userdir_config *s_cfg = (ldap_userdir_config *) ap_get_module_config(cmd->server->module_config, &ldap_userdir_module); - if (strlen(dn) == 0) { - return "LDAPUserDirDNInfo must be supplied with a LDAP DN to bind as."; + if (dn == NULL || strlen(dn) == 0) { + return "LDAPUserDirDNInfo must be supplied with a LDAP DN to bind as. For anonymous bind, remove the LDAPUserDirDNInfo directive."; } - if (strlen(pass) == 0) { - return "LDAPUserDirDNInfo must be supplied with a password to bind with."; + if (pass == NULL || strlen(pass) == 0) { + return "LDAPUserDirDNInfo must be supplied with a password to bind with. For anonymous bind, remove the LDAPUserDirDNInfo directive."; } s_cfg->ldap_dn = (char *)dn; @@ -510,7 +510,7 @@ } #endif /* TLS */ - if ((ret = ldap_simple_bind_s(s_cfg->ld, s_cfg->ldap_dn, s_cfg->dn_pass)) != LDAP_SUCCESS) { + if (s_cfg->ldap_dn && s_cfg->dn_pass && (ret = ldap_simple_bind_s(s_cfg->ld, s_cfg->ldap_dn, s_cfg->dn_pass)) != LDAP_SUCCESS) { #ifdef STANDARD20_MODULE_STUFF ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, NULL, "mod_ldap_userdir: ldap_simple_bind() as %s failed: %s", s_cfg->ldap_dn, ldap_err2string(ret)); #else