mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Don't start sql connection pools for unknown hosts
It's possible to trigger that by passing wrong domain to some ctl commands, and if you don't have default credentials for sql connections, you get repeating errors when this pools tries to reconnect from error.
This commit is contained in:
parent
dbf0fb8e86
commit
735516ed37
@ -37,6 +37,11 @@ start(Host) ->
|
|||||||
case is_started(Host) of
|
case is_started(Host) of
|
||||||
true -> ok;
|
true -> ok;
|
||||||
false ->
|
false ->
|
||||||
|
case lists:member(Host, ejabberd_option:hosts()) of
|
||||||
|
false ->
|
||||||
|
?WARNING_MSG("Rejecting start of sql worker for unknown host: ~ts", [Host]),
|
||||||
|
{error, invalid_host};
|
||||||
|
true ->
|
||||||
App = case ejabberd_option:sql_type(Host) of
|
App = case ejabberd_option:sql_type(Host) of
|
||||||
mysql -> p1_mysql;
|
mysql -> p1_mysql;
|
||||||
pgsql -> p1_pgsql;
|
pgsql -> p1_pgsql;
|
||||||
@ -62,6 +67,7 @@ start(Host) ->
|
|||||||
?ERROR_MSG("Failed to start ~ts: ~p", [?MODULE, Why]),
|
?ERROR_MSG("Failed to start ~ts: ~p", [?MODULE, Why]),
|
||||||
Err
|
Err
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
stop(Host) ->
|
stop(Host) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user