25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-10-13 15:16:49 +02:00

* src/xml.erl: Making use of CDATA escaping optional through with a compile time option (EJAB-298).

* src/Makefile.in: Likewise.
* src/configure.ac: Likewise.

SVN Revision: 849
This commit is contained in:
Mickaël Rémond 2007-07-31 12:05:00 +00:00
parent a78ea8fb54
commit 1ab47669ff
5 changed files with 54 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2007-07-31 Mickael Remond <mickael.remond@process-one.net>
* src/xml.erl: Making use of CDATA escaping optional through with
a compile time option (EJAB-298).
* src/Makefile.in: Likewise.
* src/configure.ac: Likewise.
2007-07-31 Alexey Shchepin <alexey@sevcom.net>
* src/mod_version.erl: Added option to hide OS version (thanks to

View File

@ -26,6 +26,10 @@ ifeq (@roster_gateway_workaround@, true)
ERLC_FLAGS+=-DROSTER_GATEWAY_WORKAROUND
endif
ifeq (@full_xml@, true)
ERLC_FLAGS+=-DFULL_XML_SUPPORT
endif
prefix = @prefix@
SUBDIRS = @mod_irc@ @mod_pubsub@ @mod_muc@ @mod_proxy65@ @eldap@ @web@ stringprep @tls@ @odbc@ @ejabberd_zlib@

19
src/configure vendored
View File

@ -310,7 +310,7 @@ ac_includes_default="\
#endif"
ac_default_prefix=/
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE ERLC ac_pt_ERLC ERL ac_pt_ERL ERLANG_CFLAGS ERLANG_LIBS LIBICONV CPP EGREP EXPAT_CFLAGS EXPAT_LIBS ZLIB_CFLAGS ZLIB_LIBS LIBOBJS mod_pubsub make_mod_pubsub mod_irc make_mod_irc mod_muc make_mod_muc mod_proxy65 make_mod_proxy65 eldap make_eldap web make_web tls make_tls odbc make_odbc ejabberd_zlib make_ejabberd_zlib roster_gateway_workaround db_type SSL_LIBS SSL_CFLAGS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT SET_MAKE ERLC ac_pt_ERLC ERL ac_pt_ERL ERLANG_CFLAGS ERLANG_LIBS LIBICONV CPP EGREP EXPAT_CFLAGS EXPAT_LIBS ZLIB_CFLAGS ZLIB_LIBS LIBOBJS mod_pubsub make_mod_pubsub mod_irc make_mod_irc mod_muc make_mod_muc mod_proxy65 make_mod_proxy65 eldap make_eldap web make_web tls make_tls odbc make_odbc ejabberd_zlib make_ejabberd_zlib roster_gateway_workaround db_type full_xml SSL_LIBS SSL_CFLAGS LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@ -852,6 +852,7 @@ Optional Features:
--enable-ejabberd_zlib enable ejabberd_zlib (default: yes)
--enable-roster-gateway-workaround Turn on workaround for processing gateway subscriptions (default: no)
--enable-mssql Use Microsoft SQL Server database (default: no, requires --enable-odbc)
--enable-full-xml Use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@ -4569,6 +4570,21 @@ else
fi;
# Check whether --enable-full_xml or --disable-full_xml was given.
if test "${enable_full_xml+set}" = set; then
enableval="$enable_full_xml"
case "${enableval}" in
yes) full_xml=true ;;
no) full_xml=false ;;
*) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-full-xml" >&5
echo "$as_me: error: bad value ${enableval} for --enable-full-xml" >&2;}
{ (exit 1); exit 1; }; } ;;
esac
else
full_xml=false
fi;
ac_config_files="$ac_config_files Makefile $make_mod_irc $make_mod_muc $make_mod_pubsub $make_mod_proxy65 $make_eldap $make_web stringprep/Makefile $make_tls $make_odbc $make_ejabberd_zlib"
#openssl
@ -5669,6 +5685,7 @@ s,@ejabberd_zlib@,$ejabberd_zlib,;t t
s,@make_ejabberd_zlib@,$make_ejabberd_zlib,;t t
s,@roster_gateway_workaround@,$roster_gateway_workaround,;t t
s,@db_type@,$db_type,;t t
s,@full_xml@,$full_xml,;t t
s,@SSL_LIBS@,$SSL_LIBS,;t t
s,@SSL_CFLAGS@,$SSL_CFLAGS,;t t
s,@LTLIBOBJS@,$LTLIBOBJS,;t t

View File

@ -55,6 +55,15 @@ AC_ARG_ENABLE(mssql,
esac],[db_type=generic])
AC_SUBST(db_type)
AC_ARG_ENABLE(full_xml,
[ --enable-full-xml Use XML features in XMPP stream (ex: CDATA) (default: no, requires XML compliant clients)],
[case "${enableval}" in
yes) full_xml=true ;;
no) full_xml=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-full-xml) ;;
esac],[full_xml=false])
AC_SUBST(full_xml)
AC_CONFIG_FILES([Makefile
$make_mod_irc
$make_mod_muc

View File

@ -11,7 +11,7 @@
-vsn('$Revision$ ').
-export([element_to_string/1,
crypt/1,
crypt/1, make_text_node/1,
remove_cdata/1,
get_cdata/1, get_tag_cdata/1,
get_attr/2, get_attr_s/2,
@ -20,6 +20,15 @@
get_path_s/2,
replace_tag_attr/3]).
%% Select at compile time how to escape characters in binary text
%% nodes.
%% Can be choosen with ./configure --enable-full-xml
-ifdef(FULL_XML_SUPPORT).
-define(ESCAPE_BINARY(CData), make_text_node(CData)).
-else.
-define(ESCAPE_BINARY(CData), crypt(CData)).
-endif.
element_to_string(El) ->
case El of
{xmlelement, Name, Attrs, Els} ->
@ -32,11 +41,10 @@ element_to_string(El) ->
[$<, Name, attrs_to_list(Attrs), $/, $>]
end;
%% We do not crypt CDATA binary, but we enclose it in XML CDATA
{xmlcdata, CData}
when binary(CData) ->
make_text_node(CData);
%% We crypt list and short binaries (implies a conversion to
%% list).
{xmlcdata, CData} when binary(CData) ->
?ESCAPE_BINARY(CData);
%% We crypt list and possibly binaries if full XML usage is
%% disabled unsupported (implies a conversion to list).
{xmlcdata, CData} ->
crypt(CData)
end.
@ -48,6 +56,7 @@ attr_to_list({Name, Value}) ->
[$\s, crypt(Name), $=, $', crypt(Value), $'].
crypt(S) when is_list(S) ->
io:format("MREMOND crypt~n",[]),
[case C of
$& -> "&amp;";
$< -> "&lt;";
@ -61,6 +70,7 @@ crypt(S) when is_binary(S) ->
%% Make a cdata_binary depending on what characters it contains
make_text_node(CData) ->
io:format("MREMOND CDATA~n",[]),
case cdata_need_escape(CData) of
cdata ->
CDATA1 = <<"<![CDATA[">>,