]> granicus.if.org Git - ejabberd/commitdiff
Do not rely on behaviour info when doing config validation
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 29 Jun 2015 19:50:15 +0000 (22:50 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Mon, 29 Jun 2015 19:50:34 +0000 (22:50 +0300)
src/ejabberd_config.erl

index d049e4112470fd7cf618749cb2f0b29784f4b46e..43e4154d5a535e05be5b899ef5efc6cbb5ed0005 100644 (file)
@@ -718,16 +718,13 @@ get_modules_with_options() ->
     {ok, Mods} = application:get_key(ejabberd, modules),
     lists:foldl(
       fun(Mod, D) ->
-             Attrs = Mod:module_info(attributes),
-             Behavs = proplists:get_value(behaviour, Attrs, []),
-             case lists:member(ejabberd_config, Behavs) or (Mod == ?MODULE) of
-                 true ->
-                     Opts = Mod:opt_type(''),
+             case catch Mod:opt_type('') of
+                 Opts when is_list(Opts) ->
                      lists:foldl(
                        fun(Opt, Acc) ->
                                dict:append(Opt, Mod, Acc)
                        end, D, Opts);
-                 false ->
+                 {'EXIT', {undef, _}} ->
                      D
              end
       end, dict:new(), [?MODULE|Mods]).