]> granicus.if.org Git - php/commitdiff
- Support vpopmail 5.2 (fixes #16120).
authorMarkus Fischer <mfischer@php.net>
Tue, 19 Mar 2002 22:47:37 +0000 (22:47 +0000)
committerMarkus Fischer <mfischer@php.net>
Tue, 19 Mar 2002 22:47:37 +0000 (22:47 +0000)
ext/vpopmail/config.m4
ext/vpopmail/php_vpopmail.c

index 3e37bc4f61157824a150151c55821d1adb4063cc..fbfec2e3cae95ba3f70af72015d25780e6795429 100644 (file)
@@ -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=<vpopmail-home-dir> 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=<vpopmail-home-dir> 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
index 48deac8ba0b0582c366ffe855c0dc6925b86360b..209593bfa84935837f75636cef91e411b82a7b19 100644 (file)
@@ -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: