From 02449639358d00c68ea724b2120d8d4f6983e3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Fri, 10 Oct 2008 14:57:44 +0000 Subject: [PATCH] Replace jlib:nameprep/1 by exmpp_stringprep:nameprep/1 and change the error handling. PR: EJABP-1 SVN Revision: 1625 --- ChangeLog | 7 ++++--- src/ejabberd_ctl.erl | 25 +++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 997cedfe0..c0da44308 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,9 +9,9 @@ exmpp_jid:jid_to_list/3. Thanks to Pablo Polvorin! * src/ejabberd_s2s_in.erl (wait_for_feature_request/2), - src/ejabberd_router.erl (register_route/2, unregister_route/1): - Replace jlib:nameprep/1 by exmpp_stringprep:nameprep/1 and change the - error handling. + src/ejabberd_router.erl (register_route/2, unregister_route/1), + src/ejabberd_ctl.erl (process/1): Replace jlib:nameprep/1 by + exmpp_stringprep:nameprep/1 and change the error handling. * src/ejabberd_config.erl (normalize_hosts/2): Replace jlib:nodeprep/1 by exmpp_stringprep:nodeprep/1 and change the error handling. @@ -28,6 +28,7 @@ * src/mod_roster_odbc.erl (user_roster_subscribe_jid/3): Fix a bug where the wrong module was called (jlib instead of exmpp_jid). + * src/ejabberd_ctl.erl (process/1): 2008-10-09 Jean-Sébastien Pédron * src/ejabberd_c2s.erl: Fix handling of unauthenticated stanzas which diff --git a/src/ejabberd_ctl.erl b/src/ejabberd_ctl.erl index c66b93a38..adc54c44d 100644 --- a/src/ejabberd_ctl.erl +++ b/src/ejabberd_ctl.erl @@ -243,19 +243,20 @@ process(["delete-old-messages", Days]) -> end; process(["vhost", H | Args]) -> - case jlib:nameprep(H) of - false -> + try + Host = exmpp_stringprep:nameprep(H), + case ejabberd_hooks:run_fold( + ejabberd_ctl_process, Host, false, [Host, Args]) of + false -> + print_vhost_usage(Host), + ?STATUS_USAGE; + Status -> + Status + end + catch + _ -> ?PRINT("Bad hostname: ~p~n", [H]), - ?STATUS_ERROR; - Host -> - case ejabberd_hooks:run_fold( - ejabberd_ctl_process, Host, false, [Host, Args]) of - false -> - print_vhost_usage(Host), - ?STATUS_USAGE; - Status -> - Status - end + ?STATUS_ERROR end; process(Args) ->