25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Allow multiple fqdn values in configuration (EJAB-1578)

This commit is contained in:
Badlop 2012-06-27 11:10:48 +02:00
parent 75756f0fc9
commit 2bf8125abf
2 changed files with 16 additions and 5 deletions

View File

@ -1241,7 +1241,7 @@ The option \option{fqdn} allows you to define the Fully Qualified Domain Name
of the machine, in case it isn't detected automatically.
The FQDN is used to authenticate some clients that use the DIGEST-MD5 SASL mechanism.
The option syntax is:
\esyntax{\{fqdn, undefined|FqdnString\}.}
\esyntax{\{fqdn, undefined|FqdnString|[FqdnString]\}.}
\makesubsubsection{internalauth}{Internal}
\ind{internal authentication}\ind{Mnesia}

View File

@ -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;