]> granicus.if.org Git - ejabberd/commitdiff
mod_register_web: check same acl as mod_register.
authorHAMANO Tsukasa <hamano@cuspy.org>
Thu, 3 Apr 2014 19:07:29 +0000 (04:07 +0900)
committerHAMANO Tsukasa <hamano@cuspy.org>
Thu, 3 Apr 2014 19:07:29 +0000 (04:07 +0900)
src/mod_register_web.erl

index cade4bcc8ee602ee92bce4908273e7825a2810eb..cbb6cd0826f39f6457cc91c77d88b7f2fd0708e1 100644 (file)
@@ -485,9 +485,15 @@ form_del_get(Host, Lang) ->
 %%                                    {error, not_allowed} |
 %%                                    {error, invalid_jid}
 register_account(Username, Host, Password) ->
-    case jlib:make_jid(Username, Host, <<"">>) of
-      error -> {error, invalid_jid};
-      _ -> register_account2(Username, Host, Password)
+    Access = gen_mod:get_module_opt(Host, mod_register, access,
+                                    fun(A) when is_atom(A) -> A end,
+                                    all),
+    JID = jlib:make_jid(Username, Host, <<"">>),
+    Match = acl:match_rule(Host, Access, JID),
+    case {JID, Match} of
+      {error, _} -> {error, invalid_jid};
+      {_, deny} -> {error, not_allowed};
+      {_, allow} -> register_account2(Username, Host, Password)
     end.
 
 register_account2(Username, Host, Password) ->