diff options
author | Badlop <badlop@process-one.net> | 2012-06-27 11:10:48 +0200 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2012-06-27 11:10:48 +0200 |
commit | 2bf8125abfeec9e1176ea7ab9793b8947f9c09b6 (patch) | |
tree | 2ade796b0da6dfed2a5786d686daba39bf82fafa /src | |
parent | Check node name is available before starting ejabberd (EJAB-1572) (diff) |
Allow multiple fqdn values in configuration (EJAB-1578)
Diffstat (limited to 'src')
-rw-r--r-- | src/cyrsasl_digest.erl | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/cyrsasl_digest.erl b/src/cyrsasl_digest.erl index 134a86daf..056df3356 100644 --- a/src/cyrsasl_digest.erl +++ b/src/cyrsasl_digest.erl @@ -165,14 +165,25 @@ parse4([], Key, Val, Ts) -> is_digesturi_valid(DigestURICase, JabberDomain, JabberFQDN) -> DigestURI = stringprep:tolower(DigestURICase), case catch string:tokens(DigestURI, "/") of - ["xmpp", Host] when (Host == JabberDomain) or (Host == JabberFQDN) -> - true; - ["xmpp", Host, ServName] when (ServName == JabberDomain) and (Host == JabberFQDN) -> - true; + ["xmpp", Host] -> + IsHostFqdn = is_host_fqdn(Host, JabberFQDN), + (Host == JabberDomain) or IsHostFqdn; + ["xmpp", Host, ServName] -> + IsHostFqdn = is_host_fqdn(Host, JabberFQDN), + (ServName == JabberDomain) and IsHostFqdn; _ -> false end. +is_host_fqdn(Host, [Letter | _Tail] = Fqdn) when not is_list(Letter) -> + Host == Fqdn; +is_host_fqdn(_Host, []) -> + false; +is_host_fqdn(Host, [Fqdn | _FqdnTail]) when Host == Fqdn -> + true; +is_host_fqdn(Host, [Fqdn | FqdnTail]) when Host /= Fqdn -> + is_host_fqdn(Host, FqdnTail). + get_local_fqdn() -> case (catch get_local_fqdn2()) of Str when is_list(Str) -> Str; |