ejabberd - Comments for "Restrict users&amp;#039; write access to their own vcards" https://www.ejabberd.im/node/15194 en You are right, most ejabberd https://www.ejabberd.im/node/15194#comment-64026 <p>You are right, most ejabberd internal information is now stored as binaries like &lt;&lt;"this"&gt;&gt;, not as string like "this".</p> Wed, 21 May 2014 14:29:19 +0000 mfoss comment 64026 at https://www.ejabberd.im Sorry, for taking to long to https://www.ejabberd.im/node/15194#comment-64021 <p>Sorry, for taking to long to respond. But thanks for this!</p> <p>I tried applying this to 14.05, but it required a minor change to work as intended. I don't know if this was just a typo in the original patch, or if the data structure actually changed since then.</p> <p>This is the patch I ended up applying:</p> <div class="codeblock"><code>diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl<br />index 3b70fe2..c951ff2 100644<br />--- a/src/mod_vcard.erl<br />+++ b/src/mod_vcard.erl<br />@@ -181,7 +181,8 @@ process_sm_iq(From, To, #iq{type = Type, sub_el = SubEl} = IQ) -&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp; case Type of<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set -&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #jid{user = User, lserver = LServer} = From,<br />-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case lists:member(LServer, ?MYHOSTS) of<br />+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case (From#jid.resource == &lt;&lt;&quot;mod_admin_extra&quot;&gt;&gt;)<br />+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; andalso (lists:member(LServer, ?MYHOSTS)) of<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; true -&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set_vcard(User, LServer, SubEl),<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IQ#iq{type = result, sub_el = []};</code></div> <p>Thanks again!</p> <p>Jesper.</p> Wed, 21 May 2014 11:03:06 +0000 nyerup comment 64021 at https://www.ejabberd.im Write access to vcard isn't https://www.ejabberd.im/node/15194#comment-61631 <p>Write access to vcard isn't configurable.</p> <p>But with this change in the ejabberd source code, only requests made from a session with resource "mod_admin_extra" will succeed. Your ejabberdctl calls send stanzas with that resource, so they succeed. Of course, this means that other client could also modify his vcard, if he knows what resource he must use to login.</p> <pre> diff --git a/src/mod_vcard.erl b/src/mod_vcard.erl index 3b70fe2..c951ff2 100644 --- a/src/mod_vcard.erl +++ b/src/mod_vcard.erl @@ -181,7 +181,8 @@ process_sm_iq(From, To, #iq{type = Type, sub_el = SubEl} = IQ) -&gt; case Type of set -&gt; #jid{user = User, lserver = LServer} = From, - case lists:member(LServer, ?MYHOSTS) of + case (From#jid.resource == "mod_admin_extra") + andalso (lists:member(LServer, ?MYHOSTS)) of true -&gt; set_vcard(User, LServer, SubEl), IQ#iq{type = result, sub_el = []}; </pre> Thu, 03 Oct 2013 15:46:30 +0000 mfoss comment 61631 at https://www.ejabberd.im