From f708e66b9453c9dfca0afae46e6f325ff15ffecf Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 24 Feb 2002 21:20:25 +0000 Subject: [PATCH] Added suuport for vpopmail --- ChangeLog | 11 +++++++++++ config.h.in | 3 +++ configure | 39 ++++++++++++++++++++++++++++----------- configure.in | 12 ++++++++++-- mbsebbs/mbuser.c | 10 ++++++++++ unix/mbpasswd.c | 12 ++++++++++++ unix/mbuseradd.c | 10 ++++++++++ 7 files changed, 84 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7dc40651..038e6caa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4594,6 +4594,8 @@ v0.33.20 10-Feb-2002 installed as user mbse. The location of the source isn't important anymore to install the maptabs. Updated German, Spanish and Galego languages. + The location of the sourcefiles is not important anymore. + Added detection of vpopmail in default installation path. common.a: Added 2 functions to return the OS name and CPU family. @@ -4665,3 +4667,12 @@ v0.33.20 10-Feb-2002 hatch: A new shellscript to hatch files in a tic area. + mbuseradd: + Added support for vpopmail, vadduser command. + + mbpasswd: + Added support for vpopmail, vpasswd command. + + mbuser: + Added support for vpopmail, vdeluser command. + diff --git a/config.h.in b/config.h.in index 668ec7b5..05dedfd3 100644 --- a/config.h.in +++ b/config.h.in @@ -105,6 +105,9 @@ /* Define to support /etc/login.access login access control. */ #undef LOGIN_ACCESS +/* Path to vpopmail. */ +#undef _VPOPMAIL_PATH + /* Path for wtmp file. */ #undef _WTMP_FILE diff --git a/configure b/configure index 0343c386..d745e65a 100755 --- a/configure +++ b/configure @@ -5501,6 +5501,23 @@ echo "${ECHO_T}$logdir" >&6 fi done +echo "$as_me:5504: checking location of vpopmail" >&5 +echo $ECHO_N "checking location of vpopmail... $ECHO_C" >&6 +for vpop in /var/qmail/vpopmail/bin NONE; do + if test "$vpop" = "NONE"; then + echo "$as_me:5508: result: not found" >&5 +echo "${ECHO_T}not found" >&6 + elif test -x $vpop/vadduser; then + cat >>confdefs.h <&5 +echo "${ECHO_T}$vpop" >&6 + break + fi +done + ac_config_files="$ac_config_files Makefile.global mbfido/paths.h unix/login.defs INSTALL FILE_ID.DIZ" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5581,7 +5598,7 @@ DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:5584: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:5601: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -5756,7 +5773,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:5759: error: ambiguous option: $1 + { { echo "$as_me:5776: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -5784,12 +5801,12 @@ Try \`$0 --help' for more information." >&2;} 'config.h' ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; # This is an error. - -*) { { echo "$as_me:5787: error: unrecognized option: $1 + -*) { { echo "$as_me:5804: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; - *) { { echo "$as_me:5792: error: invalid argument: $1" >&5 + *) { { echo "$as_me:5809: error: invalid argument: $1" >&5 echo "$as_me: error: invalid argument: $1" >&2;} { (exit 1); exit 1; }; };; esac @@ -6028,7 +6045,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:6031: creating $ac_file" >&5 + { echo "$as_me:6048: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -6046,7 +6063,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:6049: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:6066: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -6059,7 +6076,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:6062: error: cannot find input file: $f" >&5 + { { echo "$as_me:6079: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -6119,7 +6136,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:6122: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:6139: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -6130,7 +6147,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:6133: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:6150: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -6143,7 +6160,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:6146: error: cannot find input file: $f" >&5 + { { echo "$as_me:6163: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -6260,7 +6277,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:6263: $ac_file is unchanged" >&5 + { echo "$as_me:6280: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ diff --git a/configure.in b/configure.in index bd0e5dad..3a5b4d38 100644 --- a/configure.in +++ b/configure.in @@ -38,10 +38,8 @@ AC_CHECK_PROG(INSTALL, install, install) AC_PROG_MAKE_SET AC_PROG_RANLIB AC_PROG_YACC -dnl AC_PROG_LEX AC_CHECK_PROG(TAR, tar, tar) AC_CHECK_PROG(ZIP, zip, zip) -dnl AM_PROG_LEX AC_PATH_PROG(CHOWN, chown, chown, /bin:/sbin:/usr/bin:/usr/sbin:) CFLAGS="$CFLAGS -Wall -Wshadow -Wwrite-strings -Wstrict-prototypes" @@ -198,6 +196,16 @@ for logdir in /var/log /var/adm /usr/adm /etc; do fi done +AC_MSG_CHECKING(location of vpopmail) +for vpop in /var/qmail/vpopmail/bin NONE; do + if test "$vpop" = "NONE"; then + AC_MSG_RESULT(not found) + elif test -x $vpop/vadduser; then + AC_DEFINE_UNQUOTED(_VPOPMAIL_PATH, "$vpop") + AC_MSG_RESULT($vpop) + break + fi +done AC_OUTPUT( diff --git a/mbsebbs/mbuser.c b/mbsebbs/mbuser.c index 5de26b51..e1dde330 100644 --- a/mbsebbs/mbuser.c +++ b/mbsebbs/mbuser.c @@ -176,6 +176,9 @@ void UserPack(int days, int level, int pack) long oldsize, curpos; int updated, delete = 0, rc, highest = 0, record = 0, sysop = FALSE; time_t Last; +#ifdef _VPOPMAIL_PATH + char *cmd; +#endif fnin = calloc(PATH_MAX, sizeof(char)); fnout = calloc(PATH_MAX, sizeof(char)); @@ -321,6 +324,13 @@ void UserPack(int days, int level, int pack) #else rc = execute((char *)"/usr/sbin/pw userdel ", usr.Name, NULL, (char *)"/dev/null",(char *)"/dev/null",(char *)"/dev/null"); +#endif +#ifdef _VPOPMAIL_PATH + cmd = xstrcpy((char *)_VPOPMAIL_PATH); + cmd = xstrcat(cmd, (char *)"/vdeluser "); + rc = execute(cmd, usr.Name, NULL, + (char *)"/dev/null",(char *)"/dev/null",(char *)"/dev/null"); + free(cmd); #endif if (chdir(CFG.bbs_usersdir) == 0) rc = execute((char *)"/bin/rm -Rf ", usr.Name, NULL, diff --git a/unix/mbpasswd.c b/unix/mbpasswd.c index 7a9e3c9a..bf8eb1ec 100644 --- a/unix/mbpasswd.c +++ b/unix/mbpasswd.c @@ -732,6 +732,7 @@ int main(int argc, char *argv[]) int pfd, tfd; #endif char *cp; + char temp[128]; /* * Init $MBSE_ROOT/etc/login.defs file before the *pw gets overwritten. @@ -910,6 +911,17 @@ int main(int argc, char *argv[]) #endif /* __FreeBSD__ */ +#ifdef _VPOPMAIL_PATH + sprintf(temp, "%s/vpasswd %s %s", _VPOPMAIL_PATH, argv[2], argv[3]); + fflush(stdout); + fflush(stdin); + + if (system(temp) != 0) { + perror("mbpasswd: Failed to change vpopmail password\n"); + syslog(LOG_ERR, "Failed to change vpopmail password"); + } +#endif + syslog(LOG_NOTICE, "password for `%s' changed by user `%s'", name, myname); closelog(); exit(E_SUCCESS); diff --git a/unix/mbuseradd.c b/unix/mbuseradd.c index df984003..ad62525b 100644 --- a/unix/mbuseradd.c +++ b/unix/mbuseradd.c @@ -267,6 +267,16 @@ int main(int argc, char *argv[]) sprintf(temp, "%s/%s/Maildir/tmp", argv[4], argv[2]); makedir(temp, 0700, pwuser->pw_uid, pwent->pw_gid); +#ifdef _VPOPMAIL_PATH + sprintf(temp, "%s/vadduser %s %s", _VPOPMAIL_PATH, argv[2], argv[2]); + fflush(stdout); + fflush(stdin); + + if (system(temp) != 0) { + perror("mbuseradd: Failed to create vpopmail account\n"); + } +#endif + free(shell); free(PassEnt); free(temp);