OK, I went through and updated the MySQL, PgSQL and Oracle header files to
provide 96-char field sizes for domain, and I updated the mysql limits
pieces to account for the new fields.  I haven't created anything yet as
far as actually updating the SQL database structure of an existing setup,
but that should be easy (change field size, add a couple columns to 1
table).  Here's the patch.

Josh

> OK, here's another one.  I've got a couple of patches (previously posted
> here) that I use and in the process of applying them I noticed a couple
> things that concern me:
>
> 1) The MAX_PW_DOMAIN has increased from 64 to 96, but there's no
> corresponding increase in the field size in vmysql.h (and presumably the
> other backends where size matters).  Isn't this going to cause problems
> when 96 character domain names are shoved into 64 character database
> fields?
> 2) Similarly, the vlimits structure now has disable_spamassassin and
> delete_spam fields, but no corresponding field was added to the limits
> table in vmysql.h.  In fact, these fields appear to be completely
> unaddressed in the mysql backend, so that at best they will be ignored if
> used, and at worst they may actually break something.  Is this
> intentional, or just an oversight?
>
> I'm willing to try and contribute to the solution, just let me know what
> (if anything) you need.  I will, however, be offline almost all weekend,
> so it'll probably be Monday before I produce anything unless I can hack it
> out quickly this afternoon...
>
> Josh
> --
> Joshua Megerman
> SJGames MIB #5273 - OGRE AI Testing Division
> You can't win; You can't break even; You can't even quit the game.
>   - Layman's translation of the Laws of Thermodynamics
> [EMAIL PROTECTED]
>
>
>


-- 
Joshua Megerman
SJGames MIB #5273 - OGRE AI Testing Division
You can't win; You can't break even; You can't even quit the game.
  - Layman's translation of the Laws of Thermodynamics
diff -urN ../clean/vpopmail-5.4.15/vmysql.c vpopmail-5.4.15/vmysql.c
--- ../clean/vpopmail-5.4.15/vmysql.c	2006-02-24 02:27:31.000000000 -0500
+++ vpopmail-5.4.15/vmysql.c	2006-02-24 14:18:42.000000000 -0500
@@ -1537,8 +1537,9 @@
         "maxmsgcount, defaultquota, defaultmaxmsgcount, "
         "disable_pop, disable_imap, disable_dialup, "
         "disable_passwordchanging, disable_webmail, disable_relay, "
-        "disable_smtp, perm_account, perm_alias, perm_forward, "
-        "perm_autoresponder, perm_maillist, perm_quota, perm_defaultquota \n"
+        "disable_smtp, disable_spamassassin, delete_spam, perm_account, "
+        "perm_alias, perm_forward, perm_autoresponder, perm_maillist, "
+        "perm_quota, perm_defaultquota \n"
         "FROM limits \n"
         "WHERE domain = '%s'", domain);
 
@@ -1563,7 +1564,7 @@
         return vlimits_read_limits_file (VLIMITS_DEFAULT_FILE, limits);
 
     } else if ((row = mysql_fetch_row(res_read)) != NULL) {
-        int perm = atol(row[20]);
+        int perm = atol(row[22]);
 
         limits->maxpopaccounts = atoi(row[0]);
         limits->maxaliases = atoi(row[1]);
@@ -1581,17 +1582,19 @@
         limits->disable_webmail = atoi(row[13]);
         limits->disable_relay = atoi(row[14]);
         limits->disable_smtp = atoi(row[15]);
-        limits->perm_account = atoi(row[16]);
-        limits->perm_alias = atoi(row[17]);
-        limits->perm_forward = atoi(row[18]);
-        limits->perm_autoresponder = atoi(row[19]);
+        limits->disable_spamassassin = atoi(row[16]);
+        limits->delete_spam = atoi(row[17]);
+        limits->perm_account = atoi(row[18]);
+        limits->perm_alias = atoi(row[19]);
+        limits->perm_forward = atoi(row[20]);
+        limits->perm_autoresponder = atoi(row[21]);
         limits->perm_maillist = perm & VLIMIT_DISABLE_ALL;
         perm >>= VLIMIT_DISABLE_BITS;
         limits->perm_maillist_users = perm & VLIMIT_DISABLE_ALL;
         perm >>= VLIMIT_DISABLE_BITS;
         limits->perm_maillist_moderators = perm & VLIMIT_DISABLE_ALL;
-        limits->perm_quota = atoi(row[21]);
-        limits->perm_defaultquota = atoi(row[22]);
+        limits->perm_quota = atoi(row[23]);
+        limits->perm_defaultquota = atoi(row[24]);
     }
     mysql_free_result(res_read);
 
@@ -1609,10 +1612,11 @@
         "diskquota, maxmsgcount, defaultquota, defaultmaxmsgcount, "
         "disable_pop, disable_imap, disable_dialup, "
         "disable_passwordchanging, disable_webmail, disable_relay, "
-        "disable_smtp, perm_account, perm_alias, perm_forward, "
-        "perm_autoresponder, perm_maillist, perm_quota, perm_defaultquota) \n"
+        "disable_smtp, disable_spamassassin, delete_spam, perm_account, "
+        "perm_alias, perm_forward, perm_autoresponder, perm_maillist, "
+        "perm_quota, perm_defaultquota) \n"
         "VALUES \n"
-        "('%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
+        "('%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
         domain,
         limits->maxpopaccounts,
         limits->maxaliases,
@@ -1630,6 +1634,8 @@
         limits->disable_webmail,
         limits->disable_relay,
         limits->disable_smtp,
+        limits->disable_spamassassin,
+        limits->delete_spam,
         limits->perm_account,
         limits->perm_alias,
         limits->perm_forward,
diff -urN ../clean/vpopmail-5.4.15/vmysql.h vpopmail-5.4.15/vmysql.h
--- ../clean/vpopmail-5.4.15/vmysql.h	2004-12-16 10:57:35.000000000 -0500
+++ vpopmail-5.4.15/vmysql.h	2006-02-24 14:15:14.000000000 -0500
@@ -62,7 +62,7 @@
 #ifdef MANY_DOMAINS
 #ifdef CLEAR_PASS
 #define TABLE_LAYOUT "pw_name char(32) not null, \
-pw_domain char(64) not NULL, \
+pw_domain char(96) not NULL, \
 pw_passwd char(40), \
 pw_uid int, pw_gid int, \
 pw_gecos char(48), \
@@ -72,7 +72,7 @@
 primary key (pw_name, pw_domain ) "
 #else
 #define TABLE_LAYOUT "pw_name char(32) not null, \
-pw_domain char(64) not null, \
+pw_domain char(96) not null, \
 pw_passwd char(40), \
 pw_uid int, pw_gid int, \
 pw_gecos char(48), \
@@ -106,7 +106,7 @@
 
 #define LASTAUTH_TABLE_LAYOUT \
 "user char(32) NOT NULL, \
-domain char(64) NOT NULL,\
+domain char(96) NOT NULL,\
 remote_ip char(18) not null,  \
 timestamp bigint default 0 NOT NULL, \
 primary key (user, domain)"
@@ -239,10 +239,10 @@
 #endif
 
 #ifdef IP_ALIAS_DOMAINS
-#define IP_ALIAS_TABLE_LAYOUT "ip_addr char(18) not null, domain char(64),  primary key(ip_addr)"
+#define IP_ALIAS_TABLE_LAYOUT "ip_addr char(18) not null, domain char(96),  primary key(ip_addr)"
 #endif
 
-#define DIR_CONTROL_TABLE_LAYOUT "domain char(64) not null, cur_users int, \
+#define DIR_CONTROL_TABLE_LAYOUT "domain char(96) not null, cur_users int, \
 level_cur int, level_max int, \
 level_start0 int, level_start1 int, level_start2 int, \
 level_end0 int, level_end1 int, level_end2 int, \
@@ -258,7 +258,7 @@
 level_index0, level_index1, level_index2, the_dir"
 
 #define VALIAS_TABLE_LAYOUT "alias char(32) not null, \
-domain char(64) not null, \
+domain char(96) not null, \
 valias_line text not null, index (alias, domain)"
 
 #endif
@@ -266,7 +266,7 @@
 #ifdef ENABLE_SQL_LOGGING
 #define VLOG_TABLE_LAYOUT "id BIGINT PRIMARY KEY AUTO_INCREMENT, \
       user char(32), passwd CHAR(32), \
-      domain CHAR(64), logon VARCHAR(200), \
+      domain CHAR(96), logon VARCHAR(200), \
       remoteip char(18), message VARCHAR(255), \
       timestamp bigint default 0 NOT NULL, error INT, \
       INDEX user_idx (user), \
@@ -275,7 +275,7 @@
 #endif
 
 #ifdef ENABLE_MYSQL_LIMITS
-#define LIMITS_TABLE_LAYOUT "domain CHAR(64) PRIMARY KEY, \
+#define LIMITS_TABLE_LAYOUT "domain CHAR(96) PRIMARY KEY, \
       maxpopaccounts           INT(10) NOT NULL DEFAULT -1, \
       maxaliases               INT(10) NOT NULL DEFAULT -1, \
       maxforwards              INT(10) NOT NULL DEFAULT -1, \
@@ -292,6 +292,8 @@
       disable_webmail          TINYINT(1) NOT NULL DEFAULT 0, \
       disable_relay            TINYINT(1) NOT NULL DEFAULT 0, \
       disable_smtp             TINYINT(1) NOT NULL DEFAULT 0, \
+      disable_spamassassin     TINYINT(1) NOT NULL DEFAULT 0, \
+      delete_spam              TINYINT(1) NOT NULL DEFAULT 0, \
       perm_account             TINYINT(2) NOT NULL DEFAULT 0, \
       perm_alias               TINYINT(2) NOT NULL DEFAULT 0, \
       perm_forward             TINYINT(2) NOT NULL DEFAULT 0, \
diff -urN ../clean/vpopmail-5.4.15/voracle.h vpopmail-5.4.15/voracle.h
--- ../clean/vpopmail-5.4.15/voracle.h	2004-12-16 10:57:35.000000000 -0500
+++ vpopmail-5.4.15/voracle.h	2006-02-24 14:15:24.000000000 -0500
@@ -35,7 +35,7 @@
 #ifdef MANY_DOMAINS
 #ifdef CLEAR_PASS
 #define TABLE_LAYOUT "pw_name char(32) not null, \
-pw_domain char(64) not NULL, \
+pw_domain char(96) not NULL, \
 pw_passwd char(40), \
 pw_uid int, pw_gid int, \
 pw_gecos char(48), \
@@ -45,7 +45,7 @@
 primary key (pw_name, pw_domain ) "
 #else
 #define TABLE_LAYOUT "pw_name char(32) not null, \
-pw_domain char(64) not null, \
+pw_domain char(96) not null, \
 pw_passwd char(40), \
 pw_uid int, pw_gid int, \
 pw_gecos char(48), \
@@ -79,7 +79,7 @@
 
 #define LASTAUTH_TABLE_LAYOUT \
 "pw_user char(32) NOT NULL, \
-pw_domain char(64) NOT NULL,\
+pw_domain char(96) NOT NULL,\
 remote_ip char(18) not null,  \
 timestamp int default 0 NOT NULL, \
 primary key (pw_user, pw_domain)"
@@ -212,10 +212,10 @@
 #endif
 
 #ifdef IP_ALIAS_DOMAINS
-#define IP_ALIAS_TABLE_LAYOUT "ip_addr char(18) not null, domain char(64),  primary key(ip_addr)"
+#define IP_ALIAS_TABLE_LAYOUT "ip_addr char(18) not null, domain char(96),  primary key(ip_addr)"
 #endif
 
-#define DIR_CONTROL_TABLE_LAYOUT "domain char(64) not null, cur_users int, \
+#define DIR_CONTROL_TABLE_LAYOUT "domain char(96) not null, cur_users int, \
 level_cur int, level_max int, \
 level_start0 int, level_start1 int, level_start2 int, \
 level_end0 int, level_end1 int, level_end2 int, \
@@ -231,7 +231,7 @@
 level_index0, level_index1, level_index2, the_dir"
 
 #define VALIAS_TABLE_LAYOUT "alias char(32) not null, \
-domain char(64) not null, \
+domain char(96) not null, \
 valias_line varchar(255) not null "
 
 #endif
@@ -239,7 +239,7 @@
 #ifdef ENABLE_SQL_LOGGING
 #define VLOG_TABLE_LAYOUT "id BIGINT PRIMARY KEY AUTO_INCREMENT, \
       user char(32), passwd CHAR(32), \
-      domain CHAR(64), logon VARCHAR(200), \
+      domain CHAR(96), logon VARCHAR(200), \
       remoteip char(18), message VARCHAR(255), \
       timestamp int default 0 NOT NULL, error INT, \
       INDEX user_idx (user), \
@@ -248,7 +248,7 @@
 #endif
 
 #ifdef ENABLE_ORACLE_LIMITS
-#define LIMITS_TABLE_LAYOUT "domain CHAR(64) PRIMARY KEY, \
+#define LIMITS_TABLE_LAYOUT "domain CHAR(96) PRIMARY KEY, \
       maxpopaccounts          INT(10) NOT NULL DEFAULT -1, \
       maxaliases              INT(10) NOT NULL DEFAULT -1, \
       maxforwards             INT(10) NOT NULL DEFAULT -1, \
diff -urN ../clean/vpopmail-5.4.15/vpgsql.h vpopmail-5.4.15/vpgsql.h
--- ../clean/vpopmail-5.4.15/vpgsql.h	2004-12-16 10:57:34.000000000 -0500
+++ vpopmail-5.4.15/vpgsql.h	2006-02-24 14:14:41.000000000 -0500
@@ -34,7 +34,7 @@
 #ifdef MANY_DOMAINS
 #ifdef CLEAR_PASS
 #define TABLE_LAYOUT "pw_name varchar(32) NOT NULL, \
-pw_domain varchar(64) NOT NULL, \
+pw_domain varchar(96) NOT NULL, \
 pw_passwd varchar(40), \
 pw_uid int4, pw_gid int4, \
 pw_gecos varchar(48), \
@@ -44,7 +44,7 @@
 PRIMARY KEY(\"pw_domain\", \"pw_name\")"
 #else
 #define TABLE_LAYOUT "pw_name varchar(32) NOT NULL, \
-pw_domain varchar(64) NOT NULL, \
+pw_domain varchar(96) NOT NULL, \
 pw_passwd varchar(40), \
 pw_uid int4, pw_gid int4, \
 pw_gecos varchar(48), \
@@ -78,7 +78,7 @@
 
 #define LASTAUTH_TABLE_LAYOUT \
 "userid varchar(32) NOT NULL, \
-domain varchar(64) NOT NULL,\
+domain varchar(96) NOT NULL,\
 remote_ip varchar(18) NOT NULL,  \
 timestamp bigint default 0 NOT NULL, \
 PRIMARY key (userid, domain)"
@@ -200,10 +200,10 @@
 #endif
 
 #ifdef IP_ALIAS_DOMAINS
-#define IP_ALIAS_TABLE_LAYOUT "ip_addr varchar(18) NOT NULL, domain varchar(64), PRIMARY KEY (ip_addr)"
+#define IP_ALIAS_TABLE_LAYOUT "ip_addr varchar(18) NOT NULL, domain varchar(96), PRIMARY KEY (ip_addr)"
 #endif
 
-#define DIR_CONTROL_TABLE_LAYOUT "domain varchar(64) NOT NULL, cur_users int4, \
+#define DIR_CONTROL_TABLE_LAYOUT "domain varchar(96) NOT NULL, cur_users int4, \
 level_cur int4, level_max int4, \
 level_start0 int4, level_start1 int4, level_start2 int4, \
 level_end0 int4, level_end1 int4, level_end2 int4, \
@@ -219,7 +219,7 @@
 level_index0, level_index1, level_index2, the_dir"
 
 #define VALIAS_TABLE_LAYOUT "alias varchar(32) NOT NULL, \
-domain varchar(64) NOT NULL, \
+domain varchar(96) NOT NULL, \
 valias_line varchar(160) NOT NULL"
 #define VALIAS_INDEX_LAYOUT "(alias, domain)"
 #endif
@@ -227,7 +227,7 @@
 #ifdef ENABLE_SQL_LOGGING
 #define VLOG_TABLE_LAYOUT "id serial, \
       userid char(32), passwd CHAR(32), \
-      domain CHAR(64), logon VARCHAR(200), \
+      domain CHAR(96), logon VARCHAR(200), \
       remoteip char(18), message VARCHAR(255), \
       timestamp bigint default 0 NOT NULL, error INT, \
       INDEX user_idx (user), \

Reply via email to