ports/mail/vpopmail/files/patch-vpopmail.c
Bryan Drewery aa5812b1b0 - Update to 5.4.33
- Move auth options into its own single group
- Clarify PASSWD and VALIAS options

Changes: (* was already applied in our 5.4.32)
    Matt Brookings
  * - Defaulted to Server::Disable=True in vusagec.conf
  * - Fixed bug that didn't install vusagec.conf
    - Changed relevant quota code to use storage_t 64bit type
    - Fixed bug where backfill code wouldn't compile when FILE_LOCKING was
      enabled
    - Updated MySQL module to support larger quota sizes
    - Fixed typo
    - Added disable_maildrop flag to MySQL limits feature
    - More changes to allow for larger quota sizes in MySQL module

    Tullio Andreatta
    - Dynamic allocation of valias data
    - Use of open/fchdir rather than getcwd/chdir to maintain current working
      directory
    - Fixed a broken symbolic link check

    Drew Wells
    - Modification to vdelivermail to properly handle Maildir paths that begin with "./"

    <kenji@kens.fm>
    - Removed call to maildir_addquota inside user_over_maildirquota causing duplicate
      maildirsize entries
2014-04-11 00:51:02 +00:00

92 lines
2.9 KiB
C

Description: SpamAssassin support, sanity checks.
Implement SpamAssassin support.
Honor limits correctly.
Wait for the correct child process - waitpid() instead of wait().
Check for a couple more errors.
Add a closedir() to fix a file descriptor leak.
Forwarded: no
Author: Peter Pentchev <roam@FreeBSD.org>,
Alex Dupre <ale@FreeBSD.org>
Last-Update: 2009-11-26
--- vpopmail.c.orig 2011-02-28 11:00:45.000000000 -0600
+++ vpopmail.c 2014-04-10 11:20:59.892641589 -0500
@@ -981,6 +981,7 @@ int vdelfiles(char *dir)
/* print error message and return and error */
fprintf (stderr, "Failed to delete directory %s", mydirent->d_name);
+ closedir(mydir);
return(-1);
}
}
@@ -1603,7 +1604,7 @@ while(( s[i]==' ')||(s[i]=='\t')) {
i++;
}
-k = strlen(s) - i - 1;
+k = strlen(s) - i;
if( i>0 ) {
for( j=0; j<k; j++ ) {
@@ -1615,7 +1616,7 @@ if( i>0 ) {
// trim spaces and tabs from end
i = strlen(s) - 1;
-while(( s[i] == ' ' ) || ( s[i] == '\t' )) {
+while(i >= 0 && ( s[i] == ' ' || s[i] == '\t' )) {
i--;
}
@@ -2387,7 +2388,12 @@ char *make_user_dir(char *username, char
int call_dir;
char domain_dir[MAX_BUFF];
const char *dirnames[] = {"Maildir", "Maildir/new", "Maildir/cur",
- "Maildir/tmp"};
+ "Maildir/tmp",
+#ifdef SPAM_JUNKFOLDER
+ "Maildir/.Junk", "Maildir/.Junk/new", "Maildir/.Junk/cur",
+ "Maildir/.Junk/tmp",
+#endif
+ };
int i;
verrori = 0;
@@ -3154,6 +3160,13 @@ int vmake_maildir(char *domain, char *di
if (mkdir("cur",VPOPMAIL_DIR_MODE) == -1) { fchdir(call_dir); close(call_dir); return(-1); }
if (mkdir("new",VPOPMAIL_DIR_MODE) == -1) { fchdir(call_dir); close(call_dir); return(-1); }
if (mkdir("tmp",VPOPMAIL_DIR_MODE) == -1) { fchdir(call_dir); close(call_dir); return(-1); }
+#ifdef SPAM_JUNKFOLDER
+ if (mkdir(".Junk",VPOPMAIL_DIR_MODE) == -1) { fchdir(call_dir); close(call_dir); return(-1); }
+ if (chdir(".Junk") == -1) { fchdir(call_dir); close(call_dir); return(-1); }
+ if (mkdir("cur",VPOPMAIL_DIR_MODE) == -1) { fchdir(call_dir); close(call_dir); return(-1); }
+ if (mkdir("new",VPOPMAIL_DIR_MODE) == -1) { fchdir(call_dir); close(call_dir); return(-1); }
+ if (mkdir("tmp",VPOPMAIL_DIR_MODE) == -1) { fchdir(call_dir); close(call_dir); return(-1); }
+#endif
/* set permissions on the user's dir */
chdir(dir);
@@ -4220,12 +4233,20 @@ int call_onchange ( const char *cmd )
}
else if ( pid > 0 )
{
- wait(&rv);
- return(rv);
+ if (waitpid ( pid, &rv, 0 ) < 0 ||
+ !WIFEXITED( rv ) || WEXITSTATUS( rv ) != 0 ) {
+ fprintf(stderr,
+ "ONCHANGE script %s did not exit gracefully.\n",
+ path);
+ return(rv);
+ }
+ return(0);
}
- fprintf(stderr, "ONCHANGE script %s unable to fork.\n", path);
- return(0);
+ rv = errno;
+ fprintf(stderr, "ONCHANGE script %s unable to fork: %s\n", path,
+ strerror(rv));
+ return(rv);
}
#endif