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

Fix the error report of an incorrect certfile

This commit is contained in:
Evgeniy Khramtsov 2013-06-15 01:30:20 +10:00 committed by Alexey Shchepin
parent c9efdf6167
commit b50a4948ed
2 changed files with 9 additions and 6 deletions

View File

@ -410,20 +410,22 @@ process_term(Term, State) ->
{s2s_use_starttls, Port} -> {s2s_use_starttls, Port} ->
add_option(s2s_use_starttls, Port, State); add_option(s2s_use_starttls, Port, State);
{s2s_certfile, CertFile} -> {s2s_certfile, CertFile} ->
case ejabberd_config:is_file_readable(CertFile) of CertFileS = binary_to_list(CertFile),
case ejabberd_config:is_file_readable(CertFileS) of
true -> add_option(s2s_certfile, CertFile, State); true -> add_option(s2s_certfile, CertFile, State);
false -> false ->
ErrorText = "There is a problem in the configuration: " ErrorText = "There is a problem in the configuration: "
"the specified file is not readable: ", "the specified file is not readable: ",
throw({error, ErrorText ++ CertFile}) throw({error, ErrorText ++ CertFileS})
end; end;
{domain_certfile, Domain, CertFile} -> {domain_certfile, Domain, CertFile} ->
case ejabberd_config:is_file_readable(CertFile) of CertFileS = binary_to_list(CertFile),
case ejabberd_config:is_file_readable(CertFileS) of
true -> add_option({domain_certfile, Domain}, CertFile, State); true -> add_option({domain_certfile, Domain}, CertFile, State);
false -> false ->
ErrorText = "There is a problem in the configuration: " ErrorText = "There is a problem in the configuration: "
"the specified file is not readable: ", "the specified file is not readable: ",
throw({error, ErrorText ++ CertFile}) throw({error, ErrorText ++ CertFileS})
end; end;
{node_type, NodeType} -> {node_type, NodeType} ->
add_option(node_type, NodeType, State); add_option(node_type, NodeType, State);

View File

@ -491,9 +491,10 @@ certfile_readable(Opts) ->
case proplists:lookup(certfile, Opts) of case proplists:lookup(certfile, Opts) of
none -> true; none -> true;
{certfile, Path} -> {certfile, Path} ->
case ejabberd_config:is_file_readable(Path) of PathS = binary_to_list(Path),
case ejabberd_config:is_file_readable(PathS) of
true -> true; true -> true;
false -> {false, Path} false -> {false, PathS}
end end
end. end.