]> granicus.if.org Git - php/commitdiff
- MFH fix for #16120 (this also MFHs the proto fix by Sebastion which
authorMarkus Fischer <mfischer@php.net>
Wed, 20 Mar 2002 07:53:27 +0000 (07:53 +0000)
committerMarkus Fischer <mfischer@php.net>
Wed, 20 Mar 2002 07:53:27 +0000 (07:53 +0000)
  I hope is ok).

ext/vpopmail/config.m4
ext/vpopmail/php_vpopmail.c

index b4324959288435da7336782bd51437730fbd58dc..fbfec2e3cae95ba3f70af72015d25780e6795429 100644 (file)
@@ -7,7 +7,7 @@ PHP_ARG_WITH(vpopmail, for vpopmail support,
 
 if test "$PHP_VPOPMAIL" != "no"; then
        AC_MSG_CHECKING(for vpopmail install directory)
-       for i in ~vpopmail /home/vpopmail /home/popmail /var/qmail/vpopmail /var/qmail/popmail $PHP_VPOPMAIL; do
+       for i in /usr/include/vpopmail /usr/include /usr ~vpopmail /home/vpopmail /home/popmail /var/qmail/vpopmail /var/qmail/popmail $PHP_VPOPMAIL; do
                if test -r $i/vpopmail.h; then
                        VPOPMAIL_INC_DIR=$i
                        VPOPMAIL_DIR=$i
@@ -22,18 +22,25 @@ 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)
+                       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
 
@@ -58,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])
 
-       PHP_EXTENSION(vpopmail, $ext_shared)
+       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 d38acde5919dae3ee66b5231f59674cb4010d721..209593bfa84935837f75636cef91e411b82a7b19 100644 (file)
@@ -174,7 +174,7 @@ PHP_MINFO_FUNCTION(vpopmail)
  */
 
 /* {{{ proto bool vpopmail_add_domain(string domain, string dir, int uid, int gid)
-   Add a new virtual domain */
+   Adds a new virtual domain */
 PHP_FUNCTION(vpopmail_add_domain)
 {
        zval **domain;
@@ -215,7 +215,7 @@ PHP_FUNCTION(vpopmail_add_domain)
 /* }}} */
 
 /* {{{ proto bool vpopmail_del_domain(string domain)
-   Delete a virtual domain */
+   Deletes a virtual domain */
 PHP_FUNCTION(vpopmail_del_domain)
 {
        zval **domain;
@@ -242,7 +242,7 @@ PHP_FUNCTION(vpopmail_del_domain)
 /* }}} */
 
 /* {{{ proto bool vpopmail_add_alias_domain(string domain, string aliasdomain)
-   Add an alias for a virtual domain */
+   Adds an alias for a virtual domain */
 PHP_FUNCTION(vpopmail_add_alias_domain)
 {
        zval **domain;
@@ -285,7 +285,11 @@ PHP_FUNCTION(vpopmail_add_alias_domain)
                RETURN_FALSE;
        }
 
-       if (add_domain_assign(Z_STRVAL_PP(aliasdomain), Dir, uid, gid) != 0) {
+#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;
@@ -303,7 +307,7 @@ PHP_FUNCTION(vpopmail_add_alias_domain)
  */
 
 /* {{{ proto bool vpopmail_add_domain_ex(string domain, string passwd [, string quota [, string bounce [, bool apop]]])
-   Add a new virtual domain */
+   Adds a new virtual domain */
 PHP_FUNCTION(vpopmail_add_domain_ex)
 {
        zval **domain, **passwd, **quota, **bounce, **apop;
@@ -428,7 +432,7 @@ PHP_FUNCTION(vpopmail_add_domain_ex)
 /* }}} */
 
 /* {{{ proto bool vpopmail_del_domain_ex(string domain)
-   Delete a virtual domain */
+   Deletes a virtual domain */
 PHP_FUNCTION(vpopmail_del_domain_ex)
 {
        zval **domain;
@@ -471,7 +475,7 @@ PHP_FUNCTION(vpopmail_del_domain_ex)
 /* }}} */
 
 /* {{{ proto bool vpopmail_add_alias_domain_ex(string olddomain, string newdomain)
-   Add alias to an existing virtual domain */
+   Adds an alias to an existing virtual domain */
 PHP_FUNCTION(vpopmail_add_alias_domain_ex)
 {
        zval **olddomain, **newdomain;
@@ -528,7 +532,7 @@ PHP_FUNCTION(vpopmail_add_alias_domain_ex)
  */
 
 /* {{{ proto bool vpopmail_add_user(string user, string domain, string password[, string gecos[, bool apop]])
-   Add a new user to the specified virtual domain */
+   Adds a new user to the specified virtual domain */
 PHP_FUNCTION(vpopmail_add_user)
 {
        zval **user;
@@ -581,7 +585,7 @@ PHP_FUNCTION(vpopmail_add_user)
 /* }}} */
 
 /* {{{ proto bool vpopmail_del_user(string user, string domain)
-   Delete a user from a virtual domain */
+   Deletes a user from a virtual domain */
 PHP_FUNCTION(vpopmail_del_user)
 {
        zval **user;
@@ -612,7 +616,7 @@ PHP_FUNCTION(vpopmail_del_user)
 /* }}} */
 
 /* {{{ proto bool vpopmail_passwd(string user, string domain, string password)
-   Change a virtual user's password */
+   Changes user's password */
 PHP_FUNCTION(vpopmail_passwd)
 {
        zval **user;
@@ -654,7 +658,7 @@ PHP_FUNCTION(vpopmail_passwd)
 /* }}} */
 
 /* {{{ proto bool vpopmail_set_user_quota(string user, string domain, string quota)
-   Sets a virtual user's quota */
+   Sets user's quota */
 PHP_FUNCTION(vpopmail_set_user_quota)
 {
        zval **user;
@@ -688,7 +692,7 @@ PHP_FUNCTION(vpopmail_set_user_quota)
 /* }}} */
 
 /* {{{ proto bool vpopmail_auth_user(string user, string domain, string password[, string apop])
-   Attempt to validate a username/domain/password. Returns true/false */
+   Attempts to validate a username/domain/password. Returns true/false */
 PHP_FUNCTION(vpopmail_auth_user)
 {
        zval **user;
@@ -740,7 +744,7 @@ PHP_FUNCTION(vpopmail_auth_user)
 
 
 /* {{{ proto bool vpopmail_alias_add(string user, string domain, string alias)
-   insert a virtual alias */
+   Inserts a virtual alias */
 PHP_FUNCTION(vpopmail_alias_add)
 {
        zval **user;
@@ -774,7 +778,7 @@ PHP_FUNCTION(vpopmail_alias_add)
 /* }}} */
 
 /* {{{ proto bool vpopmail_alias_del(string user, string domain)
-   deletes all virtual aliases of a user */
+   Deletes all virtual aliases of a given user */
 PHP_FUNCTION(vpopmail_alias_del)
 {
        zval **user;
@@ -805,7 +809,7 @@ PHP_FUNCTION(vpopmail_alias_del)
 
 #ifdef VALIAS
 /* {{{ proto bool vpopmail_alias_del_domain(string domain)
-   deletes all virtual aliases of a domain */
+   Deletes all virtual aliases of a given domain */
 PHP_FUNCTION(vpopmail_alias_del_domain)
 {
        zval **domain;
@@ -834,7 +838,7 @@ PHP_FUNCTION(vpopmail_alias_del_domain)
 #endif
 
 /* {{{ proto array vpopmail_alias_get(string alias, string domain)
-   get all lines of an alias for a domain */
+   Returns all lines of an alias for a given domain */
 PHP_FUNCTION(vpopmail_alias_get)
 {
        zval **alias;
@@ -865,7 +869,7 @@ PHP_FUNCTION(vpopmail_alias_get)
 /* }}} */
 
 /* {{{ proto array vpopmail_alias_get_all(string domain)
-   get all alias lines for all users in a domain */
+   Returns all lines of all aliases for a given domain */
 PHP_FUNCTION(vpopmail_alias_get_all)
 {
        zval **domain;
@@ -912,7 +916,7 @@ PHP_FUNCTION(vpopmail_alias_get_all)
  */
 
 /* {{{ proto string vpopmail_error(void)
-   Get text message for last vpopmail error. Returns string */
+   Returns text message for last vpopmail error */
 PHP_FUNCTION(vpopmail_error)
 {
        if (ZEND_NUM_ARGS() != 0)
@@ -922,7 +926,7 @@ PHP_FUNCTION(vpopmail_error)
 }
 /* }}} */
 
-#endif HAVE_VPOPMAIL
+#endif /* HAVE_VPOPMAIL */
 
 /*
  * Local variables: