* src/ejabberd_config.erl: Normalize hostnames in config file. If mixed
case is used, the hostname will be now useable (EJAB-277). * src/stringprep/stringprep_sup.erl: Likewise * src/stringprep/Makefile.in: Likewise * src/stringprep/Makefile.win32: Likewise * src/ejabberd_app.erl: Likewise * src/ejabberd_sup.erl: Likewise SVN Revision: 864
This commit is contained in:
parent
32fc9d3ce8
commit
907e421f89
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2007-06-29 Mickael Remond <mickael.remond@process-one.net>
|
||||||
|
|
||||||
|
* src/ejabberd_config.erl: Normalize hostnames in config file. If mixed
|
||||||
|
case is used, the hostname will be now useable (EJAB-277).
|
||||||
|
* src/stringprep/stringprep_sup.erl: Likewise
|
||||||
|
* src/stringprep/Makefile.in: Likewise
|
||||||
|
* src/stringprep/Makefile.win32: Likewise
|
||||||
|
* src/ejabberd_app.erl: Likewise
|
||||||
|
* src/ejabberd_sup.erl: Likewise
|
||||||
|
|
||||||
2007-02-02 Christophe Romain <christophe.romain@process-one.net>
|
2007-02-02 Christophe Romain <christophe.romain@process-one.net>
|
||||||
|
|
||||||
* doc/release_notes_1.1.3.txt: Creation.
|
* doc/release_notes_1.1.3.txt: Creation.
|
||||||
|
|
|
@ -22,6 +22,7 @@ start(normal, _Args) ->
|
||||||
db_init(),
|
db_init(),
|
||||||
sha:start(),
|
sha:start(),
|
||||||
catch ssl:start(),
|
catch ssl:start(),
|
||||||
|
stringprep_sup:start_link(),
|
||||||
translate:start(),
|
translate:start(),
|
||||||
acl:start(),
|
acl:start(),
|
||||||
ejabberd_ctl:init(),
|
ejabberd_ctl:init(),
|
||||||
|
|
|
@ -63,7 +63,7 @@ search_hosts(Term, State) ->
|
||||||
{host, Host} ->
|
{host, Host} ->
|
||||||
if
|
if
|
||||||
State#state.hosts == [] ->
|
State#state.hosts == [] ->
|
||||||
add_option(hosts, [Host], State#state{hosts = [Host]});
|
add_hosts_to_option([Host], State);
|
||||||
true ->
|
true ->
|
||||||
?ERROR_MSG("Can't load config file: "
|
?ERROR_MSG("Can't load config file: "
|
||||||
"too many hosts definitions", []),
|
"too many hosts definitions", []),
|
||||||
|
@ -72,7 +72,7 @@ search_hosts(Term, State) ->
|
||||||
{hosts, Hosts} ->
|
{hosts, Hosts} ->
|
||||||
if
|
if
|
||||||
State#state.hosts == [] ->
|
State#state.hosts == [] ->
|
||||||
add_option(hosts, Hosts, State#state{hosts = Hosts});
|
add_hosts_to_option(Hosts, State);
|
||||||
true ->
|
true ->
|
||||||
?ERROR_MSG("Can't load config file: "
|
?ERROR_MSG("Can't load config file: "
|
||||||
"too many hosts definitions", []),
|
"too many hosts definitions", []),
|
||||||
|
@ -82,6 +82,24 @@ search_hosts(Term, State) ->
|
||||||
State
|
State
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
add_hosts_to_option(Hosts, State) ->
|
||||||
|
PrepHosts = normalize_hosts(Hosts),
|
||||||
|
add_option(hosts, PrepHosts, State#state{hosts = PrepHosts}).
|
||||||
|
|
||||||
|
normalize_hosts(Hosts) ->
|
||||||
|
normalize_hosts(Hosts,[]).
|
||||||
|
normalize_hosts([], PrepHosts) ->
|
||||||
|
lists:reverse(PrepHosts);
|
||||||
|
normalize_hosts([Host|Hosts], PrepHosts) ->
|
||||||
|
case jlib:nodeprep(Host) of
|
||||||
|
error ->
|
||||||
|
?ERROR_MSG("Can't load config file: "
|
||||||
|
"invalid host name [~p]", [Host]),
|
||||||
|
exit("invalid hostname");
|
||||||
|
PrepHost ->
|
||||||
|
normalize_hosts(Hosts, [PrepHost|PrepHosts])
|
||||||
|
end.
|
||||||
|
|
||||||
process_term(Term, State) ->
|
process_term(Term, State) ->
|
||||||
case Term of
|
case Term of
|
||||||
override_global ->
|
override_global ->
|
||||||
|
|
|
@ -26,13 +26,6 @@ init([]) ->
|
||||||
brutal_kill,
|
brutal_kill,
|
||||||
worker,
|
worker,
|
||||||
[ejabberd_hooks]},
|
[ejabberd_hooks]},
|
||||||
StringPrep =
|
|
||||||
{stringprep,
|
|
||||||
{stringprep, start_link, []},
|
|
||||||
permanent,
|
|
||||||
brutal_kill,
|
|
||||||
worker,
|
|
||||||
[stringprep]},
|
|
||||||
Router =
|
Router =
|
||||||
{ejabberd_router,
|
{ejabberd_router,
|
||||||
{ejabberd_router, start_link, []},
|
{ejabberd_router, start_link, []},
|
||||||
|
@ -133,7 +126,6 @@ init([]) ->
|
||||||
[ejabberd_tmp_sup]},
|
[ejabberd_tmp_sup]},
|
||||||
{ok, {{one_for_one, 10, 1},
|
{ok, {{one_for_one, 10, 1},
|
||||||
[Hooks,
|
[Hooks,
|
||||||
StringPrep,
|
|
||||||
Router,
|
Router,
|
||||||
SM,
|
SM,
|
||||||
S2S,
|
S2S,
|
||||||
|
|
|
@ -20,7 +20,8 @@ ERLSHLIBS = ../stringprep_drv.so
|
||||||
OUTDIR = ..
|
OUTDIR = ..
|
||||||
EFLAGS = -I .. -pz ..
|
EFLAGS = -I .. -pz ..
|
||||||
OBJS = \
|
OBJS = \
|
||||||
$(OUTDIR)/stringprep.beam
|
$(OUTDIR)/stringprep.beam \
|
||||||
|
$(OUTDIR)/stringprep_sup.beam
|
||||||
|
|
||||||
all: $(OBJS) $(ERLSHLIBS)
|
all: $(OBJS) $(ERLSHLIBS)
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ AUXIL = uni_data.c uni_norm.c
|
||||||
OBJECT = stringprep_drv.o
|
OBJECT = stringprep_drv.o
|
||||||
DLL = $(OUTDIR)\stringprep_drv.dll
|
DLL = $(OUTDIR)\stringprep_drv.dll
|
||||||
|
|
||||||
ALL : $(DLL) $(OUTDIR)\stringprep.beam
|
ALL : $(DLL) $(OUTDIR)\stringprep.beam \
|
||||||
|
$(OUTDIR)\stringprep_sup.beam
|
||||||
|
|
||||||
CLEAN :
|
CLEAN :
|
||||||
-@erase $(DLL)
|
-@erase $(DLL)
|
||||||
|
@ -17,10 +18,14 @@ CLEAN :
|
||||||
-@erase $(OUTDIR)\stringprep_drv.lib
|
-@erase $(OUTDIR)\stringprep_drv.lib
|
||||||
-@erase $(OBJECT)
|
-@erase $(OBJECT)
|
||||||
-@erase $(OUTDIR)\stringprep.beam
|
-@erase $(OUTDIR)\stringprep.beam
|
||||||
|
-@erase $(OUTDIR)\stringprep_sup.beam
|
||||||
|
|
||||||
$(OUTDIR)\stringprep.beam : stringprep.erl
|
$(OUTDIR)\stringprep.beam : stringprep.erl
|
||||||
erlc -W $(EFLAGS) -o $(OUTDIR) stringprep.erl
|
erlc -W $(EFLAGS) -o $(OUTDIR) stringprep.erl
|
||||||
|
|
||||||
|
$(OUTDIR)\stringprep_sup.beam : stringprep_sup.erl
|
||||||
|
erlc -W $(EFLAGS) -o $(OUTDIR) stringprep_sup.erl
|
||||||
|
|
||||||
CC=cl.exe
|
CC=cl.exe
|
||||||
CC_FLAGS=-nologo -D__WIN32__ -DWIN32 -DWINDOWS -D_WIN32 -DNT -MD -Ox -I"$(ERLANG_DIR)\usr\include" -I"$(EI_DIR)\include"
|
CC_FLAGS=-nologo -D__WIN32__ -DWIN32 -DWINDOWS -D_WIN32 -DNT -MD -Ox -I"$(ERLANG_DIR)\usr\include" -I"$(EI_DIR)\include"
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
%%% File : stringprep_sup.erl
|
||||||
|
%%% Author : Mickael Remond <mremond@process-one.net>
|
||||||
|
%%% Description : Supervisor for the Stringprep worker.
|
||||||
|
%%%
|
||||||
|
%%% Created : 29 Jun 2007 by Mickael Remond <mremond@process-one.net>
|
||||||
|
%%%-------------------------------------------------------------------
|
||||||
|
-module(stringprep_sup).
|
||||||
|
|
||||||
|
-behaviour(supervisor).
|
||||||
|
|
||||||
|
%% API
|
||||||
|
-export([start_link/0]).
|
||||||
|
|
||||||
|
%% Supervisor callbacks
|
||||||
|
-export([init/1]).
|
||||||
|
|
||||||
|
-define(SERVER, ?MODULE).
|
||||||
|
|
||||||
|
%%====================================================================
|
||||||
|
%% API functions
|
||||||
|
%%====================================================================
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
%% Function: start_link() -> {ok,Pid} | ignore | {error,Error}
|
||||||
|
%% Description: Starts the supervisor
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
start_link() ->
|
||||||
|
supervisor:start_link({local, ?SERVER}, ?MODULE, []).
|
||||||
|
|
||||||
|
%%====================================================================
|
||||||
|
%% Supervisor callbacks
|
||||||
|
%%====================================================================
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
%% Func: init(Args) -> {ok, {SupFlags, [ChildSpec]}} |
|
||||||
|
%% ignore |
|
||||||
|
%% {error, Reason}
|
||||||
|
%% Description: Whenever a supervisor is started using
|
||||||
|
%% supervisor:start_link/[2,3], this function is called by the new process
|
||||||
|
%% to find out about restart strategy, maximum restart frequency and child
|
||||||
|
%% specifications.
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
init([]) ->
|
||||||
|
StringPrep = {stringprep,
|
||||||
|
{stringprep, start_link, []},
|
||||||
|
permanent,
|
||||||
|
brutal_kill,
|
||||||
|
worker,
|
||||||
|
[stringprep]},
|
||||||
|
{ok,{{one_for_all,10,1}, [StringPrep]}}.
|
Loading…
Reference in New Issue