cvs: php4(PHP_4_2_0) /ext/vpopmail config.m4 php_vpopmail.c
| From: | Markus Fischer | Date: | Wed, 20 Mar 2002 07:53:26 +0000 |
| Subject: | cvs: php4(PHP_4_2_0) /ext/vpopmail config.m4 php_vpopmail.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-10462@lists.php.net to get a copy of this message | ||
mfischer Wed Mar 20 02:53:26 2002 EDT
Modified files: (Branch: PHP_4_2_0)
/php4/ext/vpopmail config.m4 php_vpopmail.c
Log:
- MFH fix for #16120 (this also MFHs the proto fix by Sebastion which
I hope is ok).
Index: php4/ext/vpopmail/config.m4 diff -u php4/ext/vpopmail/config.m4:1.9 php4/ext/vpopmail/config.m4:1.9.2.1 --- php4/ext/vpopmail/config.m4:1.9 Fri Nov 30 14:00:01 2001 +++ php4/ext/vpopmail/config.m4 Wed Mar 20 02:53:26 2002 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.9 2001/11/30 19:00:01 sniper Exp $ +dnl $Id: config.m4,v 1.9.2.1 2002/03/20 07:53:26 mfischer Exp $ dnl PHP_ARG_WITH(vpopmail, for vpopmail support, @@ -7,7 +7,7 @@ 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 @@ 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 @@ 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: php4/ext/vpopmail/php_vpopmail.c diff -u php4/ext/vpopmail/php_vpopmail.c:1.24 php4/ext/vpopmail/php_vpopmail.c:1.24.2.1 --- php4/ext/vpopmail/php_vpopmail.c:1.24 Thu Feb 28 03:26:53 2002 +++ php4/ext/vpopmail/php_vpopmail.c Wed Mar 20 02:53:26 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_vpopmail.c,v 1.24 2002/02/28 08:26:53 sebastian Exp $ */ +/* $Id: php_vpopmail.c,v 1.24.2.1 2002/03/20 07:53:26 mfischer Exp $ */ /* TODO: move to config.m4 when support for old versions is ready or just * don't support rather old vpopmail. current version must bail out if @@ -174,7 +174,7 @@ */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ 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 @@ */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ #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 @@ #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 @@ /* }}} */ /* {{{ 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 @@ */ /* {{{ 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 @@ } /* }}} */ -#endif HAVE_VPOPMAIL +#endif /* HAVE_VPOPMAIL */ /* * Local variables:
Index: php4/ext/vpopmail/config.m4 diff -u php4/ext/vpopmail/config.m4:1.9 php4/ext/vpopmail/config.m4:1.9.2.1 --- php4/ext/vpopmail/config.m4:1.9 Fri Nov 30 14:00:01 2001 +++ php4/ext/vpopmail/config.m4 Wed Mar 20 02:53:26 2002 @@ -1,5 +1,5 @@ dnl -dnl $Id: config.m4,v 1.9 2001/11/30 19:00:01 sniper Exp $ +dnl $Id: config.m4,v 1.9.2.1 2002/03/20 07:53:26 mfischer Exp $ dnl PHP_ARG_WITH(vpopmail, for vpopmail support, @@ -7,7 +7,7 @@ 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 @@ 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 @@ 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: php4/ext/vpopmail/php_vpopmail.c diff -u php4/ext/vpopmail/php_vpopmail.c:1.24 php4/ext/vpopmail/php_vpopmail.c:1.24.2.1 --- php4/ext/vpopmail/php_vpopmail.c:1.24 Thu Feb 28 03:26:53 2002 +++ php4/ext/vpopmail/php_vpopmail.c Wed Mar 20 02:53:26 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_vpopmail.c,v 1.24 2002/02/28 08:26:53 sebastian Exp $ */ +/* $Id: php_vpopmail.c,v 1.24.2.1 2002/03/20 07:53:26 mfischer Exp $ */ /* TODO: move to config.m4 when support for old versions is ready or just * don't support rather old vpopmail. current version must bail out if @@ -174,7 +174,7 @@ */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ 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 @@ */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ /* {{{ 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 @@ /* }}} */ /* {{{ 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 @@ #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 @@ #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 @@ /* }}} */ /* {{{ 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 @@ */ /* {{{ 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 @@ } /* }}} */ -#endif HAVE_VPOPMAIL +#endif /* HAVE_VPOPMAIL */ /* * Local variables: