From fc0524057e1b53a59a95a68a69b53bcc646af31d Mon Sep 17 00:00:00 2001 From: bagyenda <> Date: Fri, 2 Sep 2005 11:41:28 +0000 Subject: [PATCH] MMSBox init code Adding SSL support to Mbuni --- mbuni/Makefile.am | 2 +- mbuni/Makefile.in | 3 +- mbuni/config.h.in | 21 + mbuni/configure | 624 ++++++++++++++++++++- mbuni/configure.ac | 106 +++- mbuni/libtool | 12 +- mbuni/misc-patches/mbuni-kannel-patch-full | 89 ++- mbuni/mmlib/Makefile.in | 1 + mbuni/mmlib/mms_util.c | 59 ++ mbuni/mmlib/mms_util.h | 6 +- mbuni/mmsbox/Makefile | 448 +++++++++++++++ mbuni/mmsbox/Makefile.am | 3 + mbuni/mmsbox/mmsbox.c | 65 +++ mbuni/mmsbox/mmsbox_cfg.c | 255 +++++++++ mbuni/mmsbox/mmsbox_cfg.h | 72 +++ mbuni/mmsc/Makefile.in | 1 + mbuni/mmsc/mmsc_cfg.c | 129 ++--- mbuni/mmsc/mmsc_cfg.h | 12 + 18 files changed, 1754 insertions(+), 154 deletions(-) create mode 100644 mbuni/mmsbox/Makefile create mode 100644 mbuni/mmsbox/Makefile.am create mode 100644 mbuni/mmsbox/mmsbox.c create mode 100644 mbuni/mmsbox/mmsbox_cfg.c create mode 100644 mbuni/mmsbox/mmsbox_cfg.h diff --git a/mbuni/Makefile.am b/mbuni/Makefile.am index ef215c3..82db6d8 100644 --- a/mbuni/Makefile.am +++ b/mbuni/Makefile.am @@ -1 +1 @@ -SUBDIRS = mmlib mmsc +SUBDIRS = mmlib mmsc mmsbox diff --git a/mbuni/Makefile.in b/mbuni/Makefile.in index a43bcf6..765a869 100644 --- a/mbuni/Makefile.in +++ b/mbuni/Makefile.in @@ -115,6 +115,7 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ +OPENSSL = @OPENSSL@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ @@ -170,7 +171,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -SUBDIRS = mmlib mmsc +SUBDIRS = mmlib mmsc mmsbox all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive diff --git a/mbuni/config.h.in b/mbuni/config.h.in index 6194380..30ad15a 100644 --- a/mbuni/config.h.in +++ b/mbuni/config.h.in @@ -28,6 +28,9 @@ /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD +/* Define to 1 if you have the `ssl' library (-lssl). */ +#undef HAVE_LIBSSL + /* Define to 1 if you have the `wap' library (-lwap). */ #undef HAVE_LIBWAP @@ -47,6 +50,24 @@ /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_CRYPTO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_PEM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RSA_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_X509_H + /* Define to 1 if you have the `sqrt' function. */ #undef HAVE_SQRT diff --git a/mbuni/configure b/mbuni/configure index 66875cb..51eef13 100755 --- a/mbuni/configure +++ b/mbuni/configure @@ -465,7 +465,7 @@ ac_includes_default="\ # include #endif" -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 INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS EXE_EXT GW_CONFIG 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 INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE RANLIB ac_ct_RANLIB build build_cpu build_vendor build_os host host_cpu host_vendor host_os EGREP LN_S ECHO AR ac_ct_AR CPP CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CXXCPP F77 FFLAGS ac_ct_F77 LIBTOOL LIBOBJS EXE_EXT OPENSSL GW_CONFIG LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -1036,6 +1036,9 @@ Optional Features: --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) + --enable-ssl enable SSL client and server support enabled + --disable-ssl-thread-test disable the multithread test for the OpenSSL library + this will force to continue even if the test fails Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -1047,6 +1050,8 @@ Optional Packages: include additional configurations [automatic] --with-cflags=FLAGS use FLAGS for CFLAGS --with-libs=FLAGS use FLAGS for extra libraries + --with-ssl=DIR where to look for OpenSSL libs and header files + DIR points to the installation /usr/local/ssl --with-kannel-dir=DIR where to look for Kannel Gateway libs and header files DIR points to the installation /usr/local @@ -3765,7 +3770,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 3768 "configure"' > conftest.$ac_ext + echo '#line 3773 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -5337,7 +5342,7 @@ fi # Provide some information about the compiler. -echo "$as_me:5340:" \ +echo "$as_me:5345:" \ "checking for Fortran 77 compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 @@ -6364,11 +6369,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6367: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6372: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6371: \$? = $ac_status" >&5 + echo "$as_me:6376: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6596,11 +6601,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6599: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6604: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:6603: \$? = $ac_status" >&5 + echo "$as_me:6608: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -6663,11 +6668,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:6666: $lt_compile\"" >&5) + (eval echo "\"\$as_me:6671: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:6670: \$? = $ac_status" >&5 + echo "$as_me:6675: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -8781,7 +8786,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:11039: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:11038: \$? = $ac_status" >&5 + echo "$as_me:11043: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -11098,11 +11103,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:11101: $lt_compile\"" >&5) + (eval echo "\"\$as_me:11106: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:11105: \$? = $ac_status" >&5 + echo "$as_me:11110: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -12427,7 +12432,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5) + (eval echo "\"\$as_me:13355: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:13354: \$? = $ac_status" >&5 + echo "$as_me:13359: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -13414,11 +13419,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:13417: $lt_compile\"" >&5) + (eval echo "\"\$as_me:13422: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:13421: \$? = $ac_status" >&5 + echo "$as_me:13426: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -15376,11 +15381,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15379: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15384: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15383: \$? = $ac_status" >&5 + echo "$as_me:15388: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15608,11 +15613,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15611: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15616: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:15615: \$? = $ac_status" >&5 + echo "$as_me:15620: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings @@ -15675,11 +15680,11 @@ else -e 's:.*FLAGS}? :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:15678: $lt_compile\"" >&5) + (eval echo "\"\$as_me:15683: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:15682: \$? = $ac_status" >&5 + echo "$as_me:15687: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -17793,7 +17798,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext < conftest.$ac_ext <&5 +echo "$as_me: error: Unable to find OpenSSL libs and/or directories at $withval" >&2;} + { (exit 1); exit 1; }; } + fi + +fi; + + +echo "$as_me:$LINENO: checking whether to compile with SSL support" >&5 +echo $ECHO_N "checking whether to compile with SSL support... $ECHO_C" >&6 +# Check whether --enable-ssl or --disable-ssl was given. +if test "${enable_ssl+set}" = set; then + enableval="$enable_ssl" + + if test "$enableval" = no ; then + echo "$as_me:$LINENO: result: disabled" >&5 +echo "${ECHO_T}disabled" >&6 + ssl=no + else + ssl=yes + fi + +else + + ssl=yes + +fi; + +if test "$ssl" = "yes" ; then + if test "x$ssllib" = "x" && test "x$sslinc" = "x"; then + for loc in /usr/lib /usr/local/ssl/lib /usr/local/openssl/lib; do + if test -f "$loc/libssl.a"; then + ssllib="$loc" + fi + done + for loc in /usr/include/ssl /usr/include/openssl /usr/local/ssl/include \ + /usr/local/openssl/include; do + if test -d "$loc"; then + sslinc="$loc" + fi + done + fi + echo "$as_me:$LINENO: result: trying $ssllib $sslinc" >&5 +echo "${ECHO_T}trying $ssllib $sslinc" >&6 +fi + + +if test "x$ssllib" != "x" && test "x$sslinc" != "x"; then + CFLAGS="$CFLAGS -I$sslinc" + LIBS="$LIBS -L$ssllib" + + # Extract the first word of "openssl", so it can be a program name with args. +set dummy openssl; ac_word=$2 +echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_path_OPENSSL+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $OPENSSL in + [\\/]* | ?:[\\/]*) + ac_cv_path_OPENSSL="$OPENSSL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_OPENSSL="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_path_OPENSSL" && ac_cv_path_OPENSSL="no" + ;; +esac +fi +OPENSSL=$ac_cv_path_OPENSSL + +if test -n "$OPENSSL"; then + echo "$as_me:$LINENO: result: $OPENSSL" >&5 +echo "${ECHO_T}$OPENSSL" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + if test "$OPENSSL" = "yes"; then + echo "$as_me:$LINENO: checking openssl version" >&5 +echo $ECHO_N "checking openssl version... $ECHO_C" >&6 + openssl_version=`$OPENSSL version | awk '{print $2}'` + echo "$as_me:$LINENO: result: $openssl_version" >&5 +echo "${ECHO_T}$openssl_version" >&6 + fi + echo "$as_me:$LINENO: checking for CRYPTO_lock in -lcrypto" >&5 +echo $ECHO_N "checking for CRYPTO_lock in -lcrypto... $ECHO_C" >&6 +if test "${ac_cv_lib_crypto_CRYPTO_lock+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcrypto $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char CRYPTO_lock (); +int +main () +{ +CRYPTO_lock (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_crypto_CRYPTO_lock=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_crypto_CRYPTO_lock=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_crypto_CRYPTO_lock" >&5 +echo "${ECHO_T}$ac_cv_lib_crypto_CRYPTO_lock" >&6 +if test $ac_cv_lib_crypto_CRYPTO_lock = yes; then + LIBS="$LIBS -lcrypto" + echo "$as_me:$LINENO: checking for SSL_library_init in -lssl" >&5 +echo $ECHO_N "checking for SSL_library_init in -lssl... $ECHO_C" >&6 +if test "${ac_cv_lib_ssl_SSL_library_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char SSL_library_init (); +int +main () +{ +SSL_library_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ssl_SSL_library_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ssl_SSL_library_init=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_library_init" >&5 +echo "${ECHO_T}$ac_cv_lib_ssl_SSL_library_init" >&6 +if test $ac_cv_lib_ssl_SSL_library_init = yes; then + +echo "$as_me:$LINENO: checking for SSL_connect in -lssl" >&5 +echo $ECHO_N "checking for SSL_connect in -lssl... $ECHO_C" >&6 +if test "${ac_cv_lib_ssl_SSL_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lssl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char SSL_connect (); +int +main () +{ +SSL_connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_ssl_SSL_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_ssl_SSL_connect=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_ssl_SSL_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_ssl_SSL_connect" >&6 +if test $ac_cv_lib_ssl_SSL_connect = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBSSL 1 +_ACEOF + + LIBS="-lssl $LIBS" + +fi + + + + + + + +for ac_header in openssl/x509.h openssl/rsa.h openssl/crypto.h \ + openssl/pem.h openssl/ssl.h openssl/err.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------ ## +## Report this to devel@mbuni.org ## +## ------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + echo "$as_me:$LINENO: checking whether the OpenSSL library is multithread-enabled" >&5 +echo $ECHO_N "checking whether the OpenSSL library is multithread-enabled... $ECHO_C" >&6 + if test "$cross_compiling" = yes; then + echo "Cross-compiling; make sure your SSL library is multithread-enabled" + +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #define OPENSSL_THREAD_DEFINES + #include + int main(void) { + #if defined(THREADS) + exit(0); + #elif defined(OPENSSL_THREADS) + exit(0); + #else + exit(1); + #endif + } + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBSSL 1 +_ACEOF + + LIBS="$LIBS -lssl" + echo "$as_me:$LINENO: checking whether to compile with SSL support" >&5 +echo $ECHO_N "checking whether to compile with SSL support... $ECHO_C" >&6 + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) + + # Check whether --enable-ssl-thread-test or --disable-ssl-thread-test was given. +if test "${enable_ssl_thread_test+set}" = set; then + enableval="$enable_ssl_thread_test" + if test "$enableval" = no ; then + echo "$as_me:$LINENO: result: no, continue forced" >&5 +echo "${ECHO_T}no, continue forced" >&6 + fi + +else + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + { { echo "$as_me:$LINENO: error: Either get a multithread-enabled SSL or configure with --disable-ssl" >&5 +echo "$as_me: error: Either get a multithread-enabled SSL or configure with --disable-ssl" >&2;} + { (exit 1); exit 1; }; } + +fi; + +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + +fi + + +fi + +fi + # Need to check for kannel and also that kannel has been patched. @@ -21163,7 +21725,7 @@ LIBS="-L$srcdir/../mmlib -lmms $LIBS" # May be we need to check for media conversion tools (imagemagick, etc)? - ac_config_files="$ac_config_files Makefile mmlib/Makefile mmsc/Makefile" + ac_config_files="$ac_config_files Makefile mmlib/Makefile mmsc/Makefile mmsbox/Makefile" cat >confcache <<\_ACEOF @@ -21725,6 +22287,7 @@ do "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "mmlib/Makefile" ) CONFIG_FILES="$CONFIG_FILES mmlib/Makefile" ;; "mmsc/Makefile" ) CONFIG_FILES="$CONFIG_FILES mmsc/Makefile" ;; + "mmsbox/Makefile" ) CONFIG_FILES="$CONFIG_FILES mmsbox/Makefile" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 @@ -21879,6 +22442,7 @@ s,@ac_ct_F77@,$ac_ct_F77,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@EXE_EXT@,$EXE_EXT,;t t +s,@OPENSSL@,$OPENSSL,;t t s,@GW_CONFIG@,$GW_CONFIG,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF diff --git a/mbuni/configure.ac b/mbuni/configure.ac index db7fcf3..bcaef52 100644 --- a/mbuni/configure.ac +++ b/mbuni/configure.ac @@ -83,6 +83,110 @@ AC_ARG_WITH(libs, [ --with-libs=FLAGS use FLAGS for extra libraries], LIBS="$LIBS $withval") +# implement SSL stuff. + +dnl Implement the --with-ssl option. + + +AC_ARG_WITH(ssl, +[ --with-ssl[=DIR] where to look for OpenSSL libs and header files + DIR points to the installation [/usr/local/ssl]], +[ if test -d "$withval"; then + ssllib="$withval/lib"; + sslinc="$withval/include" + else + AC_MSG_ERROR(Unable to find OpenSSL libs and/or directories at $withval) + fi +]) + +dnl Implement --enable-ssl option. + +AC_MSG_CHECKING([whether to compile with SSL support]) +AC_ARG_ENABLE(ssl, +[ --enable-ssl enable SSL client and server support [enabled]], [ + if test "$enableval" = no ; then + AC_MSG_RESULT(disabled) + ssl=no + else + ssl=yes + fi +],[ + ssl=yes +]) + +if test "$ssl" = "yes" ; then + dnl test only if --with-ssl has not been used + if test "x$ssllib" = "x" && test "x$sslinc" = "x"; then + for loc in /usr/lib /usr/local/ssl/lib /usr/local/openssl/lib; do + if test -f "$loc/libssl.a"; then + ssllib="$loc" + fi + done + for loc in /usr/include/ssl /usr/include/openssl /usr/local/ssl/include \ + /usr/local/openssl/include; do + if test -d "$loc"; then + sslinc="$loc" + fi + done + fi + AC_MSG_RESULT(trying $ssllib $sslinc) +fi + +dnl Implement the SSL library checking routine. +dnl This will define HAVE_LIBSSL in config.h + +if test "x$ssllib" != "x" && test "x$sslinc" != "x"; then + CFLAGS="$CFLAGS -I$sslinc" + LIBS="$LIBS -L$ssllib" + + AC_PATH_PROG(OPENSSL, openssl, no) + if test "$OPENSSL" = "yes"; then + AC_MSG_CHECKING([openssl version]) + openssl_version=`$OPENSSL version | awk '{print $2}'` + AC_MSG_RESULT([$openssl_version]) + fi + AC_CHECK_LIB(crypto, CRYPTO_lock, + [ LIBS="$LIBS -lcrypto" + AC_CHECK_LIB(ssl, SSL_library_init, + [ AC_CHECK_LIB(ssl, SSL_connect) + AC_CHECK_HEADERS(openssl/x509.h openssl/rsa.h openssl/crypto.h \ + openssl/pem.h openssl/ssl.h openssl/err.h) + AC_MSG_CHECKING(whether the OpenSSL library is multithread-enabled) + AC_TRY_RUN([ + #define OPENSSL_THREAD_DEFINES + #include + int main(void) { + #if defined(THREADS) + exit(0); + #elif defined(OPENSSL_THREADS) + exit(0); + #else + exit(1); + #endif + } + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_LIBSSL) + LIBS="$LIBS -lssl" + AC_MSG_CHECKING([whether to compile with SSL support]) + AC_MSG_RESULT(yes) + ], [ + AC_ARG_ENABLE(ssl-thread-test, + [ --disable-ssl-thread-test disable the multithread test for the OpenSSL library + this will force to continue even if the test fails], + [ if test "$enableval" = no ; then + AC_MSG_RESULT([no, continue forced]) + fi + ], [ + AC_MSG_RESULT(no) + AC_MSG_ERROR(Either get a multithread-enabled SSL or configure with --disable-ssl) + ]) + ], echo "Cross-compiling; make sure your SSL library is multithread-enabled" + ) + ]) + ]) +fi + # Need to check for kannel and also that kannel has been patched. dnl Implement the --with-kannel-dir option @@ -144,7 +248,7 @@ LIBS="-L$srcdir/../mmlib -lmms $LIBS" # May be we need to check for media conversion tools (imagemagick, etc)? -AC_CONFIG_FILES([Makefile mmlib/Makefile mmsc/Makefile]) +AC_CONFIG_FILES([Makefile mmlib/Makefile mmsc/Makefile mmsbox/Makefile]) AC_OUTPUT diff --git a/mbuni/libtool b/mbuni/libtool index c629070..8f926ce 100755 --- a/mbuni/libtool +++ b/mbuni/libtool @@ -44,7 +44,7 @@ available_tags=" CXX" # ### BEGIN LIBTOOL CONFIG -# Libtool was configured on host stitch.ds.co.ug: +# Libtool was configured on host lilo.ds.co.ug: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -66,7 +66,7 @@ fast_install=yes # The host system. host_alias= -host=powerpc-apple-darwin8.0.0 +host=powerpc-apple-darwin8.2.0 # An echo program that does not interpret backslashes. echo="echo" @@ -313,7 +313,7 @@ variables_saved_for_relink="PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" link_all_deplibs=yes # Compile-time system search path for libraries -sys_lib_search_path_spec=" /usr/libexec/gcc/darwin/ppc/3.3/ /usr/local/libexec/gcc/darwin/ppc/3.3/ /usr/libexec/gcc/darwin/../../ppc-darwin/lib/ppc/3.3/ /usr/libexec/gcc/darwin/../../ppc-darwin/lib/ /usr/lib/gcc/darwin/ppc/3.3/ /usr/lib/gcc/darwin/ /usr/libexec/gcc/darwin/ppc/3.3/../../../ppc/3.3/ /usr/libexec/gcc/darwin/ppc/3.3/../../../ /lib/ppc/3.3/ /lib/ /usr/lib/ppc/3.3/ /usr/lib/ /lib /usr/lib /usr/local/lib" +sys_lib_search_path_spec=" /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/ /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/ /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../../powerpc-apple-darwin8/lib/powerpc-apple-darwin8/4.0.0/ /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../../powerpc-apple-darwin8/lib/ /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../powerpc-apple-darwin8/4.0.0/ /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../ /lib/powerpc-apple-darwin8/4.0.0/ /lib/ /usr/lib/powerpc-apple-darwin8/4.0.0/ /usr/lib/ /lib /usr/lib /usr/local/lib" # Run-time system search path for libraries sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib" @@ -6630,7 +6630,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac` # End: # ### BEGIN LIBTOOL TAG CONFIG: CXX -# Libtool was configured on host stitch.ds.co.ug: +# Libtool was configured on host lilo.ds.co.ug: # Shell to use when invoking shell scripts. SHELL="/bin/sh" @@ -6652,7 +6652,7 @@ fast_install=needless # The host system. host_alias= -host=powerpc-apple-darwin8.0.0 +host=powerpc-apple-darwin8.2.0 # An echo program that does not interpret backslashes. echo="echo" @@ -6899,7 +6899,7 @@ variables_saved_for_relink="PATH DYLD_LIBRARY_PATH GCC_EXEC_PREFIX COMPILER_PAT link_all_deplibs=yes # Compile-time system search path for libraries -sys_lib_search_path_spec=" /usr/libexec/gcc/darwin/ppc/3.3/ /usr/local/libexec/gcc/darwin/ppc/3.3/ /usr/libexec/gcc/darwin/../../ppc-darwin/lib/ppc/3.3/ /usr/libexec/gcc/darwin/../../ppc-darwin/lib/ /usr/lib/gcc/darwin/ppc/3.3/ /usr/lib/gcc/darwin/ /usr/libexec/gcc/darwin/ppc/3.3/../../../ppc/3.3/ /usr/libexec/gcc/darwin/ppc/3.3/../../../ /lib/ppc/3.3/ /lib/ /usr/lib/ppc/3.3/ /usr/lib/ /lib /usr/lib /usr/local/lib" +sys_lib_search_path_spec=" /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/ /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/ /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../../powerpc-apple-darwin8/lib/powerpc-apple-darwin8/4.0.0/ /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../../powerpc-apple-darwin8/lib/ /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../powerpc-apple-darwin8/4.0.0/ /usr/lib/gcc/powerpc-apple-darwin8/4.0.0/../../../ /lib/powerpc-apple-darwin8/4.0.0/ /lib/ /usr/lib/powerpc-apple-darwin8/4.0.0/ /usr/lib/ /lib /usr/lib /usr/local/lib" # Run-time system search path for libraries sys_lib_dlsearch_path_spec="/usr/local/lib /lib /usr/lib" diff --git a/mbuni/misc-patches/mbuni-kannel-patch-full b/mbuni/misc-patches/mbuni-kannel-patch-full index 995a90d..ca0ebb2 100644 --- a/mbuni/misc-patches/mbuni-kannel-patch-full +++ b/mbuni/misc-patches/mbuni-kannel-patch-full @@ -1,6 +1,6 @@ -diff -Naur gateway-1.4.0/Makefile.in gateway-1.4.0-patched/Makefile.in +diff -Naur gateway-1.4.0/Makefile.in gateway/Makefile.in --- gateway-1.4.0/Makefile.in 2004-08-25 00:50:09.000000000 +0300 -+++ gateway-1.4.0-patched/Makefile.in 2005-01-29 16:21:19.000000000 +0300 ++++ gateway/Makefile.in 2005-01-29 16:21:19.000000000 +0300 @@ -262,9 +262,13 @@ $(INSTALL) $(man8pages) $(DESTDIR)$(mandir)/man8 $(INSTALL) -d $(DESTDIR)$(includedir)/kannel/gwlib @@ -23,9 +23,9 @@ diff -Naur gateway-1.4.0/Makefile.in gateway-1.4.0-patched/Makefile.in + "-L$(libdir)/kannel -lwap -lgwlib @LIBS@" \ "@VERSION@" > gw-config chmod 0755 gw-config -diff -Naur gateway-1.4.0/gw/ota_compiler.c gateway-1.4.0-patched/gw/ota_compiler.c +diff -Naur gateway-1.4.0/gw/ota_compiler.c gateway/gw/ota_compiler.c --- gateway-1.4.0/gw/ota_compiler.c 2004-01-22 17:08:24.000000000 +0300 -+++ gateway-1.4.0-patched/gw/ota_compiler.c 2005-01-28 17:07:56.000000000 +0300 ++++ gateway/gw/ota_compiler.c 2005-01-28 17:07:56.000000000 +0300 @@ -91,9 +91,10 @@ * chapter 8.2. */ @@ -417,9 +417,9 @@ diff -Naur gateway-1.4.0/gw/ota_compiler.c gateway-1.4.0-patched/gw/ota_compiler output_char(ota_hex, otabxml); } else { output_char(ota_hex, otabxml); -diff -Naur gateway-1.4.0/gw/ota_prov.c gateway-1.4.0-patched/gw/ota_prov.c +diff -Naur gateway-1.4.0/gw/ota_prov.c gateway/gw/ota_prov.c --- gateway-1.4.0/gw/ota_prov.c 2004-01-22 17:08:24.000000000 +0300 -+++ gateway-1.4.0-patched/gw/ota_prov.c 2005-06-20 13:32:51.000000000 +0300 ++++ gateway/gw/ota_prov.c 2005-06-20 13:32:51.000000000 +0300 @@ -70,12 +70,16 @@ #include "gwlib/gwlib.h" @@ -587,9 +587,9 @@ diff -Naur gateway-1.4.0/gw/ota_prov.c gateway-1.4.0-patched/gw/ota_prov.c return -1; } -diff -Naur gateway-1.4.0/gw/ota_prov.h gateway-1.4.0-patched/gw/ota_prov.h +diff -Naur gateway-1.4.0/gw/ota_prov.h gateway/gw/ota_prov.h --- gateway-1.4.0/gw/ota_prov.h 2004-01-22 17:08:24.000000000 +0300 -+++ gateway-1.4.0-patched/gw/ota_prov.h 2005-01-28 17:18:20.000000000 +0300 ++++ gateway/gw/ota_prov.h 2005-01-28 17:18:20.000000000 +0300 @@ -77,7 +77,7 @@ * Return -2 when header error, -1 when compile error, 0 when no error */ @@ -599,9 +599,9 @@ diff -Naur gateway-1.4.0/gw/ota_prov.h gateway-1.4.0-patched/gw/ota_prov.h /* * Tokenizes a given 'ota-setting' group (without using the xml compiler) to -diff -Naur gateway-1.4.0/gw/smsbox.c gateway-1.4.0-patched/gw/smsbox.c +diff -Naur gateway-1.4.0/gw/smsbox.c gateway/gw/smsbox.c --- gateway-1.4.0/gw/smsbox.c 2004-09-03 15:42:33.000000000 +0300 -+++ gateway-1.4.0-patched/gw/smsbox.c 2005-02-08 11:23:25.000000000 +0300 ++++ gateway/gw/smsbox.c 2005-02-08 11:23:25.000000000 +0300 @@ -1210,6 +1210,7 @@ break; @@ -696,9 +696,9 @@ diff -Naur gateway-1.4.0/gw/smsbox.c gateway-1.4.0-patched/gw/smsbox.c *status = HTTP_BAD_REQUEST; msg_destroy(msg); if (r == -2) { -diff -Naur gateway-1.4.0/gw/xml_shared.h gateway-1.4.0-patched/gw/xml_shared.h +diff -Naur gateway-1.4.0/gw/xml_shared.h gateway/gw/xml_shared.h --- gateway-1.4.0/gw/xml_shared.h 2004-01-22 17:08:24.000000000 +0300 -+++ gateway-1.4.0-patched/gw/xml_shared.h 2005-01-28 17:23:22.000000000 +0300 ++++ gateway/gw/xml_shared.h 2005-01-28 17:23:22.000000000 +0300 @@ -82,10 +82,11 @@ * XML binary type not containing a string table. This is used for SI and SL. */ @@ -715,10 +715,10 @@ diff -Naur gateway-1.4.0/gw/xml_shared.h gateway-1.4.0-patched/gw/xml_shared.h }; /* -diff -Naur gateway-1.4.0/gwlib/cfg.def gateway-1.4.0-patched/gwlib/cfg.def +diff -Naur gateway-1.4.0/gwlib/cfg.def gateway/gwlib/cfg.def --- gateway-1.4.0/gwlib/cfg.def 2004-06-28 18:18:35.000000000 +0300 -+++ gateway-1.4.0-patched/gwlib/cfg.def 2005-07-15 08:08:36.000000000 +0300 -@@ -544,6 +544,69 @@ ++++ gateway/gwlib/cfg.def 2005-09-02 13:50:06.000000000 +0300 +@@ -544,6 +544,106 @@ OCTSTR(unified-prefix) ) @@ -764,7 +764,10 @@ diff -Naur gateway-1.4.0/gwlib/cfg.def gateway-1.4.0-patched/gwlib/cfg.def + OCTSTR(mms-client-ip-header) + OCTSTR(allow-ip-type) + OCTSTR(optimize-notification-size) -+ OCTSTR(content-adaptation) ++ OCTSTR(content-adaptation) ++ ++ OCTSTR(sendmms-port) ++ OCTSTR(sendmms-port-ssl) +) + +MULTI_GROUP(mmsproxy, @@ -785,12 +788,46 @@ diff -Naur gateway-1.4.0/gwlib/cfg.def gateway-1.4.0-patched/gwlib/cfg.def + OCTSTR(mmsc-password) +) + ++MULTI_GROUP(send-mms-user, ++ OCTSTR(username) ++ OCTSTR(password) ++ OCTSTR(faked-sender) ++) ++ ++MULTI_GROUP(mmsc, ++ OCTSTR(id) ++ OCTSTR(mmsc-url) ++ OCTSTR(incoming-username) ++ OCTSTR(incoming-password) ++ OCTSTR(incoming-port) ++ OCTSTR(incoming-port-ssl) ++ OCTSTR(max-throughput) ++ OCTSTR(type) ++) ++ ++MULTI_GROUP(mms-service, ++ OCTSTR(name) ++ OCTSTR(get-url) ++ OCTSTR(post-url) ++ OCTSTR(exec) ++ OCTSTR(file) ++ OCTSTR(text) ++ OCTSTR(faked-sender) ++ OCTSTR(catch-all) ++ OCTSTR(omit-empty) ++ OCTSTR(accept-x-mbuni-headers) ++ OCTSTR(assume-plain-text) ++ OCTSTR(accepted-mmscs) ++ OCTSTR(keyword) ++ OCTSTR(aliases) ++ OCTSTR(http-post-parameters) ++) #undef OCTSTR #undef SINGLE_GROUP #undef MULTI_GROUP -diff -Naur gateway-1.4.0/gwlib/mime.c gateway-1.4.0-patched/gwlib/mime.c +diff -Naur gateway-1.4.0/gwlib/mime.c gateway/gwlib/mime.c --- gateway-1.4.0/gwlib/mime.c 2004-08-11 19:41:29.000000000 +0300 -+++ gateway-1.4.0-patched/gwlib/mime.c 2005-04-14 08:31:05.000000000 +0300 ++++ gateway/gwlib/mime.c 2005-04-14 08:31:05.000000000 +0300 @@ -191,11 +191,11 @@ value = http_header_value(headers, octstr_imm("Content-Type")); boundary = http_get_header_parameter(value, octstr_imm("boundary")); @@ -868,9 +905,9 @@ diff -Naur gateway-1.4.0/gwlib/mime.c gateway-1.4.0-patched/gwlib/mime.c /******************************************************************** * Routines for debugging purposes. -diff -Naur gateway-1.4.0/gwlib/mime.h gateway-1.4.0-patched/gwlib/mime.h +diff -Naur gateway-1.4.0/gwlib/mime.h gateway/gwlib/mime.h --- gateway-1.4.0/gwlib/mime.h 2004-01-26 18:04:57.000000000 +0300 -+++ gateway-1.4.0-patched/gwlib/mime.h 2005-04-13 17:59:48.000000000 +0300 ++++ gateway/gwlib/mime.h 2005-04-13 17:59:48.000000000 +0300 @@ -141,6 +141,13 @@ Octstr *mime_entity_body(MIMEEntity *m); @@ -885,9 +922,9 @@ diff -Naur gateway-1.4.0/gwlib/mime.h gateway-1.4.0-patched/gwlib/mime.h * Dump the structure (hicharchical view) of the MIME representation * structure into our DEBUG log level facility. */ -diff -Naur gateway-1.4.0/test/test_ppg.c gateway-1.4.0-patched/test/test_ppg.c +diff -Naur gateway-1.4.0/test/test_ppg.c gateway/test/test_ppg.c --- gateway-1.4.0/test/test_ppg.c 2004-10-13 10:38:13.000000000 +0300 -+++ gateway-1.4.0-patched/test/test_ppg.c 2005-05-31 08:31:10.000000000 +0300 ++++ gateway/test/test_ppg.c 2005-05-31 08:31:10.000000000 +0300 @@ -81,7 +81,7 @@ static int verbose = 1, use_hardcoded = 0, @@ -915,9 +952,9 @@ diff -Naur gateway-1.4.0/test/test_ppg.c gateway-1.4.0-patched/test/test_ppg.c wait_seconds = atof(optarg); break; -diff -Naur gateway-1.4.0/wap/wsp_headers.c gateway-1.4.0-patched/wap/wsp_headers.c +diff -Naur gateway-1.4.0/wap/wsp_headers.c gateway/wap/wsp_headers.c --- gateway-1.4.0/wap/wsp_headers.c 2004-08-08 23:39:56.000000000 +0300 -+++ gateway-1.4.0-patched/wap/wsp_headers.c 2005-07-07 18:53:59.000000000 +0300 ++++ gateway/wap/wsp_headers.c 2005-07-07 18:53:59.000000000 +0300 @@ -122,10 +122,9 @@ } else if (val > 127) { *well_known_value = val - 128; @@ -987,9 +1024,9 @@ diff -Naur gateway-1.4.0/wap/wsp_headers.c gateway-1.4.0-patched/wap/wsp_headers if (tmp >= 0) { wsp_pack_integer_value(packed, tmp); return; -diff -Naur gateway-1.4.0/wap/wsp_headers.h gateway-1.4.0-patched/wap/wsp_headers.h +diff -Naur gateway-1.4.0/wap/wsp_headers.h gateway/wap/wsp_headers.h --- gateway-1.4.0/wap/wsp_headers.h 2004-01-26 18:06:38.000000000 +0300 -+++ gateway-1.4.0-patched/wap/wsp_headers.h 2005-07-06 08:19:01.000000000 +0300 ++++ gateway/wap/wsp_headers.h 2005-07-06 08:19:01.000000000 +0300 @@ -141,6 +141,7 @@ int wsp_pack_date(Octstr *packet, Octstr *value); int wsp_pack_retry_after(Octstr *packet, Octstr *value); diff --git a/mbuni/mmlib/Makefile.in b/mbuni/mmlib/Makefile.in index a9b4e7e..a7ab410 100644 --- a/mbuni/mmlib/Makefile.in +++ b/mbuni/mmlib/Makefile.in @@ -114,6 +114,7 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ +OPENSSL = @OPENSSL@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ diff --git a/mbuni/mmlib/mms_util.c b/mbuni/mmlib/mms_util.c index e3ed7f8..76f7cd2 100644 --- a/mbuni/mmlib/mms_util.c +++ b/mbuni/mmlib/mms_util.c @@ -27,6 +27,65 @@ #include "mms_uaprof.h" +Octstr *_mms_cfg_getx(CfgGroup *grp, Octstr *item) +{ + Octstr *v = cfg_get(grp, item); + + return v ? v : octstr_create(""); +} + + +int mms_load_core_settings(CfgGroup *cgrp) +{ + Octstr *log, *alog; + Octstr *http_proxy_host; + long loglevel; + + /* Set the log file. */ + log = cfg_get(cgrp, octstr_imm("log-file")); + if (log != NULL) { + if (cfg_get_integer(&loglevel, cgrp, octstr_imm("log-level")) == -1) + loglevel = 0; + log_open(octstr_get_cstr(log), loglevel, GW_NON_EXCL); + octstr_destroy(log); + } + + /* Get access log and open it. */ + alog = cfg_get(cgrp, octstr_imm("access-log")); + if (alog) { + alog_open(octstr_get_cstr(alog), 1, 1); + octstr_destroy(alog); + } + + /* look for http proxy. If set, use it. */ + if ((http_proxy_host = cfg_get(cgrp, octstr_imm("http-proxy-host"))) != NULL) { + + Octstr *username = cfg_get(cgrp, + octstr_imm("http-proxy-username")); + Octstr *password = cfg_get(cgrp, + octstr_imm("http-proxy-password")); + List *exceptions = cfg_get_list(cgrp, + octstr_imm("http-proxy-exceptions")); + long http_proxy_port = -1; + + cfg_get_integer(&http_proxy_port, cgrp, octstr_imm("http-proxy-port")); + + if (http_proxy_port > 0) + http_use_proxy(http_proxy_host, http_proxy_port, + exceptions, username, password); + octstr_destroy(http_proxy_host); + octstr_destroy(username); + octstr_destroy(password); + list_destroy(exceptions, octstr_destroy_item); + } + +#ifdef HAVE_LIBSSL + conn_config_ssl(cgrp); +#endif + + return 0; +} + Octstr *mms_find_sender_ip(List *request_hdrs, Octstr *ip_header, Octstr *ip, int *isv6) { Octstr *xip; diff --git a/mbuni/mmlib/mms_util.h b/mbuni/mmlib/mms_util.h index 7223dfb..9c52667 100644 --- a/mbuni/mmlib/mms_util.h +++ b/mbuni/mmlib/mms_util.h @@ -43,14 +43,13 @@ /* Global variables and shared code used by all modules. */ - -extern char *mms_hostname; /* Our hostname. */ #define MMSC_VERSION VERSION #define MMS_NAME PACKAGE /* Message location flags: Used to distinguish fetch-urls */ enum mms_loc_t {MMS_LOC_MMBOX = 1, MMS_LOC_MQUEUE=2}; +extern int mms_load_core_settings(CfgGroup *cgrp); extern Octstr *mms_maketransid(char *qf, Octstr *mmscname); @@ -122,4 +121,7 @@ extern MIMEEntity *mime_entity_duplicate(MIMEEntity *m); /* Returns true if the character is printable or space */ int _mms_gw_isprint(int c); + +/* Special form of cfg_get which returns zero-length string when there is nothing. */ +Octstr *_mms_cfg_getx(CfgGroup *grp, Octstr *item); #endif diff --git a/mbuni/mmsbox/Makefile b/mbuni/mmsbox/Makefile new file mode 100644 index 0000000..9aa2a41 --- /dev/null +++ b/mbuni/mmsbox/Makefile @@ -0,0 +1,448 @@ +# Makefile.in generated by automake 1.9.3 from Makefile.am. +# mmsbox/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +SOURCES = $(mmsbox_SOURCES) + +srcdir = . +top_srcdir = .. + +pkgdatadir = $(datadir)/mbuni +pkglibdir = $(libdir)/mbuni +pkgincludedir = $(includedir)/mbuni +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = powerpc-apple-darwin8.2.0 +host_triplet = powerpc-apple-darwin8.2.0 +bin_PROGRAMS = mmsbox$(EXEEXT) +subdir = mmsbox +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_mmsbox_OBJECTS = mmsbox.$(OBJEXT) mmsbox_cfg.$(OBJEXT) +mmsbox_OBJECTS = $(am_mmsbox_OBJECTS) +mmsbox_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(mmsbox_SOURCES) +DIST_SOURCES = $(mmsbox_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /Users/bagyenda/src/mbuni/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /Users/bagyenda/src/mbuni/missing --run tar +AR = ar +AUTOCONF = ${SHELL} /Users/bagyenda/src/mbuni/missing --run autoconf +AUTOHEADER = ${SHELL} /Users/bagyenda/src/mbuni/missing --run autoheader +AUTOMAKE = ${SHELL} /Users/bagyenda/src/mbuni/missing --run automake-1.9 +AWK = gawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -I./../mmlib -g -O2 -DDARWIN=1 -I/sw/include -I/usr/local/include/kannel -DDARWIN=1 -I/sw/include/libxml2 -I/sw/include -I/sw/include +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +ECHO = echo +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = grep -E +EXEEXT = +EXE_EXT = +F77 = +FFLAGS = +GW_CONFIG = /usr/local/bin/gw-config +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBOBJS = error$U.o lstat$U.o +LIBS = -L./../mmlib -lmms -lwap -lgwlib -lssl -lpthread -ldl -L/sw/lib -lcrypto -lssl -L/usr/local/lib/kannel -lwap -lgwlib -lssl -lresolv -lm -lpthread -liconv -L/sw/lib -lxml2 -lz -lpthread -L/sw/lib -liconv -lm -L/sw/lib -lcrypto -lssl +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LN_S = ln -s +LTLIBOBJS = error$U.lo lstat$U.lo +MAKEINFO = ${SHELL} /Users/bagyenda/src/mbuni/missing --run makeinfo +OBJEXT = o +OPENSSL = /usr/bin/openssl +PACKAGE = mbuni +PACKAGE_BUGREPORT = devel@mbuni.org +PACKAGE_NAME = mbuni +PACKAGE_STRING = mbuni cvs +PACKAGE_TARNAME = mbuni +PACKAGE_VERSION = cvs +PATH_SEPARATOR = : +RANLIB = ranlib +SET_MAKE = +SHELL = /bin/sh +STRIP = strip +VERSION = cvs +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_F77 = +ac_ct_RANLIB = ranlib +ac_ct_STRIP = strip +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__fastdepCXX_FALSE = # +am__fastdepCXX_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = powerpc-apple-darwin8.2.0 +build_alias = +build_cpu = powerpc +build_os = darwin8.2.0 +build_vendor = apple +datadir = ${prefix}/share +exec_prefix = ${prefix} +host = powerpc-apple-darwin8.2.0 +host_alias = +host_cpu = powerpc +host_os = darwin8.2.0 +host_vendor = apple +includedir = ${prefix}/include +infodir = ${prefix}/info +install_sh = /Users/bagyenda/src/mbuni/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localstatedir = ${prefix}/var +mandir = ${prefix}/man +mkdir_p = $(install_sh) -d +oldincludedir = /usr/include +prefix = /usr/local +program_transform_name = s,x,x, +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target_alias = +mmsbox_SOURCES = mmsbox.c mmsbox_cfg.c +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mmsbox/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu mmsbox/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +mmsbox$(EXEEXT): $(mmsbox_OBJECTS) $(mmsbox_DEPENDENCIES) + @rm -f mmsbox$(EXEEXT) + $(LINK) $(mmsbox_LDFLAGS) $(mmsbox_OBJECTS) $(mmsbox_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/mmsbox.Po +include ./$(DEPDIR)/mmsbox_cfg.Po + +.c.o: + if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c $< + +.c.obj: + if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) \ +# $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mbuni/mmsbox/Makefile.am b/mbuni/mmsbox/Makefile.am new file mode 100644 index 0000000..0f9ec42 --- /dev/null +++ b/mbuni/mmsbox/Makefile.am @@ -0,0 +1,3 @@ +bin_PROGRAMS = mmsbox +mmsbox_SOURCES = mmsbox.c mmsbox_cfg.c + diff --git a/mbuni/mmsbox/mmsbox.c b/mbuni/mmsbox/mmsbox.c new file mode 100644 index 0000000..4ea4d93 --- /dev/null +++ b/mbuni/mmsbox/mmsbox.c @@ -0,0 +1,65 @@ +/* + * Mbuni - Open Source MMS Gateway + * + * MMSBOX: MMS Content engine + * + * Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com + * + * Paul Bagyenda + * + * This program is free software, distributed under the terms of + * the GNU General Public License, with a few exceptions granted (see LICENSE) + */ + +#include +#include +#include + +#include "mmsbox_cfg.h" + +static int rstop = 0; +static void quit_now(int notused) +{ + rstop = 1; + + /* Close all MMSC http ports, kill all MMSC threads, kill sendmms port... */ +} + +int main(int argc, char *argv[]) +{ + Octstr *fname; + int cfidx; + Cfg *cfg; + + mms_lib_init(); + + srandom(time(NULL)); + + cfidx = get_and_set_debugs(argc, argv, NULL); + + if (argv[cfidx] == NULL) + fname = octstr_imm("mbuni.conf"); + else + fname = octstr_create(argv[cfidx]); + + cfg = cfg_create(fname); + + if (cfg_read(cfg) == -1) + panic(0, "Couldn't read configuration from '%s'.", octstr_get_cstr(fname)); + + octstr_destroy(fname); + + info(0, "----------------------------------------"); + info(0, " " MM_NAME " MMSBox version %s starting", MMSC_VERSION); + + + mms_load_mmsbox_settings(cfg,NULL); + + cfg_destroy(cfg); + + signal(SIGHUP, quit_now); + signal(SIGTERM, quit_now); + signal(SIGPIPE,SIG_IGN); /* Ignore pipe errors. They kill us sometimes for nothing*/ + + return 0; +} diff --git a/mbuni/mmsbox/mmsbox_cfg.c b/mbuni/mmsbox/mmsbox_cfg.c new file mode 100644 index 0000000..be31268 --- /dev/null +++ b/mbuni/mmsbox/mmsbox_cfg.c @@ -0,0 +1,255 @@ +/* + * Mbuni - Open Source MMS Gateway + * + * MMSC CFG: MMC configuration and misc. functions + * + * Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com + * + * Paul Bagyenda + * + * This program is free software, distributed under the terms of + * the GNU General Public License, with a few exceptions granted (see LICENSE) + */ +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include "mmsbox_cfg.h" +#include "mms_queue.h" + +List *sendmms_users = NULL; /* list of SendMmsUser structs */ +List *mms_services = NULL; /* list of MMS Services */ +List *mmscs = NULL; +Octstr *incoming_qdir, *outgoing_qdir; +struct SendMmsPortInfo sendmms_port; + +int mms_load_mmsbox_settings(Cfg *cfg, gwthread_func_t *mmsc_handler_func) +{ + CfgGroup *grp = cfg_get_single_group(cfg, octstr_imm("mmsbox")); + CfgGroup *cgrp = cfg_get_single_group(cfg, octstr_imm("core")); + Octstr *gdir; + int send_port_ssl = 0; + List *l; + int i, n; + + mms_load_core_settings(cgrp); + + sendmms_users = list_create(); + mms_services = list_create(); + mmscs = list_create(); + + gdir = cfg_get(grp, octstr_imm("storage-directory")); + + if (gdir == NULL) + gdir = octstr_imm("."); + + if (mkdir(octstr_get_cstr(gdir), + S_IRWXU|S_IRWXG) < 0 && + errno != EEXIST) + panic(0, "Failed to create queue directory: %s - %s!", + octstr_get_cstr(gdir), strerror(errno)); + + incoming_qdir = octstr_format("%S/mmsbox_incoming", gdir); + outgoing_qdir = octstr_format("%S/mmsbox_outgoing", gdir); + + if (mms_init_queuedir(incoming_qdir) < 0) + panic(0, "Failed to initialise incoming queue directory: %s - %s!", + octstr_get_cstr(incoming_qdir), strerror(errno)); + + if (mms_init_queuedir(outgoing_qdir) < 0) + panic(0, "Failed to initialise outgoing queue directory: %s - %s!", + octstr_get_cstr(outgoing_qdir), strerror(errno)); + + cfg_get_integer(&sendmms_port.port, grp, octstr_imm("sendmms-port")); +#ifdef HAVE_LIBSSL + cfg_get_bool(&send_port_ssl, grp, octstr_imm("sendmms-port-ssl")); +#endif + if (http_open_port(sendmms_port.port, send_port_ssl) < 0) + error(0, "MMSBox: Failed to start sendmms HTTP server on %ld: %s!", + sendmms_port.port, + strerror(errno)); + + sendmms_port.allow_ip = cfg_get(grp, octstr_imm("allow-ip")); + sendmms_port.deny_ip = cfg_get(grp, octstr_imm("deny-ip")); + + /* Now get sendmms users. */ + + l = cfg_get_multi_group(cfg, octstr_imm("send-mms-user")); + for (i = 0, n = list_len(l); i < n; i++) { + CfgGroup *x = list_get(l, i); + SendMmsUser *u = gw_malloc(sizeof *u); + + memset(u, 0, sizeof *u); + + u->user = _mms_cfg_getx(x, octstr_imm("username")); + u->pass = _mms_cfg_getx(x, octstr_imm("password")); + u->faked_sender = _mms_cfg_getx(x, octstr_imm("faked-sender")); + list_append(sendmms_users, u); + } + list_destroy(l, NULL); + + /* Get mmsc list. */ + l = cfg_get_multi_group(cfg, octstr_imm("mmsc")); + for (i = 0, n = list_len(l); i < n; i++) { + CfgGroup *x = list_get(l, i); + MmscGrp *m = gw_malloc(sizeof *m); + int ssl = 0; + Octstr *type; + + memset(m, 0, sizeof *m); + + m->id = _mms_cfg_getx(x, octstr_imm("id")); + m->mmsc_url = _mms_cfg_getx(x, octstr_imm("mmsc-url")); + + m->incoming.user = _mms_cfg_getx(x, octstr_imm("incoming-username")); + m->incoming.pass = _mms_cfg_getx(x, octstr_imm("incoming-password")); + cfg_get_integer(&m->incoming.port, x, octstr_imm("incoming-port")); +#ifdef HAVE_LIBSSL + cfg_get_bool(&ssl, x, octstr_imm("incoming-port-ssl")); +#endif + cfg_get_integer(&m->throughput, x, octstr_imm("max-throughput")); + + type = _mms_cfg_getx(x, octstr_imm("type")); + if (octstr_case_compare(type, octstr_imm("eaif")) == 0) + m->type = EAIF_MMSC; + else if (octstr_case_compare(type, octstr_imm("soap")) == 0) + m->type = SOAP_MMSC; + else + warning(0, "MMSBox: Unknown MMSC type [%s]!", + octstr_get_cstr(type)); + + octstr_destroy(type); + + if (m->incoming.port > 0 && + http_open_port(m->incoming.port, ssl) < 0) { + warning(0, "MMSBox: Failed to start HTTP server on receive port for " + " MMSC %s, port %ld: %s!", + octstr_get_cstr(m->id), m->incoming.port, + strerror(errno)); + m->incoming.port = 0; /* so we don't listen on it. */ + } + + if (mmsc_handler_func) { /* Only start threads if func passed. */ + if ((m->threadid = gwthread_create(mmsc_handler_func, m)) < 0) + error(0, "MMSBox: Failed to start MMSC handler thread for MMSC[%s]: %s!", + octstr_get_cstr(m->id), strerror(errno)); + } else + m->threadid = -1; + list_append(mmscs, m); + + } + list_destroy(l, NULL); + + + l = cfg_get_multi_group(cfg, octstr_imm("mms-service")); + for (i = 0, n = list_len(l); i < n; i++) { + CfgGroup *x = list_get(l, i); + MmsService *m = gw_malloc(sizeof *m); + Octstr *s; + + m->name = _mms_cfg_getx(x, octstr_imm("name")); + if ((m->url = cfg_get(x, octstr_imm("get-url"))) != NULL) + m->type = TRANS_TYPE_GET_URL; + else if ((m->url = cfg_get(x, octstr_imm("post-url"))) != NULL) + m->type = TRANS_TYPE_POST_URL; + else if ((m->url = cfg_get(x, octstr_imm("file"))) != NULL) + m->type = TRANS_TYPE_FILE; + else if ((m->url = cfg_get(x, octstr_imm("exec"))) != NULL) + m->type = TRANS_TYPE_EXEC; + else if ((m->url = cfg_get(x, octstr_imm("text"))) != NULL) + m->type = TRANS_TYPE_TEXT; + else + panic(0, "MMSBox: Service [%s] has no url!", octstr_get_cstr(m->name)); + + m->faked_sender = _mms_cfg_getx(x, octstr_imm("faked-sender")); + cfg_get_bool(&m->isdefault, x, octstr_imm("catch-all")); + cfg_get_bool(&m->omitempty, x, octstr_imm("omit-empty")); + cfg_get_bool(&m->accept_x_headers, x, octstr_imm("accept-x-mbuni-headers")); + cfg_get_bool(&m->assume_plain_text, x, octstr_imm("assume-plain-text")); + + if ((s = cfg_get(x, octstr_imm("accepted-mmscs"))) != NULL) { + m->allowed_mmscs = octstr_split(s, octstr_imm(";")); + octstr_destroy(s); + } else + m->allowed_mmscs = NULL; /* means allow all. */ + + /* Get key words. Start with aliases to make life easier. */ + if ((s = cfg_get(x, octstr_imm("aliases"))) != NULL) { + m->keywords = octstr_split(s, octstr_imm(";")); + octstr_destroy(s); + } else + m->keywords = list_create(); + + s = cfg_get(x, octstr_imm("keyword")); + if (!s) + panic(0, "MMSBox: Service [%s] has no keyword!", octstr_get_cstr(m->name)); + else + list_append(m->keywords, s); + + if ((s = cfg_get(x, octstr_imm("http-post-parameters"))) != NULL) { + List *r = octstr_split(s, octstr_imm("&")); + int i, n; + m->params = list_create(); + if (m->type != TRANS_TYPE_POST_URL) + warning(0, "MMSBox: Service [%s] specifies HTTP Post parameters " + "without specifying post-url type/url!", octstr_get_cstr(m->name)); + for (i = 0, n = list_len(r); i < n; i++) { + Octstr *y = list_get(r, i); + int ii = octstr_search_char(y, '=', 0); + if (ii < 0) + ii = octstr_len(y); + + if (ii > 0) { + MmsServiceUrlParam *p = gw_malloc(sizeof *p); + int ch; + p->name = octstr_copy(y, 0, ii); + p->value = NULL; + + if (octstr_get_char(y, ii+1) == '%') { + switch(ch = octstr_get_char(y, ii+2)) { + case 'I': + p->type = IMAGE_PART; break; + case 'V': + p->type = VIDEO_PART; break; + case 'T': + p->type = TEXT_PART; break; + case 'S': + p->type = SMIL_PART; break; + case 'O': + p->type = OTHER_PART; break; + case 'A': + p->type = ANY_PART; break; + case '%': + p->type = NO_PART; break; + default: + warning(0, "MMSBox: Unknown conversion character %c " + "in http-post-parameters. Service [%s]!", + ch, octstr_get_cstr(m->name)); + p->type = NO_PART; + break; + } + p->value = octstr_copy(y, ii+2, octstr_len(y)); + } else /* No conversion spec. */ + p->value = octstr_copy(y, ii+1, octstr_len(y)); + list_append(m->params, p); + } else + warning(0, "MMSBox: Missing http-post-parameter name? Service [%s]!", + octstr_get_cstr(m->name)); + } + list_destroy(r, (list_item_destructor_t *)octstr_destroy); + octstr_destroy(s); + } else + m->params = NULL; + + list_append(mms_services, m); + } + list_destroy(l, NULL); + + return 0; +} diff --git a/mbuni/mmsbox/mmsbox_cfg.h b/mbuni/mmsbox/mmsbox_cfg.h new file mode 100644 index 0000000..80f464d --- /dev/null +++ b/mbuni/mmsbox/mmsbox_cfg.h @@ -0,0 +1,72 @@ +/* + * Mbuni - Open Source MMS Gateway + * + * MMSBOX CFG: MMC configuration and misc. functions + * + * Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com + * + * Paul Bagyenda + * + * This program is free software, distributed under the terms of + * the GNU General Public License, with a few exceptions granted (see LICENSE) + */ +#ifndef __MMSBOX_CFG_INCLUDED__ +#define __MMSBOX_CFG_INCLUDED__ +#include "mms_util.h" + +typedef struct MmscGrp { + Octstr *id; /* MMSC id (for logging). */ + Octstr *mmsc_url; /* URL at which MMSC can be reached. */ + struct { + Octstr *user, *pass; + long port; + } incoming; /* user, pass, port (and whether SSL) that MMSC uses to connect to us. */ + enum {UNKNOWN_MMSC, SOAP_MMSC, EAIF_MMSC} type; /* type of connection. */ + long throughput; /* Max send rate. */ + long threadid; /* handler thread. */ +} MmscGrp; + +typedef struct MmsServiceUrlParam { + Octstr *name; + enum {NO_PART, IMAGE_PART, VIDEO_PART, + TEXT_PART, SMIL_PART , OTHER_PART, + ANY_PART } type; + Octstr *value; /* for generic value (type == NO_PART), + * or for value that follows spec (e.g. %Tisatest is allowed) */ +} MmsServiceUrlParam; + +typedef struct MmsService { + Octstr *name; /* name of service. */ + int isdefault; + int omitempty; + int accept_x_headers; + int assume_plain_text; + List *keywords; /* List of keywords matched. */ + enum {TRANS_TYPE_GET_URL, TRANS_TYPE_POST_URL, TRANS_TYPE_FILE, TRANS_TYPE_EXEC, + TRANS_TYPE_TEXT} type; + Octstr *url; + List *params; /* of MmsServiceUrlParam */ + + Octstr *faked_sender; + List *allowed_mmscs; /* List of MMSCs allowed to access this service (by ID). */ +} MmsService; + +typedef struct SendMmsUser { + Octstr *user, *pass; + Octstr *faked_sender; +} SendMmsUser; + +/* Basic settings for the mmsbox. */ +extern List *sendmms_users; /* list of SendMmsUser structs */ +extern List *mms_services; /* list of MMS Services */ +extern List *mmscs; +extern Octstr *incoming_qdir, *outgoing_qdir; +extern struct SendMmsPortInfo { + long port; /* Might be ssl-ed. */ + Octstr *allow_ip; + Octstr *deny_ip; +} sendmms_port; + + +extern int mms_load_mmsbox_settings(Cfg *cfg, gwthread_func_t *mmsc_handler_func); +#endif diff --git a/mbuni/mmsc/Makefile.in b/mbuni/mmsc/Makefile.in index c52eee8..18fdfc9 100644 --- a/mbuni/mmsc/Makefile.in +++ b/mbuni/mmsc/Makefile.in @@ -164,6 +164,7 @@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ OBJEXT = @OBJEXT@ +OPENSSL = @OPENSSL@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ diff --git a/mbuni/mmsc/mmsc_cfg.c b/mbuni/mmsc/mmsc_cfg.c index f8cd18f..1b1f297 100644 --- a/mbuni/mmsc/mmsc_cfg.c +++ b/mbuni/mmsc/mmsc_cfg.c @@ -1,7 +1,7 @@ /* * Mbuni - Open Source MMS Gateway * - * MMS send: Inject message into queue for delivery. + * MMSC CFG: MMC configuration and misc. functions * * Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com * @@ -17,12 +17,11 @@ #include #include -#include #include #include #include #include "mmsc_cfg.h" - +#include "mms_queue.h" #define MAXQTRIES 100 #define BACKOFF_FACTOR 5*60 /* In seconds */ @@ -30,12 +29,6 @@ #define DEFAULT_EXPIRE 3600*24*7 /* One week */ #define MMS_PORT 8191 /* Default content fetch port. */ -static Octstr *cfg_getx(CfgGroup *grp, Octstr *item) -{ - Octstr *v = cfg_get(grp, item); - - return v ? v : octstr_create(""); -} static void *load_module(CfgGroup *grp, char *config_key, char *symbolname) @@ -73,63 +66,25 @@ static void *load_module(CfgGroup *grp, char *config_key, char *symbolname) MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays) { - long loglevel; Octstr *s; - Octstr *log, *alog; + List *l; CfgGroup *grp = cfg_get_single_group(cfg, octstr_imm("mmsbox")); CfgGroup *cgrp = cfg_get_single_group(cfg, octstr_imm("core")); MmscSettings *m = gw_malloc(sizeof *m); long port = -1; - Octstr *http_proxy_host, *user, *pass, *from; + Octstr *from, *user, *pass; Octstr *qdir = NULL; int i, n; memset(m, 0, sizeof *m); - /* Set the log file. */ - log = cfg_get(cgrp, octstr_imm("log-file")); - if (log != NULL) { - if (cfg_get_integer(&loglevel, cgrp, octstr_imm("log-level")) == -1) - loglevel = 0; - log_open(octstr_get_cstr(log), loglevel, GW_NON_EXCL); - octstr_destroy(log); - } - - /* Get access log and open it. */ - alog = cfg_get(cgrp, octstr_imm("access-log")); - if (alog) { - alog_open(octstr_get_cstr(alog), 1, 1); - octstr_destroy(alog); - } - - /* look for http proxy. If set, use it. */ - if ((http_proxy_host = cfg_get(cgrp, octstr_imm("http-proxy-host"))) != NULL) { - - Octstr *username = cfg_get(cgrp, - octstr_imm("http-proxy-username")); - Octstr *password = cfg_get(cgrp, - octstr_imm("http-proxy-password")); - List *exceptions = cfg_get_list(cgrp, - octstr_imm("http-proxy-exceptions")); - long http_proxy_port = -1; - - cfg_get_integer(&http_proxy_port, cgrp, octstr_imm("http-proxy-port")); - - if (http_proxy_port > 0) - http_use_proxy(http_proxy_host, http_proxy_port, - exceptions, username, password); - octstr_destroy(http_proxy_host); - octstr_destroy(username); - octstr_destroy(password); - list_destroy(exceptions, octstr_destroy_item); - } + mms_load_core_settings(cgrp); if (proxyrelays) *proxyrelays = mms_proxy_relays(cfg); - - - s = cfg_getx(grp, octstr_imm("local-mmsc-domains")); + + s = _mms_cfg_getx(grp, octstr_imm("local-mmsc-domains")); if (s) { l = octstr_split(s, octstr_imm(",")); @@ -141,19 +96,19 @@ MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays) if (cfg_get_integer(&m->maxthreads, grp, octstr_imm("max-send-threads")) == -1) m->maxthreads = 10; - m->unified_prefix = cfg_getx(grp, octstr_imm("unified-prefix")); - m->local_prefix = cfg_getx(grp, octstr_imm("local-prefixes")); - m->hostname = cfg_getx(grp, octstr_imm("hostname")); + m->unified_prefix = _mms_cfg_getx(grp, octstr_imm("unified-prefix")); + m->local_prefix = _mms_cfg_getx(grp, octstr_imm("local-prefixes")); + m->hostname = _mms_cfg_getx(grp, octstr_imm("hostname")); if (m->hostname == NULL || octstr_len(m->hostname) == 0) m->hostname = octstr_create("localhost"); - m->name = cfg_getx(grp, octstr_imm("name")); - m->host_alias = cfg_getx(grp, octstr_imm("host-alias")); + m->name = _mms_cfg_getx(grp, octstr_imm("name")); + m->host_alias = _mms_cfg_getx(grp, octstr_imm("host-alias")); - m->sendmail = cfg_getx(grp, octstr_imm("send-mail-prog")); + m->sendmail = _mms_cfg_getx(grp, octstr_imm("send-mail-prog")); - qdir = cfg_getx(grp, octstr_imm("storage-directory")); + qdir = _mms_cfg_getx(grp, octstr_imm("storage-directory")); if (mkdir(octstr_get_cstr(qdir), S_IRWXU|S_IRWXG) < 0 && @@ -196,7 +151,7 @@ MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays) if (cfg_get_integer(&m->default_msgexpiry, grp, octstr_imm("default-message-expiry")) == -1) m->default_msgexpiry = DEFAULT_EXPIRE; - s = cfg_getx(grp, octstr_imm("queue-run-interval")); + s = _mms_cfg_getx(grp, octstr_imm("queue-run-interval")); if (!s || (m->queue_interval = atof(octstr_get_cstr(s))) <= 0) m->queue_interval = QUEUERUN_INTERVAL; @@ -204,10 +159,10 @@ MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays) m->send_back_off = BACKOFF_FACTOR; /* Make send sms url. */ - m->sendsms_url = cfg_getx(grp, octstr_imm("sendsms-url")); + m->sendsms_url = _mms_cfg_getx(grp, octstr_imm("sendsms-url")); - user = cfg_getx(grp, octstr_imm("sendsms-username")); - pass = cfg_getx(grp, octstr_imm("sendsms-password")); + user = _mms_cfg_getx(grp, octstr_imm("sendsms-username")); + pass = _mms_cfg_getx(grp, octstr_imm("sendsms-password")); from = cfg_get(grp, octstr_imm("sendsms-global-sender")); if (user && octstr_len(user) > 1) @@ -238,23 +193,23 @@ MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays) m->mm7port = -1; cfg_get_integer(&m->mm7port, grp, octstr_imm("mm7-port")); - m->allow_ip = cfg_getx(grp, octstr_imm("allow-ip")); - m->deny_ip = cfg_getx(grp, octstr_imm("deny-ip")); + m->allow_ip = _mms_cfg_getx(grp, octstr_imm("allow-ip")); + m->deny_ip = _mms_cfg_getx(grp, octstr_imm("deny-ip")); - m->email2mmsrelay_prefixes = cfg_getx(grp, + m->email2mmsrelay_prefixes = _mms_cfg_getx(grp, octstr_imm("email2mms-relay-prefixes")); - m->prov_notify = cfg_getx(grp,octstr_imm("prov-server-notify-script")); + m->prov_notify = _mms_cfg_getx(grp,octstr_imm("prov-server-notify-script")); - m->prov_getstatus = cfg_getx(grp,octstr_imm("prov-server-sub-status-script")); - m->mms_notify_txt = cfg_getx(grp, octstr_imm("mms-notify-text")); - m->mms_notify_unprov_txt = cfg_getx(grp, octstr_imm("mms-notify-unprovisioned-text")); + m->prov_getstatus = _mms_cfg_getx(grp,octstr_imm("prov-server-sub-status-script")); + m->mms_notify_txt = _mms_cfg_getx(grp, octstr_imm("mms-notify-text")); + m->mms_notify_unprov_txt = _mms_cfg_getx(grp, octstr_imm("mms-notify-unprovisioned-text")); - m->mms_email_txt = cfg_getx(grp, octstr_imm("mms-to-email-txt")); - m->mms_email_html = cfg_getx(grp, octstr_imm("mms-to-email-html")); + m->mms_email_txt = _mms_cfg_getx(grp, octstr_imm("mms-to-email-txt")); + m->mms_email_html = _mms_cfg_getx(grp, octstr_imm("mms-to-email-html")); - m->mms_toolarge = cfg_getx(grp, octstr_imm("mms-message-too-large-txt")); + m->mms_toolarge = _mms_cfg_getx(grp, octstr_imm("mms-message-too-large-txt")); m->wap_gw_msisdn_header = cfg_get(grp, octstr_imm("mms-client-msisdn-header")); if (!m->wap_gw_msisdn_header) m->wap_gw_msisdn_header = octstr_imm(XMSISDN_HEADER); @@ -264,7 +219,7 @@ MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays) cfg_get_bool(&m->notify_unprovisioned, grp, octstr_imm("notify-unprovisioned")); - m->billing_params = cfg_getx(grp, + m->billing_params = _mms_cfg_getx(grp, octstr_imm("billing-module-parameters")); /* Get and load the billing lib if any. */ @@ -279,7 +234,7 @@ MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays) m->mms_bill_module_data = m->mms_billfuncs->mms_billingmodule_init(octstr_get_cstr(m->billing_params)); - m->resolver_params = cfg_getx(grp, + m->resolver_params = _mms_cfg_getx(grp, octstr_imm("resolver-module-parameters")); /* Get and load the resolver lib if any. */ @@ -293,7 +248,7 @@ MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays) m->mms_resolver_module_data = m->mms_resolvefuncs->mms_resolvermodule_init(octstr_get_cstr(m->resolver_params)); - m->detokenizer_params = cfg_getx(grp, octstr_imm("detokenizer-module-parameters")); + m->detokenizer_params = _mms_cfg_getx(grp, octstr_imm("detokenizer-module-parameters")); /* Get and load the detokenizer lib if any. */ if ((m->mms_detokenizefuncs = load_module(grp, "detokenizer-library", "mms_detokenizefuncs"))) { @@ -325,19 +280,19 @@ MmscSettings *mms_load_mmsc_settings(Cfg *cfg, List **proxyrelays) CfgGroup *grp = list_get(l, i); MmsVasp *mv = gw_malloc(sizeof *mv); Octstr *s; - mv->id = cfg_getx(grp, octstr_imm("vasp-id")); + mv->id = _mms_cfg_getx(grp, octstr_imm("vasp-id")); mv->short_code = -1; cfg_get_integer(&mv->short_code, grp, octstr_imm("short-code")); - mv->vasp_username = cfg_getx(grp, octstr_imm("vasp-username")); - mv->vasp_password = cfg_getx(grp, octstr_imm("vasp-password")); + mv->vasp_username = _mms_cfg_getx(grp, octstr_imm("vasp-username")); + mv->vasp_password = _mms_cfg_getx(grp, octstr_imm("vasp-password")); - mv->vasp_url = cfg_getx(grp, octstr_imm("vasp-url")); + mv->vasp_url = _mms_cfg_getx(grp, octstr_imm("vasp-url")); - mv->mmsc_username = cfg_getx(grp, octstr_imm("mmsc-username")); - mv->mmsc_password = cfg_getx(grp, octstr_imm("mmsc-password")); + mv->mmsc_username = _mms_cfg_getx(grp, octstr_imm("mmsc-username")); + mv->mmsc_password = _mms_cfg_getx(grp, octstr_imm("mmsc-password")); - s = cfg_getx(grp, octstr_imm("type")); + s = _mms_cfg_getx(grp, octstr_imm("type")); if (octstr_case_compare(s, octstr_imm("soap")) == 0) mv->type = SOAP_VASP; @@ -363,10 +318,10 @@ List *mms_proxy_relays(Cfg *cfg) CfgGroup *grp = list_get(gl, i); MmsProxyRelay *m = gw_malloc(sizeof *m); - m->host = cfg_getx(grp, octstr_imm("host")); - m->name = cfg_getx(grp, octstr_imm("name")); - m->allowed_prefix = cfg_getx(grp, octstr_imm("allowed-prefix")); - m->denied_prefix = cfg_getx(grp, octstr_imm("denied-prefix")); + m->host = _mms_cfg_getx(grp, octstr_imm("host")); + m->name = _mms_cfg_getx(grp, octstr_imm("name")); + m->allowed_prefix = _mms_cfg_getx(grp, octstr_imm("allowed-prefix")); + m->denied_prefix = _mms_cfg_getx(grp, octstr_imm("denied-prefix")); list_append(l, m); } diff --git a/mbuni/mmsc/mmsc_cfg.h b/mbuni/mmsc/mmsc_cfg.h index 29a5550..c005e9c 100644 --- a/mbuni/mmsc/mmsc_cfg.h +++ b/mbuni/mmsc/mmsc_cfg.h @@ -1,3 +1,15 @@ +/* + * Mbuni - Open Source MMS Gateway + * + * MMSC CFG: MMC configuration and misc. functions + * + * Copyright (C) 2003 - 2005, Digital Solutions Ltd. - http://www.dsmagic.com + * + * Paul Bagyenda + * + * This program is free software, distributed under the terms of + * the GNU General Public License, with a few exceptions granted (see LICENSE) + */ #ifndef __MMSC_CFG__ #define __MMSC_CFG__ #include "mms_util.h"