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} ->
add_option(s2s_use_starttls, Port, State);
{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);
false ->
ErrorText = "There is a problem in the configuration: "
"the specified file is not readable: ",
throw({error, ErrorText ++ CertFile})
throw({error, ErrorText ++ CertFileS})
end;
{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);
false ->
ErrorText = "There is a problem in the configuration: "
"the specified file is not readable: ",
throw({error, ErrorText ++ CertFile})
throw({error, ErrorText ++ CertFileS})
end;
{node_type, NodeType} ->
add_option(node_type, NodeType, State);

View File

@ -491,9 +491,10 @@ certfile_readable(Opts) ->
case proplists:lookup(certfile, Opts) of
none -> true;
{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;
false -> {false, Path}
false -> {false, PathS}
end
end.