diff --git a/modules/ldap/util_ldap.c b/modules/ldap/util_ldap.c index d771fc8ef5..7bf7213673 100644 --- a/modules/ldap/util_ldap.c +++ b/modules/ldap/util_ldap.c @@ -2401,6 +2401,10 @@ static const char *util_ldap_set_referral_hop_limit(cmd_parms *cmd, dc->ReferralHopLimit = atol(hop_limit); + if (dc->ReferralHopLimit <= 0) { + return "LDAPReferralHopLimit must be greater than zero (Use 'LDAPReferrals Off' to disable referral chasing)"; + } + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, cmd->server, "LDAP: Limit chased referrals to maximum of %d hops.", dc->ReferralHopLimit);