From: Markus Fischer Date: Tue, 19 Mar 2002 22:47:37 +0000 (+0000) Subject: - Support vpopmail 5.2 (fixes #16120). X-Git-Tag: php-4.3.0dev-ZendEngine2-Preview1~1208 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7bf57c999cc70f785fa4e5aeec2b20e2746324e4;p=php - Support vpopmail 5.2 (fixes #16120). --- diff --git a/ext/vpopmail/config.m4 b/ext/vpopmail/config.m4 index 3e37bc4f61..fbfec2e3ca 100644 --- a/ext/vpopmail/config.m4 +++ b/ext/vpopmail/config.m4 @@ -22,20 +22,28 @@ if test "$PHP_VPOPMAIL" != "no"; then VPOPMAIL_LIB_DIR=$i/lib fi - if test -r $i/vadddomain; then + if test -x $i/vadddomain; then VPOPMAIL_BIN_DIR=$i - elif test -r $i/bin/vadddomain; then + elif test -x $i/bin/vadddomain; then VPOPMAIL_BIN_DIR=$i/bin fi done - for i in "$VPOPMAIL_INC_DIR/vpopmail.h" "$VPOPMAIL_INC_DIR/vpopmail_config.h" "$VPOPMAIL_LIB_DIR/libvpopmail.a" "$VPOPMAIL_BIN_DIR/vadddomain" "$VPOPMAIL_BIN_DIR/vaddaliasdomain" "$VPOPMAIL_BIN_DIR/vdeldomain" ; do + for i in "$VPOPMAIL_INC_DIR/vpopmail.h" "$VPOPMAIL_INC_DIR/vpopmail_config.h" "$VPOPMAIL_LIB_DIR/libvpopmail.a"; do if test ! -r "$i"; then AC_MSG_ERROR(Could not find '$i'. Please make sure you have vpopmail installed. Use ./configure --with-vpopmail= if necessary) fi done + for i in "$VPOPMAIL_BIN_DIR/vadddomain" "$VPOPMAIL_BIN_DIR/vaddaliasdomain" "$VPOPMAIL_BIN_DIR/vdeldomain" ; do + if test ! -x "$i"; then + AC_MSG_ERROR(Could not find '$i' or binary not executeable under current user. +Please make sure you have vpopmail properly installed. +Use ./configure --with-vpopmail= if necessary) + fi + done + AC_MSG_RESULT($VPOPMAIL_DIR) dnl newer versions of vpopmail have include/vauth.h defining valias functions @@ -57,5 +65,30 @@ if test "$PHP_VPOPMAIL" != "no"; then AC_DEFINE(HAVE_VPOPMAIL,1,[Whether you have vpopmail]) AC_DEFINE_UNQUOTED(VPOPMAIL_BIN_DIR,"$VPOPMAIL_BIN_DIR",[vpopmail bin path]) + dnl Detect if we have vpopmail >= 5.2 to accomodate C-API changes + dnl + dnl The current table is: + dnl + dnl PHP API VPOPMAIL VERSION + dnl 1 < 5.2 + dnl 2 >= 5.2 + vpopmail_internal_api=1 + version=`grep VERSION $VPOPMAIL_INC_DIR/vpopmail_config.h` + if test -n "$version"; then + version_major=`echo "$version" | sed 's/^[[^"]]\+"\([[0-9]]\+\)\.[[0-9]]\+"/\1/'`; + version_minor=`echo "$version" | sed 's/^[[^"]]\+"[[0-9]]\+\.\([[0-9]]\+\)"/\1/'` + if test $version_major -ge 5; then + if test $version_major -eq 5; then + if test $version_minor -ge 2; then + vpopmail_internal_api=2 + fi + fi + if test $version_major -gt 5; then + vpopmail_internal_api=2 + fi + fi + fi + AC_DEFINE_UNQUOTED(HAVE_VPOPMAIL_API,$vpopmail_internal_api,[Interal definition for vpopmail API changes]) + PHP_NEW_EXTENSION(vpopmail, php_vpopmail.c, $ext_shared) fi diff --git a/ext/vpopmail/php_vpopmail.c b/ext/vpopmail/php_vpopmail.c index 48deac8ba0..209593bfa8 100644 --- a/ext/vpopmail/php_vpopmail.c +++ b/ext/vpopmail/php_vpopmail.c @@ -285,7 +285,11 @@ PHP_FUNCTION(vpopmail_add_alias_domain) RETURN_FALSE; } +#if (!defined(HAVE_VPOPMAIL_API) || HAVE_VPOPMAIL_API == 1) if (add_domain_assign(Z_STRVAL_PP(aliasdomain), Dir, uid, gid) != 1) { +#else + if (add_domain_assign(Z_STRVAL_PP(aliasdomain), Z_STRVAL_PP(domain), Dir, uid, gid) != 1) { +#endif php_error(E_WARNING, "vpopmail_addaliasdomain could not add domain to control files"); VPOPMAILG(vpopmail_errno) = 1; RETURN_FALSE; @@ -922,7 +926,7 @@ PHP_FUNCTION(vpopmail_error) } /* }}} */ -#endif HAVE_VPOPMAIL +#endif /* HAVE_VPOPMAIL */ /* * Local variables: