From b50a4948ed12e1692269d7be310b221928e590e2 Mon Sep 17 00:00:00 2001 From: Evgeniy Khramtsov Date: Sat, 15 Jun 2013 01:30:20 +1000 Subject: [PATCH] Fix the error report of an incorrect certfile --- src/ejabberd_config.erl | 10 ++++++---- src/ejabberd_listener.erl | 5 +++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ejabberd_config.erl b/src/ejabberd_config.erl index fa38847a0..2e82e5a0b 100644 --- a/src/ejabberd_config.erl +++ b/src/ejabberd_config.erl @@ -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); diff --git a/src/ejabberd_listener.erl b/src/ejabberd_listener.erl index a8ccc186a..be90cf92f 100644 --- a/src/ejabberd_listener.erl +++ b/src/ejabberd_listener.erl @@ -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.