aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2008-08-25 13:12:23 +0000
committerChristophe Romain <christophe.romain@process-one.net>2008-08-25 13:12:23 +0000
commit5c9069d677c24799f566f5ba9e769cc408a66659 (patch)
tree8c6c06809bd4aad254c439b417e1e5239f83e3a8
parent* src/ejabberd_check.erl: Detect correctly MSSQL and ODBC (diff)
Prevent case_clause error when ejabber_odbc:sql_query returns {error, Reason}
SVN Revision: 1538
-rw-r--r--ChangeLog6
-rw-r--r--src/mod_privacy_odbc.erl50
-rw-r--r--src/mod_vcard_odbc.erl2
3 files changed, 33 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a6d1caf4..376f0a48c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-25 Christophe Romain <christophe.romain@process-one.net>
+
+ * src/mod_privacy_odbc.erl: Prevent case_clause error when
+ ejabber_odbc:sql_query returns {error, Reason}
+ * src/mod_vcard_odbc.erl: Likewise
+
2008-08-25 Badlop <badlop@process-one.net>
* src/ejabberd_check.erl: Detect correctly MSSQL and ODBC
diff --git a/src/mod_privacy_odbc.erl b/src/mod_privacy_odbc.erl
index 263ec434d..11e3956eb 100644
--- a/src/mod_privacy_odbc.erl
+++ b/src/mod_privacy_odbc.erl
@@ -96,16 +96,14 @@ process_iq_get(_, From, _To, #iq{sub_el = SubEl},
process_lists_get(LUser, LServer, Active) ->
Default = case catch sql_get_default_privacy_list(LUser, LServer) of
- {'EXIT', _Reason} ->
- none;
{selected, ["name"], []} ->
none;
{selected, ["name"], [{DefName}]} ->
- DefName
+ DefName;
+ _ ->
+ none
end,
case catch sql_get_privacy_list_names(LUser, LServer) of
- {'EXIT', _Reason2} ->
- {error, ?ERR_INTERNAL_SERVER_ERROR};
{selected, ["name"], []} ->
{result, [{xmlelement, "query", [{"xmlns", ?NS_PRIVACY}], []}]};
{selected, ["name"], Names} ->
@@ -132,19 +130,17 @@ process_lists_get(LUser, LServer, Active) ->
end,
{result,
[{xmlelement, "query", [{"xmlns", ?NS_PRIVACY}],
- ADItems}]}
+ ADItems}]};
+ _ ->
+ {error, ?ERR_INTERNAL_SERVER_ERROR}
end.
process_list_get(LUser, LServer, {value, Name}) ->
case catch sql_get_privacy_list_id(LUser, LServer, Name) of
- {'EXIT', _Reason} ->
- {error, ?ERR_INTERNAL_SERVER_ERROR};
{selected, ["id"], []} ->
{error, ?ERR_ITEM_NOT_FOUND};
{selected, ["id"], [{ID}]} ->
case catch sql_get_privacy_list_data_by_id(ID, LServer) of
- {'EXIT', _Reason} ->
- {error, ?ERR_INTERNAL_SERVER_ERROR};
{selected, ["t", "value", "action", "ord", "match_all",
"match_iq", "match_message",
"match_presence_in", "match_presence_out"],
@@ -154,8 +150,12 @@ process_list_get(LUser, LServer, {value, Name}) ->
{result,
[{xmlelement, "query", [{"xmlns", ?NS_PRIVACY}],
[{xmlelement, "list",
- [{"name", Name}], LItems}]}]}
- end
+ [{"name", Name}], LItems}]}]};
+ _ ->
+ {error, ?ERR_INTERNAL_SERVER_ERROR}
+ end;
+ _ ->
+ {error, ?ERR_INTERNAL_SERVER_ERROR}
end;
process_list_get(_LUser, _LServer, false) ->
@@ -294,6 +294,8 @@ process_default_set(LUser, LServer, false) ->
case catch sql_unset_default_privacy_list(LUser, LServer) of
{'EXIT', _Reason} ->
{error, ?ERR_INTERNAL_SERVER_ERROR};
+ {error, _Reason} ->
+ {error, ?ERR_INTERNAL_SERVER_ERROR};
_ ->
{result, []}
end.
@@ -301,21 +303,21 @@ process_default_set(LUser, LServer, false) ->
process_active_set(LUser, LServer, {value, Name}) ->
case catch sql_get_privacy_list_id(LUser, LServer, Name) of
- {'EXIT', _Reason} ->
- {error, ?ERR_INTERNAL_SERVER_ERROR};
{selected, ["id"], []} ->
{error, ?ERR_ITEM_NOT_FOUND};
{selected, ["id"], [{ID}]} ->
case catch sql_get_privacy_list_data_by_id(ID, LServer) of
- {'EXIT', _Reason} ->
- {error, ?ERR_INTERNAL_SERVER_ERROR};
{selected, ["t", "value", "action", "ord", "match_all",
"match_iq", "match_message",
"match_presence_in", "match_presence_out"],
RItems} ->
Items = lists:map(fun raw_to_item/1, RItems),
- {result, [], #userlist{name = Name, list = Items}}
- end
+ {result, [], #userlist{name = Name, list = Items}};
+ _ ->
+ {error, ?ERR_INTERNAL_SERVER_ERROR}
+ end;
+ _ ->
+ {error, ?ERR_INTERNAL_SERVER_ERROR}
end;
process_active_set(_LUser, _LServer, false) ->
@@ -517,21 +519,21 @@ get_user_list(_, User, Server) ->
LServer = jlib:nameprep(Server),
case catch sql_get_default_privacy_list(LUser, LServer) of
- {'EXIT', _Reason} ->
- #userlist{};
{selected, ["name"], []} ->
#userlist{};
{selected, ["name"], [{Default}]} ->
case catch sql_get_privacy_list_data(LUser, LServer, Default) of
- {'EXIT', _Reason} ->
- #userlist{};
{selected, ["t", "value", "action", "ord", "match_all",
"match_iq", "match_message",
"match_presence_in", "match_presence_out"],
RItems} ->
Items = lists:map(fun raw_to_item/1, RItems),
- #userlist{name = Default, list = Items}
- end
+ #userlist{name = Default, list = Items};
+ _ ->
+ #userlist{}
+ end;
+ _ ->
+ #userlist{}
end.
diff --git a/src/mod_vcard_odbc.erl b/src/mod_vcard_odbc.erl
index 4a755829e..7c3d78dab 100644
--- a/src/mod_vcard_odbc.erl
+++ b/src/mod_vcard_odbc.erl
@@ -162,7 +162,7 @@ process_sm_iq(From, To, #iq{type = Type, sub_el = SubEl} = IQ) ->
end;
{selected, ["vcard"], []} ->
IQ#iq{type = result, sub_el = []};
- {'EXIT', _Reason} ->
+ _ ->
IQ#iq{type = error,
sub_el = [SubEl, ?ERR_INTERNAL_SERVER_ERROR]}
end