mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
* src/mod_roster_odbc.erl: Better error management when bad JID in roster table (EJAB-289).
SVN Revision: 835
This commit is contained in:
parent
bf416ad52d
commit
888acbdb2e
@ -1,3 +1,8 @@
|
|||||||
|
2007-07-28 Mickael Remond <mickael.remond@process-one.net>
|
||||||
|
|
||||||
|
* src/mod_roster_odbc.erl: Better error management when bad JID in
|
||||||
|
roster table (EJAB-289).
|
||||||
|
|
||||||
2007-07-26 Mickael Remond <mickael.remond@process-one.net>
|
2007-07-26 Mickael Remond <mickael.remond@process-one.net>
|
||||||
|
|
||||||
* src/web/ejabberd_web_admin.erl: Code clean-up.
|
* src/web/ejabberd_web_admin.erl: Code clean-up.
|
||||||
|
@ -140,6 +140,7 @@ get_user_roster(Acc, {LUser, LServer}) ->
|
|||||||
RItems = lists:flatmap(
|
RItems = lists:flatmap(
|
||||||
fun(I) ->
|
fun(I) ->
|
||||||
case raw_to_record(LServer, I) of
|
case raw_to_record(LServer, I) of
|
||||||
|
%% Bad JID in database:
|
||||||
error ->
|
error ->
|
||||||
[];
|
[];
|
||||||
#roster{subscription = none,
|
#roster{subscription = none,
|
||||||
@ -223,11 +224,20 @@ process_item_set(From, To, {xmlelement, _Name, Attrs, Els}) ->
|
|||||||
us = {LUser, LServer},
|
us = {LUser, LServer},
|
||||||
jid = LJID};
|
jid = LJID};
|
||||||
[I] ->
|
[I] ->
|
||||||
(raw_to_record(LServer, I))#roster{
|
R = raw_to_record(LServer, I),
|
||||||
usj = {LUser, LServer, LJID},
|
case R of
|
||||||
us = {LUser, LServer},
|
%% Bad JID in database:
|
||||||
jid = LJID,
|
error ->
|
||||||
name = ""}
|
#roster{usj = {LUser, LServer, LJID},
|
||||||
|
us = {LUser, LServer},
|
||||||
|
jid = LJID};
|
||||||
|
_ ->
|
||||||
|
R#roster{
|
||||||
|
usj = {LUser, LServer, LJID},
|
||||||
|
us = {LUser, LServer},
|
||||||
|
jid = LJID,
|
||||||
|
name = ""}
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
Item1 = process_item_attrs(Item, Attrs),
|
Item1 = process_item_attrs(Item, Attrs),
|
||||||
Item2 = process_item_els(Item1, Els),
|
Item2 = process_item_els(Item1, Els),
|
||||||
@ -388,16 +398,22 @@ get_subscription_lists(_, User, Server) ->
|
|||||||
|
|
||||||
fill_subscription_lists(LServer, [RawI | Is], F, T) ->
|
fill_subscription_lists(LServer, [RawI | Is], F, T) ->
|
||||||
I = raw_to_record(LServer, RawI),
|
I = raw_to_record(LServer, RawI),
|
||||||
J = I#roster.jid,
|
case I of
|
||||||
case I#roster.subscription of
|
%% Bad JID in database:
|
||||||
both ->
|
error ->
|
||||||
fill_subscription_lists(LServer, Is, [J | F], [J | T]);
|
fill_subscription_lists(LServer, Is, F, T);
|
||||||
from ->
|
|
||||||
fill_subscription_lists(LServer, Is, [J | F], T);
|
|
||||||
to ->
|
|
||||||
fill_subscription_lists(LServer, Is, F, [J | T]);
|
|
||||||
_ ->
|
_ ->
|
||||||
fill_subscription_lists(LServer, Is, F, T)
|
J = I#roster.jid,
|
||||||
|
case I#roster.subscription of
|
||||||
|
both ->
|
||||||
|
fill_subscription_lists(LServer, Is, [J | F], [J | T]);
|
||||||
|
from ->
|
||||||
|
fill_subscription_lists(LServer, Is, [J | F], T);
|
||||||
|
to ->
|
||||||
|
fill_subscription_lists(LServer, Is, F, [J | T]);
|
||||||
|
_ ->
|
||||||
|
fill_subscription_lists(LServer, Is, F, T)
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
fill_subscription_lists(_LServer, [], F, T) ->
|
fill_subscription_lists(_LServer, [], F, T) ->
|
||||||
{F, T}.
|
{F, T}.
|
||||||
@ -427,6 +443,8 @@ process_subscription(Direction, User, Server, JID1, Type, Reason) ->
|
|||||||
["username", "jid", "nick", "subscription", "ask",
|
["username", "jid", "nick", "subscription", "ask",
|
||||||
"askmessage", "server", "subscribe", "type"],
|
"askmessage", "server", "subscribe", "type"],
|
||||||
[I]} ->
|
[I]} ->
|
||||||
|
%% raw_to_record can return error, but
|
||||||
|
%% jlib_to_string would fail before this point
|
||||||
R = raw_to_record(LServer, I),
|
R = raw_to_record(LServer, I),
|
||||||
Groups =
|
Groups =
|
||||||
case odbc_queries:get_roster_groups(LServer, Username, SJID) of
|
case odbc_queries:get_roster_groups(LServer, Username, SJID) of
|
||||||
@ -716,6 +734,7 @@ get_in_pending_subscriptions(Ls, User, Server) ->
|
|||||||
lists:flatmap(
|
lists:flatmap(
|
||||||
fun(I) ->
|
fun(I) ->
|
||||||
case raw_to_record(LServer, I) of
|
case raw_to_record(LServer, I) of
|
||||||
|
%% Bad JID in database:
|
||||||
error ->
|
error ->
|
||||||
[];
|
[];
|
||||||
R ->
|
R ->
|
||||||
|
Loading…
Reference in New Issue
Block a user