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
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
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
*/
/* {{{ 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;
/* }}} */
/* {{{ proto bool vpopmail_del_domain(string domain)
- Delete a virtual domain */
+ Deletes a virtual domain */
PHP_FUNCTION(vpopmail_del_domain)
{
zval **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;
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;
*/
/* {{{ 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;
/* }}} */
/* {{{ proto bool vpopmail_del_domain_ex(string domain)
- Delete a virtual domain */
+ Deletes a virtual domain */
PHP_FUNCTION(vpopmail_del_domain_ex)
{
zval **domain;
/* }}} */
/* {{{ 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;
*/
/* {{{ 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;
/* }}} */
/* {{{ 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;
/* }}} */
/* {{{ 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;
/* }}} */
/* {{{ 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;
/* }}} */
/* {{{ 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;
/* {{{ 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;
/* }}} */
/* {{{ 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;
#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;
#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;
/* }}} */
/* {{{ 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;
*/
/* {{{ 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)
}
/* }}} */
-#endif HAVE_VPOPMAIL
+#endif /* HAVE_VPOPMAIL */
/*
* Local variables: