+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
+
2007-06-28 Mickael Remond <mickael.remond@process-one.net>
* src/ejabberd_auth_anonymous.erl: Do not purge non anonymous accounts
db_init(),
sha:start(),
catch ssl:start(),
+ stringprep_sup:start_link(),
translate:start(),
acl:start(),
ejabberd_ctl:init(),
{host, Host} ->
if
State#state.hosts == [] ->
- add_option(hosts, [Host], State#state{hosts = [Host]});
+ add_hosts_to_option([Host], State);
true ->
?ERROR_MSG("Can't load config file: "
"too many hosts definitions", []),
{hosts, Hosts} ->
if
State#state.hosts == [] ->
- add_option(hosts, Hosts, State#state{hosts = Hosts});
+ add_hosts_to_option(Hosts, State);
true ->
?ERROR_MSG("Can't load config file: "
"too many hosts definitions", []),
State
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) ->
case Term of
override_global ->
hosts, password, access,
check_from}).
-%-Define(DBGFSM, true).
+%-define(DBGFSM, true).
-ifdef(DBGFSM).
-define(FSMOPTS, [{debug, [trace]}]).
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
-
init([]) ->
Hooks =
{ejabberd_hooks,
brutal_kill,
worker,
[ejabberd_hooks]},
- StringPrep =
- {stringprep,
- {stringprep, start_link, []},
- permanent,
- brutal_kill,
- worker,
- [stringprep]},
NodeGroups =
{ejabberd_node_groups,
{ejabberd_node_groups, start_link, []},
[ejabberd_tmp_sup]},
{ok, {{one_for_one, 10, 1},
[Hooks,
- StringPrep,
NodeGroups,
SystemMonitor,
Router,
endif
OBJS = \
- $(OUTDIR)/stringprep.beam
+ $(OUTDIR)/stringprep.beam \
+ $(OUTDIR)/stringprep_sup.beam
all: $(OBJS) $(ERLSHLIBS)
OBJECT = stringprep_drv.o
DLL = $(OUTDIR)\stringprep_drv.dll
-ALL : $(DLL) $(OUTDIR)\stringprep.beam
+ALL : $(DLL) $(OUTDIR)\stringprep.beam \
+ $(OUTDIR)\stringprep_sup.beam
CLEAN :
-@erase $(DLL)
-@erase $(OUTDIR)\stringprep_drv.lib
-@erase $(OBJECT)
-@erase $(OUTDIR)\stringprep.beam
+ -@erase $(OUTDIR)\stringprep_sup.beam
$(OUTDIR)\stringprep.beam : 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_FLAGS=-nologo -D__WIN32__ -DWIN32 -DWINDOWS -D_WIN32 -DNT -MD -Ox -I"$(ERLANG_DIR)\usr\include" -I"$(EI_DIR)\include"