[PATCH] (sqlbox) sqlbox.patch
"Mi Reflejo" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
New sqlbox.patch for sqlbox module according to the last gateway update. Regards, Martín Conte.
sqlbox.patch
(application/octet-stream, 14.6 KB)
Index: Makefile.in
===================================================================
RCS file: /home/cvs/gateway/Makefile.in,v
retrieving revision 1.79
diff -u -r1.79 Makefile.in
--- Makefile.in.orig 2006-06-13 15:36:38.000000000 -0600
+++ Makefile.in 2006-06-13 15:36:20.000000000 -0600
@@ -112,6 +112,7 @@
gw/bearerbox.c \
gw/smsbox.c \
gw/wapbox.c \
+ gw/sqlbox.c \
utils/run_kannel_box.c \
$(STARTSTOPDAEMONSRC)
progsrcs = $(binsrcs) $(sbinsrcs)
Index: configure
===================================================================
RCS file: /home/cvs/gateway/configure,v
retrieving revision 1.160
diff -u -r1.160 configure
--- configure.orig 2006-06-13 15:13:45.000000000 -0600
+++ configure 2006-06-13 15:13:33.000000000 -0600
@@ -10880,7 +10880,7 @@
echo "${ECHO_T}$mysql_version" >&6
MYSQL_LIBS=""
if $MYSQL_CONFIG --libs_r &>/dev/null ; then
- MYSQL_LIBS=`$MYSQL_CONFIG --libs_r`
+ MYSQL_LIBS=`$MYSQL_CONFIG --libs_r | sed -e "s/'//g"`
echo "$as_me:$LINENO: checking mysql reentrant libs" >&5
echo $ECHO_N "checking mysql reentrant libs... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $MYSQL_LIBS" >&5
@@ -10957,7 +10957,7 @@
fi
if test -z "$MYSQL_LIBS" ; then
- MYSQL_LIBS=`$MYSQL_CONFIG --libs`
+ MYSQL_LIBS=`$MYSQL_CONFIG --libs | sed -e "s/'//g"`
echo "$as_me:$LINENO: checking mysql libs" >&5
echo $ECHO_N "checking mysql libs... $ECHO_C" >&6
echo "$as_me:$LINENO: result: $MYSQL_LIBS" >&5
@@ -12880,7 +12880,262 @@
fi;
+echo $ac_n "checking for Ct-Lib support""... $ac_c" 1>&6
+echo "configure:5071: checking for Ct-Lib support" >&5
+# Check whether --with-ctlib or --without-ctlib was given.
+if test "${with_ctlib+set}" = set; then
+ withval="$with_ctlib"
+
+ if test "$withval" = "yes"; then
+ withval=/opt/sybase
+ fi
+
+ if test "$withval" != "no"; then
+ if test -f $withval/include/ctpublic.h; then
+ CTLIB_INCDIR=$withval/include
+ CTLIB_LIBDIR=$withval/lib
+ else
+ echo "$ac_t""no" 1>&6
+ { echo "configure: error: Invalid Ct-Lib directory - unable to find ctpublic.h" 1>&2; exit 1; }
+ fi
+ CTLIB_LFLAGS="-L$CTLIB_LIBDIR -lct -lcs -lsybtcl -lcomn -lintl"
+ CTLIB_INCLUDE="-I$CTLIB_INCDIR"
+ cat >> confdefs.h <<\EOF
+#define HAVE_CTLIB 1
+EOF
+
+ echo "$ac_t""yes" 1>&6
+ have_db=yes
+ echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "configure:5097: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 5102 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:5143: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5151 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:5162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ CTLIB_LFLAGS="$CTLIB_LFLAGS -ldl"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+ fi
+ if test "x$DBTYPE" = "x" ; then
+ DBTYPE="ctlib"
+ else
+ DBTYPE="$DBTYPE-ctlib"
+ fi
+
+
+else
+
+ echo "$ac_t""no" 1>&6
+
+fi
+
+echo $ac_n "checking for FreeTDS Ct-Lib support""... $ac_c" 1>&6
+echo "configure:5203: checking for FreeTDS Ct-Lib support" >&5
+# Check whether --with-freetds or --without-freetds was given.
+if test "${with_freetds+set}" = set; then
+ withval="$with_freetds"
+
+ if test "$withval" = "yes"; then
+ withval=/usr/local
+ fi
+
+ if test "$withval" != "no"; then
+ if test -f $withval/include/ctpublic.h; then
+ CTLIB_INCDIR=$withval/include
+ CTLIB_LIBDIR=$withval/lib
+ else
+ echo "$ac_t""no" 1>&6
+ { echo "configure: error: Invalid FreeTDS directory - unable to find ctpublic.h" 1>&2; exit 1; }
+ fi
+ CTLIB_LFLAGS="-L$CTLIB_LIBDIR -lct"
+ CTLIB_INCLUDE="-I$CTLIB_INCDIR"
+ cat >> confdefs.h <<\EOF
+#define HAVE_CTLIB 1
+EOF
+
+ echo "$ac_t""yes" 1>&6
+ have_db=yes
+ echo $ac_n "checking for dlopen""... $ac_c" 1>&6
+echo "configure:5229: checking for dlopen" >&5
+if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 5234 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_dlopen) || defined (__stub___dlopen)
+choke me
+#else
+dlopen();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_dlopen=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ :
+else
+ echo "$ac_t""no" 1>&6
+echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:5275: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-ldl $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5283 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char dlopen();
+
+int main() {
+dlopen()
+; return 0; }
+EOF
+if { (eval echo configure:5294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ CTLIB_LFLAGS="$CTLIB_LFLAGS -ldl"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+ fi
+ if test "x$DBTYPE" = "x" ; then
+ DBTYPE="freetds"
+ else
+ DBTYPE="$DBTYPE-freetds"
+ fi
+
+
+else
+
+ echo "$ac_t""no" 1>&6
+
+fi
# Check whether --with-wtls or --without-wtls was given.
Index: configure.in
===================================================================
RCS file: /home/cvs/gateway/configure.in,v
retrieving revision 1.166
diff -u -r1.166 configure.in
--- configure.in.orig 2006-06-13 15:27:52.000000000 -0600
+++ configure.in 2006-06-13 15:27:15.000000000 -0600
@@ -936,14 +936,14 @@
dnl mysql-4.x style
MYSQL_LIBS=""
if $MYSQL_CONFIG --libs_r &>/dev/null ; then
- MYSQL_LIBS=`$MYSQL_CONFIG --libs_r`
+ MYSQL_LIBS=`$MYSQL_CONFIG --libs_r | sed -e "s/\x27//g"`
AC_MSG_CHECKING([mysql reentrant libs])
AC_MSG_RESULT([$MYSQL_LIBS])
AC_CHECK_LIB(mysqlclient_r, mysql_init, [ LIBS="$LIBS $MYSQL_LIBS" ],
[ MYSQL_LIBS="" ], [ $MYSQL_LIBS ])
fi
if test -z "$MYSQL_LIBS" ; then
- MYSQL_LIBS=`$MYSQL_CONFIG --libs`
+ MYSQL_LIBS=`$MYSQL_CONFIG --libs | sed -e "s/\x27//g"`
AC_MSG_CHECKING([mysql libs])
AC_MSG_RESULT([$MYSQL_LIBS])
AC_CHECK_LIB(mysqlclient, mysql_init, [ LIBS="$LIBS $MYSQL_LIBS" ],
@@ -1003,6 +1003,79 @@
AC_MSG_RESULT(disabled)
])
+AC_MSG_CHECKING(for Ct-Lib support)
+AC_ARG_WITH(ctlib,
+[ --with-ctlib[=DIR] Include Ct-Lib support. DIR is the Ct-Lib
+ install directory, defaults to /opt/sybase.],
+[
+ if test "$withval" = "yes"; then
+ withval=/opt/sybase
+ fi
+
+ if test "$withval" != "no"; then
+ if test -f $withval/include/ctpublic.h; then
+ CTLIB_INCDIR=$withval/include
+ CTLIB_LIBDIR=$withval/lib
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(Invalid Ct-Lib directory - unable to find ctpublic.h)
+ fi
+ CTLIB_LFLAGS="-L$CTLIB_LIBDIR -lct -lcs -lsybtcl -lcomn -lintl"
+ CTLIB_INCLUDE="-I$CTLIB_INCDIR"
+ AC_DEFINE(HAVE_CTLIB)
+ AC_MSG_RESULT(yes)
+ have_db=yes
+ dnl ctlib requires -ldl sometime
+ AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen, CTLIB_LFLAGS="$CTLIB_LFLAGS -ldl"))
+ fi
+ if test "x$DBTYPE" = "x" ; then
+ DBTYPE="ctlib"
+ else
+ DBTYPE="$DBTYPE-ctlib"
+ fi
+
+],[
+ AC_MSG_RESULT(no)
+])
+AC_SUBST(CTLIB_LFLAGS)
+AC_SUBST(CTLIB_INCLUDE)
+
+
+AC_MSG_CHECKING(for FreeTDS Ct-Lib support)
+AC_ARG_WITH(freetds,
+[ --with-freetds[=DIR] Include FreeTDS Ct-Lib support. DIR is the FreeTDS
+ install directory, defaults to /usr/local.],
+[
+ if test "$withval" = "yes"; then
+ withval=/usr/local
+ fi
+
+ if test "$withval" != "no"; then
+ if test -f $withval/include/ctpublic.h; then
+ CTLIB_INCDIR=$withval/include
+ CTLIB_LIBDIR=$withval/lib
+ else
+ AC_MSG_RESULT(no)
+ AC_MSG_ERROR(Invalid FreeTDS directory - unable to find ctpublic.h)
+ fi
+ CTLIB_LFLAGS="-L$CTLIB_LIBDIR -lct"
+ CTLIB_INCLUDE="-I$CTLIB_INCDIR"
+ AC_DEFINE(HAVE_CTLIB)
+ AC_MSG_RESULT(yes)
+ have_db=yes
+ AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen, CTLIB_LFLAGS="$CTLIB_LFLAGS -ldl"))
+ fi
+ if test "x$DBTYPE" = "x" ; then
+ DBTYPE="freetds"
+ else
+ DBTYPE="$DBTYPE-freetds"
+ fi
+
+],[
+ AC_MSG_RESULT(no)
+])
+AC_SUBST(CTLIB_LFLAGS)
+AC_SUBST(CTLIB_INCLUDE)
dnl Implement the --with-sqlite option. This will set HAVE_SQLITE in gw-config.h
dnl accordingly and enable the usage of the libsqlite routines.
Index: gw/smsbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsbox.c,v
retrieving revision 1.266
diff -u -r1.266 smsbox.c
--- gw/smsbox.c 15 May 2006 18:24:40 -0000 1.266
+++ gw/smsbox.c 30 May 2006 17:44:18 -0000
@@ -3319,7 +3319,7 @@
Octstr *http_proxy_password = NULL;
Octstr *http_proxy_exceptions_regex = NULL;
int ssl = 0;
- int lf, m;
+ int lf, m, bearerbox_is_sqlbox = 0;
bb_port = BB_DEFAULT_SMSBOX_PORT;
bb_ssl = 0;
@@ -3365,6 +3365,18 @@
if (grp == NULL)
panic(0, "No 'smsbox' group in configuration");
+ if (cfg_get_bool(&bearerbox_is_sqlbox, grp, octstr_imm("bearerbox-is-sqlbox")) == 0) {
+ if (bearerbox_is_sqlbox) {
+ grp = cfg_get_single_group(cfg, octstr_imm("sqlbox"));
+ if (cfg_get_integer(&bb_port, grp, octstr_imm("smsbox-port")) == -1)
+ panic(0, "Missing or bad 'smsbox-port' in sqlbox group");
+#ifdef HAVE_LIBSSL
+ cfg_get_bool(&bb_ssl, grp, octstr_imm("smsbox-port-ssl"));
+#endif /* HAVE_LIBSSL */
+ grp = cfg_get_single_group(cfg, octstr_imm("smsbox"));
+ }
+ }
+
smsbox_id = cfg_get(grp, octstr_imm("smsbox-id"));
p = cfg_get(grp, octstr_imm("bearerbox-host"));
Index: gwlib/cfg.def
===================================================================
RCS file: /home/cvs/gateway/gwlib/cfg.def,v
retrieving revision 1.118
diff -u -r1.118 cfg.def
--- gwlib/cfg.def 9 May 2006 14:32:31 -0000 1.118
+++ gwlib/cfg.def 30 May 2006 17:44:18 -0000
@@ -243,6 +243,7 @@
SINGLE_GROUP(smsbox,
OCTSTR(smsbox-id)
OCTSTR(bearerbox-host)
+ OCTSTR(bearerbox-is-sqlbox)
OCTSTR(sendsms-port)
OCTSTR(sendsms-port-ssl)
OCTSTR(sendsms-interface)
@@ -556,6 +557,27 @@
OCTSTR(unified-prefix)
)
+SINGLE_GROUP(sqlbox,
+ OCTSTR(id)
+ OCTSTR(smsbox-id)
+ OCTSTR(global-sender)
+ OCTSTR(bearerbox-host)
+ OCTSTR(smsbox-port)
+ OCTSTR(smsbox-port-ssl)
+ OCTSTR(sql-log-table)
+ OCTSTR(sql-insert-table)
+ OCTSTR(log-file)
+ OCTSTR(log-level)
+ OCTSTR(white-list)
+ OCTSTR(black-list)
+ OCTSTR(white-list-regex)
+ OCTSTR(black-list-regex)
+ OCTSTR(ssl-client-certkey-file)
+ OCTSTR(ssl-server-cert-file)
+ OCTSTR(ssl-server-key-file)
+ OCTSTR(ssl-trusted-ca-file)
+)
+
#undef OCTSTR
#undef SINGLE_GROUP
#undef MULTI_GROUP