25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Use "jabber:" namespace that clients cannot use (#4201)

As mentioned in:
  Certain namespaces are reserved in Jabber (namespaces beginning with
  'jabber:' or 'http://jabber.org/', as well as 'vcard-temp').
  If a user attempts to get or set jabber:iq:private data in a reserved
  namespace, historically some server implementations have chosen to
  return an error (commonly "Not Acceptable") to the sender.

  https://xmpp.org/extensions/xep-0049.html#example-5
This commit is contained in:
Badlop 2024-04-24 20:17:02 +02:00
parent 374f6b8e7d
commit 2bfc4b0f5d

View File

@ -1099,7 +1099,7 @@ set_random_password_v2(User, Server) ->
build_ban_xmlel(Reason, Pass, {LastDate, LastReason}, BanDate, Hash) -> build_ban_xmlel(Reason, Pass, {LastDate, LastReason}, BanDate, Hash) ->
PassEls = build_pass_els(Pass), PassEls = build_pass_els(Pass),
#xmlel{name = <<"banned">>, #xmlel{name = <<"banned">>,
attrs = [{<<"xmlns">>, <<"ejabberd:banned">>}], attrs = [{<<"xmlns">>, <<"jabber:ejabberd:banned">>}],
children = [#xmlel{name = <<"reason">>, attrs = [], children = [{xmlcdata, Reason}]}, children = [#xmlel{name = <<"reason">>, attrs = [], children = [{xmlcdata, Reason}]},
#xmlel{name = <<"password">>, attrs = [], children = PassEls}, #xmlel{name = <<"password">>, attrs = [], children = PassEls},
#xmlel{name = <<"lastdate">>, attrs = [], children = [{xmlcdata, LastDate}]}, #xmlel{name = <<"lastdate">>, attrs = [], children = [{xmlcdata, LastDate}]},
@ -1126,7 +1126,7 @@ build_pass_els(#scram{storedkey = StoredKey,
%% Get ban details %% Get ban details
get_ban_details(User, Host) -> get_ban_details(User, Host) ->
[El] = private_get2(User, Host, <<"banned">>, <<"ejabberd:banned">>), [El] = private_get2(User, Host, <<"banned">>, <<"jabber:ejabberd:banned">>),
Reason = fxml:get_subtag_cdata(El, <<"reason">>), Reason = fxml:get_subtag_cdata(El, <<"reason">>),
LastDate = fxml:get_subtag_cdata(El, <<"lastdate">>), LastDate = fxml:get_subtag_cdata(El, <<"lastdate">>),
LastReason = fxml:get_subtag_cdata(El, <<"lastreason">>), LastReason = fxml:get_subtag_cdata(El, <<"lastreason">>),
@ -1168,7 +1168,7 @@ unban_account2(User, Host) ->
private_set2(User, Host, UnBanPrivateXml). private_set2(User, Host, UnBanPrivateXml).
get_oldpass(User, Host) -> get_oldpass(User, Host) ->
[El] = private_get2(User, Host, <<"banned">>, <<"ejabberd:banned">>), [El] = private_get2(User, Host, <<"banned">>, <<"jabber:ejabberd:banned">>),
Pass = fxml:get_subtag(El, <<"password">>), Pass = fxml:get_subtag(El, <<"password">>),
get_pass(Pass). get_pass(Pass).
@ -1187,7 +1187,7 @@ get_pass(#xmlel{children = ScramEls} = Pass) when is_list(ScramEls) ->
iterationcount = binary_to_integer(IterationCount)}. iterationcount = binary_to_integer(IterationCount)}.
build_unban_xmlel() -> build_unban_xmlel() ->
#xmlel{name = <<"banned">>, attrs = [{<<"xmlns">>, <<"ejabberd:banned">>}]}. #xmlel{name = <<"banned">>, attrs = [{<<"xmlns">>, <<"jabber:ejabberd:banned">>}]}.
%%% %%%
%%% Sessions %%% Sessions