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

fix previous partial patch (EJAB-840)

SVN Revision: 1799
This commit is contained in:
Christophe Romain 2009-01-11 01:45:24 +00:00
parent c170783a49
commit 8090011126

View File

@ -286,7 +286,6 @@ subscribe_node(Host, Node, Sender, Subscriber, AccessModel,
_ -> get_state(Host, Node, SubKey) _ -> get_state(Host, Node, SubKey)
end, end,
Affiliation = GenState#pubsub_state.affiliation, Affiliation = GenState#pubsub_state.affiliation,
Subscription = SubState#pubsub_state.subscription,
Whitelisted = lists:member(Affiliation, [member, publisher, owner]), Whitelisted = lists:member(Affiliation, [member, publisher, owner]),
if if
not Authorized -> not Authorized ->
@ -295,7 +294,7 @@ subscribe_node(Host, Node, Sender, Subscriber, AccessModel,
Affiliation == outcast -> Affiliation == outcast ->
%% Requesting entity is blocked %% Requesting entity is blocked
{error, ?ERR_FORBIDDEN}; {error, ?ERR_FORBIDDEN};
Subscription == pending -> SubState#pubsub_state.subscription == pending ->
%% Requesting entity has pending subscription %% Requesting entity has pending subscription
{error, ?ERR_EXTENDED(?ERR_NOT_AUTHORIZED, "pending-subscription")}; {error, ?ERR_EXTENDED(?ERR_NOT_AUTHORIZED, "pending-subscription")};
(AccessModel == presence) and (not PresenceSubscription) -> (AccessModel == presence) and (not PresenceSubscription) ->
@ -350,19 +349,12 @@ subscribe_node(Host, Node, Sender, Subscriber, AccessModel,
unsubscribe_node(Host, Node, Sender, Subscriber, _SubId) -> unsubscribe_node(Host, Node, Sender, Subscriber, _SubId) ->
SubKey = jlib:jid_tolower(Subscriber), SubKey = jlib:jid_tolower(Subscriber),
GenKey = jlib:jid_remove_resource(SubKey), GenKey = jlib:jid_remove_resource(SubKey),
SenderKey = jlib:jid_tolower(jlib:jid_remove_resource(Sender)), Authorized = (jlib:jid_tolower(jlib:jid_remove_resource(Sender)) == GenKey),
GenState = get_state(Host, Node, GenKey), GenState = get_state(Host, Node, GenKey),
SubState = case SubKey of SubState = case SubKey of
GenKey -> GenState; GenKey -> GenState;
_ -> get_state(Host, Node, SubKey) _ -> get_state(Host, Node, SubKey)
end, end,
Authorized = case SenderKey of
GenKey ->
true;
_ ->
SenderState = get_state(Host, Node, SenderKey),
SenderState#pubsub_state.affiliation == owner
end,
if if
%% Entity did not specify SubID %% Entity did not specify SubID
%%SubID == "", ?? -> %%SubID == "", ?? ->