A patch to fix the following issues (tx Ali Erturk TURKER): more info here: https://notes.sagredo.eu/en/qmail-notes-185/installing-and-configuring-vpopmail-81.html#comment2814 1- vdelivermail.c checks spamassassin permissions, instead of maildrop permissions. 2- vopen_smtp_relay() return values corrected, so that open_smtp_relay() can detect and report database connection errors (vmysql.c, voracle.pc, vpgsql.c ) 3- vdel_limits() core-dumps if a database connection is not available beforehand. (vmysql.c, voracle.pc ) diff -ruN vpopmail-5.4.33-original/vdelivermail.c vpopmail-5.4.33/vdelivermail.c --- vpopmail-5.4.33-original/vdelivermail.c 2011-02-28 19:00:45.000000000 +0200 +++ vpopmail-5.4.33/vdelivermail.c 2023-02-17 14:10:02.573403715 +0300 @@ -644,7 +644,7 @@ parse_email(maildir_to_email(address), TheUser, TheDomain, AUTH_SIZE); vpw=vauth_getpw(TheUser, TheDomain); } - if ( vpw!=NULL && (limits.disable_spamassassin==1 || + if ( vpw!=NULL && (limits.disable_maildrop==1 || (vpw->pw_gid & NO_MAILDROP)) ) { #endif if ( strncmp(quota, "NOQUOTA", 2) != 0 ) { diff -ruN vpopmail-5.4.33-original/vmysql.c vpopmail-5.4.33/vmysql.c --- vpopmail-5.4.33-original/vmysql.c 2023-02-17 14:09:09.872130173 +0300 +++ vpopmail-5.4.33/vmysql.c 2023-02-17 14:24:01.305747105 +0300 @@ -913,8 +913,8 @@ if ( ipaddr == NULL ) { return 0; } - - if ( (err=vauth_open_update()) != 0 ) return 0; + // open_smtp_relay() expects "-1" on database errors. "0" means duplicate record. (See vpopmail.c) + if ( (err=vauth_open_update()) != 0 ) return (-1); qnprintf( SqlBufUpdate, SQL_BUF_SIZE, "replace into relay ( ip_addr, timestamp ) values ( '%s', %d )", @@ -1863,6 +1863,11 @@ /************************************************************************/ int vdel_limits(const char *domain) { + int err; + + // CHECKS IF A DATABASE CONNECTION IS AVAILABLE, CONNECTS IF NOT. + // THIS CHECK PREVENTS "CORE-DUMP" OF vqadmin.cgi. + if ( (err=vauth_open_update()) != 0 ) return (err); qnprintf(SqlBufUpdate, SQL_BUF_SIZE, "DELETE FROM limits WHERE domain = '%s'", domain); if (mysql_query(&mysql_update,SqlBufUpdate)) diff -ruN vpopmail-5.4.33-original/voracle.pc vpopmail-5.4.33/voracle.pc --- vpopmail-5.4.33-original/voracle.pc 2011-02-28 19:00:45.000000000 +0200 +++ vpopmail-5.4.33/voracle.pc 2023-02-17 14:18:27.347078902 +0300 @@ -779,7 +779,8 @@ ++ipaddr; } - if ( (err=vauth_open_update()) != 0 ) return; + // open_smtp_relay() expects "-1" on database errors. "0" means duplicate record. (See vpopmail.c) + if ( (err=vauth_open_update()) != 0 ) return (-1); qnprintf( SqlBufUpdate, SQL_BUF_SIZE, "insert into relay ( ip_addr, timestamp ) values ( '%s', %d )", @@ -1442,6 +1443,11 @@ int vdel_limits( char *domain ) { + int err; + + // CHECKS IF A DATABASE CONNECTION IS AVAILABLE, CONNECTS IF NOT. + // THIS CHECK PREVENTS "CORE-DUMP" OF vqadmin.cgi. + if ( (err=vauth_open_update()) != 0 ) return(err); qnprintf( SqlBufUpdate, SQL_BUF_SIZE, "DELETE FROM limits WHERE domain = '%s'", domain); EXEC SQL PREPARE S FROM :SqlBufUpdate; diff -ruN vpopmail-5.4.33-original/vpgsql.c vpopmail-5.4.33/vpgsql.c --- vpopmail-5.4.33-original/vpgsql.c 2023-02-17 14:09:09.872130173 +0300 +++ vpopmail-5.4.33/vpgsql.c 2023-02-17 14:14:40.686873149 +0300 @@ -772,7 +772,8 @@ time_t delete_time; int err; - if ( (err=vauth_open(1)) != 0 ) return; + // open_smtp_relay() expects "-1" on database errors. "0" means duplicate record. (See vpopmail.c) + if ( (err=vauth_open(1)) != 0 ) return (-1); delete_time = mytime - clear_minutes; snprintf( SqlBufUpdate, SQL_BUF_SIZE,