Created
April 29, 2012 00:15
-
-
Save lehrblogger/2522843 to your computer and use it in GitHub Desktop.
modifications to ejabberd to whitelist registration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~/Desktop/vagrant_1/code/ejabberd/src 176$ diff ejabberd.cfg ejabberd.cfg.example | |
368c368 | |
< {acl, admin, {user, "admin1", "localhost"}}. | |
--- | |
> %%{acl, admin, {user, "aleksey", "localhost"}}. | |
391,395d390 | |
< %% Unauthenticated users | |
< %% | |
< {acl, unauthenticated, {user, "", ""}}. | |
< | |
< %% | |
450,455d444 | |
< %% Only admins can register accounts, not even unauthenticated users (requires patch) | |
< %%{access, register_from, [{allow, admin}, {deny, all}]}. | |
< | |
< %% Only authenticated users can register (requires patch) | |
< {access, register_from, [{deny, unauthenticated}, {allow, all}]}. | |
< | |
458c447 | |
< {registration_timeout, infinity}. | |
--- | |
> %%{registration_timeout, 600}. | |
570c559 | |
< {registration_watchers, ["admin1@localhost"]}, | |
--- | |
> %%{registration_watchers, ["[email protected]"]}, | |
576d564 | |
< {allow, "10.0.2.2/8"}, | |
583d570 | |
< {access_from, register_from}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/mod_register.erl b/src/mod_register.erl | |
index 8f441a0..e8b13e6 100644 | |
--- a/src/mod_register.erl | |
+++ b/src/mod_register.erl | |
@@ -414,10 +414,12 @@ send_registration_notifications(UJID, Source) -> | |
ok | |
end. | |
-check_from(#jid{user = "", server = ""}, _Server) -> | |
- deny; | |
+% check_from(#jid{user = "", server = ""}, _Server) -> | |
+% ?WARNING_MSG("First check_from: deny (always)~n", []), | |
+% deny; | |
check_from(JID, Server) -> | |
Access = gen_mod:get_module_opt(Server, ?MODULE, access_from, none), | |
+ ?WARNING_MSG("Second check_from: ~p for (Server: ~p, Access:~p, JID: ~p)~n", [acl:match_rule(Server, Access, JID), Server, Access, JID]), | |
acl:match_rule(Server, Access, JID). | |
check_timeout(undefined) -> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment