ejabberd - Comments for "in-band unregistration doesn&amp;#039;t work" https://www.ejabberd.im/node/5255 en badlop wrote: --- https://www.ejabberd.im/node/5255#comment-58436 <div class="quote-msg"> <div class="quote-author"><em>badlop</em> wrote:</div> <pre> --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -319,6 +319,8 @@ try_set_password(User, Server, Password, IQ, SubEl, Lang) -&gt; end. try_register(User, Server, Password, SourceRaw, Lang) -&gt; + {error, ?ERR_FORBIDDEN}; +try_register(User, Server, Password, SourceRaw, Lang) -&gt; case jlib:is_nodename(User) of false -&gt; {error, ?ERR_BAD_REQUEST}; </pre></div> <p>Thanks. I created a mod_unregister and applied the patch.<br /> I couldn't compile it outside of the ejabberd git tree though:</p> <pre> muelli@fs:~/ejabberd-mod_unregister$ make erl -pa "/var/lib/ejabberd/ejabberd-modules.svn/ejabberd-dev/trunk/ebin" -pz ebin -make {"init terminating in do_boot",{badarg,[{erl_prim_loader,check_file_result,3,[]},{init,patch_dir,2,[]},{init,'-patch_path/2-lc$^0/1-0-',2,[]},{init,eval_script,8,[]},{init,do_boot,3,[]}]}} Crash dump was written to: erl_crash.dump init terminating in do_boot () make: *** [mod_unregister.ebeam] Error 1 muelli@fs:~/ejabberd-mod_unregister$ </pre><p> Letting the file live just next to mod_register works.</p> <p>And the module seems to work, too :-) thanks!</p> <p>I used the webinterface to load the mod_register and load mod_unregister. Interestingly, registering still works (we had it enabled for a different domain) but that's not a problem. I presume this will be solved with a restart of ejabberd.</p> Tue, 13 Mar 2012 16:25:29 +0000 muelli comment 58436 at https://www.ejabberd.im muelli wrote: Interesting https://www.ejabberd.im/node/5255#comment-58428 <div class="quote-msg"> <div class="quote-author"><em>muelli</em> wrote:</div> <p>Interesting approach.</p> <p>Is there a way to put that in a module so that I don't have to patch ejabberd again once I update it?</p> <p>Maybe I can copy mod_register to mod_unregister and somehow not load mod_register?</p></div> <p>Yes, and replace the line: -module(mod_register). with: -module(mod_unregister).</p> <p>Compile your module, copy it where all the others, disable mod_register and enable mod_unregister.</p> Sun, 11 Mar 2012 00:26:07 +0000 mfoss comment 58428 at https://www.ejabberd.im Interesting approach. Is https://www.ejabberd.im/node/5255#comment-58427 <p>Interesting approach.</p> <p>Is there a way to put that in a module so that I don't have to patch ejabberd again once I update it?</p> <p>Maybe I can copy mod_register to mod_unregister and somehow not load mod_register?</p> Sat, 10 Mar 2012 21:31:58 +0000 muelli comment 58427 at https://www.ejabberd.im You are right in your https://www.ejabberd.im/node/5255#comment-58421 <p>You are right in your understanding. And there isn't any option right now in ejabberd to solve your question.</p> <p>But if you can modify the source code and compile it, then you can apply this small change that breaks registration, so it is always disallowed:</p> <pre> --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -319,6 +319,8 @@ try_set_password(User, Server, Password, IQ, SubEl, Lang) -&gt; end. try_register(User, Server, Password, SourceRaw, Lang) -&gt; + {error, ?ERR_FORBIDDEN}; +try_register(User, Server, Password, SourceRaw, Lang) -&gt; case jlib:is_nodename(User) of false -&gt; {error, ?ERR_BAD_REQUEST}; </pre> Thu, 08 Mar 2012 09:29:35 +0000 mfoss comment 58421 at https://www.ejabberd.im