Hi Ken/Bill,
It appears that the last patch I sent through didn't
get applied. This one contains the several extra
fields as requested. I'm currently working on
qmailadmin to use the API. Shall I also update
vdelivermail to enforce the per-domain quotas?
My copy does this with real disk usage rather than
maildir quotas, so I'm not sure how to do this
with the maildir quotas on a per-domain basis.
Thanks,
Brian
diff -c vpopmail-5.3.14/vlimits.c vpopmail-5.3.14.old/vlimits.c
*** vpopmail-5.3.14/vlimits.c Sat Dec 7 20:19:03 2002
--- vpopmail-5.3.14.old/vlimits.c Thu Jan 23 11:38:43 2003
***************
*** 38,52 ****
limits->maxforwards = -1;
limits->maxautoresponders = -1;
limits->maxmailinglists = -1;
- limits->diskquota = 0;
- limits->defaultquota = 0;
- limits->disable_pop = 0;
- limits->disable_imap = 0;
- limits->disable_dialup = 0;
- limits->disable_passwordchanging = 0;
- limits->disable_relay = 0;
- limits->disable_smtp = 0;
- limits->disable_webmail = 0;
/* get filename */
vget_assign(domain, dir, sizeof(dir), &uid, &gid);
--- 38,43 ----
***************
*** 54,139 ****
/* open file */
if ((fs = fopen(dir, "r")) != NULL) {
! while (fgets(buf, sizeof(buf), fs) != NULL) {
! if ((s1 = strtok(buf, TOKENS)) == NULL)
! continue;
! if (!strcmp(s1, "maxpopaccounts")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxpopaccounts = atoi(s2);
! }
! if (!strcmp(s1, "maxaliases")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxaliases = atoi(s2);
! }
! if (!strcmp(s1, "maxforwards")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxforwards = atoi(s2);
! }
! if (!strcmp(s1, "maxautoresponders")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxautoresponders = atoi(s2);
! }
! if (!strcmp(s1, "maxmailinglists")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxmailinglists = atoi(s2);
! }
! if (!strcmp(s1, "quota")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->diskquota = atoi(s2);
! }
! if (!strcmp(s1, "default_quota")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->defaultquota = format_maildirquota(s2);
! }
! if (!strcmp(s1, "disable_pop")) {
! limits->disable_pop = 1;
! }
! if (!strcmp(s1, "disable_imap")) {
! limits->disable_imap = 1;
! }
! if (!strcmp(s1, "disable_dialup")) {
! limits->disable_dialup = 1;
! }
! if (!strcmp(s1, "disable_password_changing")) {
! limits->disable_passwordchanging = 1;
! }
! if (!strcmp(s1, "disable_external_relay")) {
! limits->disable_relay = 1;
! }
! if (!strcmp(s1, "disable_smtp")) {
! limits->disable_smtp = 1;
! }
! if (!strcmp(s1, "disable_webmail")) {
! limits->disable_webmail = 1;
! }
! }
! fclose(fs);
! chown(dir,uid,gid);
! chmod(dir, S_IRUSR|S_IWUSR);
} else {
! fprintf(stderr, "vlimits: failed to open limits file (%d): %s\n", errno, dir);
! return -1;
}
return 0;
--- 45,190 ----
/* open file */
if ((fs = fopen(dir, "r")) != NULL) {
! while (fgets(buf, sizeof(buf), fs) != NULL) {
! if ((s1 = strtok(buf, TOKENS)) == NULL)
! continue;
! if (!strcmp(s1, "maxpopaccounts")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxpopaccounts = atoi(s2);
! }
! if (!strcmp(s1, "maxaliases")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxaliases = atoi(s2);
! }
! if (!strcmp(s1, "maxforwards")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxforwards = atoi(s2);
! }
! if (!strcmp(s1, "maxautoresponders")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxautoresponders = atoi(s2);
! }
! if (!strcmp(s1, "maxmailinglists")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxmailinglists = atoi(s2);
! }
! if (!strcmp(s1, "quota")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->diskquota = atoi(s2);
! }
! if (!strcmp(s1, "maxmsgcount")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->maxmsgcount = atoi(s2);
! }
! if (!strcmp(s1, "default_quota")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->defaultquota = atoi(s2);
! }
! if (!strcmp(s1, "default_maxmsgcount")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->defaultmaxmsgcount = atoi(s2);
! }
! if (!strcmp(s1, "disable_pop")) {
! limits->disable_pop = 1;
! }
! if (!strcmp(s1, "disable_imap")) {
! limits->disable_imap = 1;
! }
! if (!strcmp(s1, "disable_dialup")) {
! limits->disable_dialup = 1;
! }
! if (!strcmp(s1, "disable_password_changing")) {
! limits->disable_passwordchanging = 1;
! }
! if (!strcmp(s1, "disable_external_relay")) {
! limits->disable_relay = 1;
! }
!
! if (!strcmp(s1, "disable_smtp")) {
! limits->disable_smtp = 1;
! }
!
! if (!strcmp(s1, "disable_webmail")) {
! limits->disable_webmail = 1;
! }
!
! if (!strcmp(s1, "perm_account")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->perm_account = atoi(s2) & VLIMIT_DISABLE_ALL;
! }
!
! if (!strcmp(s1, "perm_alias")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->perm_alias = atoi(s2) & VLIMIT_DISABLE_ALL;
! }
!
! if (!strcmp(s1, "perm_forward")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->perm_forward = atoi(s2) & VLIMIT_DISABLE_ALL;
! }
!
! if (!strcmp(s1, "perm_autoresponder")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->perm_autoresponder = atoi(s2) & VLIMIT_DISABLE_ALL;
! }
!
! if (!strcmp(s1, "perm_maillist")) {
! unsigned long perm;
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! perm = atol(s2);
! 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;
! }
!
! if (!strcmp(s1, "perm_quota")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->perm_quota = atoi(s2) & VLIMIT_DISABLE_ALL;
! }
!
! if (!strcmp(s1, "perm_defaultquota")) {
! if ((s2 = strtok(buf, TOKENS)) == NULL)
! continue;
! limits->perm_defaultquota = atoi(s2) & VLIMIT_DISABLE_ALL;
! }
! }
! fclose(fs);
! chown(dir,uid,gid);
! chmod(dir, S_IRUSR|S_IWUSR);
} else {
! fprintf(stderr, "vlimits: failed to open limits file (%d): %s\n", errno,
dir);
! return -1;
}
return 0;
***************
*** 152,182 ****
/* open file */
if ((fs = fopen(dir, "w+")) != NULL) {
! fprintf(fs, "maxpopaccounts: %d\n", limits->maxpopaccounts);
! fprintf(fs, "maxaliases: %d\n", limits->maxaliases);
! fprintf(fs, "maxforwards: %d\n", limits->maxforwards);
! fprintf(fs, "maxautoresponders: %d\n", limits->maxautoresponders);
! fprintf(fs, "maxmailinglists: %d\n", limits->maxmailinglists);
! fprintf(fs, "quota: %d\n", limits->diskquota);
! fprintf(fs, "default_quota: %d\n", limits->defaultquota);
! if (limits->disable_pop)
! fprintf(fs, "disable_pop\n");
! if (limits->disable_imap)
! fprintf(fs, "disable_imap\n");
! if (limits->disable_dialup)
! fprintf(fs, "disable_dialup\n");
! if (limits->disable_passwordchanging)
! fprintf(fs, "disable_password_changing\n");
! if (limits->disable_webmail)
! fprintf(fs, "disable_webmail\n");
! if (limits->disable_relay)
! fprintf(fs, "disable_external_relay\n");
! if (limits->disable_smtp)
! fprintf(fs, "disable_smtp\n");
! fclose(fs);
} else {
! fprintf(stderr, "vlimits: failed to open limits file (%d): %s\n", errno, dir);
! return -1;
}
return 0;
--- 203,242 ----
/* open file */
if ((fs = fopen(dir, "w+")) != NULL) {
! fprintf(fs, "maxpopaccounts: %d\n", limits->maxpopaccounts);
! fprintf(fs, "maxaliases: %d\n", limits->maxaliases);
! fprintf(fs, "maxforwards: %d\n", limits->maxforwards);
! fprintf(fs, "maxautoresponders: %d\n", limits->maxautoresponders);
! fprintf(fs, "maxmailinglists: %d\n", limits->maxmailinglists);
! fprintf(fs, "quota: %d\n", limits->diskquota);
! fprintf(fs, "maxmsgcount: %d\n", limits->maxmsgcount);
! fprintf(fs, "default_quota: %d\n", limits->defaultquota);
! fprintf(fs, "default_maxmsgcount: %d\n", limits->defaultmaxmsgcount);
! if (limits->disablepop)
! fprintf(fs, "disable_pop\n");
! if (limits->disableimap)
! fprintf(fs, "disable_imap\n");
! if (limits->disabledialup)
! fprintf(fs, "disable_dialup\n");
! if (limits->disablepasswordchanging)
! fprintf(fs, "disable_password_changing\n");
! if (limits->disablewebmail)
! fprintf(fs, "disable_webmail\n");
! if (limits->disablerelay)
! fprintf(fs, "disable_external_relay\n");
! if (limits->disablesmtp)
! fprintf(fs, "disable_smtp\n");
! fprintf(fs, "perm_account: %d\n", limits->perm_account);
! fprintf(fs, "perm_alias: %d\n", limits->perm_alias);
! fprintf(fs, "perm_forward: %d\n", limits->perm_forward);
! fprintf(fs, "perm_autoresponder: %d\n", limits->perm_autoresponder);
! fprintf(fs, "perm_maillist: %ld\n", limits->perm_maillist);
! fprintf(fs, "perm_quota: %d\n",
(limits->perm_quota)|(limits->perm_maillist_users<<VLIMIT_DISABLE_BITS)|(limits->perm_maillist_moderators<<(VLIMIT_DISABLE_BITS*2)));
! fprintf(fs, "perm_defaultquota: %d\n", limits->perm_defaultquota);
! fclose(fs);
} else {
! fprintf(stderr, "vlimits: failed to open limits file (%d): %s\n", errno,
dir);
! return -1;
}
return 0;
***************
*** 195,198 ****
}
#endif
-
--- 255,257 ----
diff -c vpopmail-5.3.14/vlimits.h vpopmail-5.3.14.old/vlimits.h
*** vpopmail-5.3.14/vlimits.h Sat Dec 7 20:14:01 2002
--- vpopmail-5.3.14.old/vlimits.h Thu Jan 23 11:40:31 2003
***************
*** 7,12 ****
--- 7,13 ----
#ifndef VPOPMAIL_VLIMITS_H
#define VPOPMAIL_VLIMITS_H
+ /* permissions for non-postmaster admins */
#define VLIMIT_DISABLE_CREATE 0x01
#define VLIMIT_DISABLE_MODIFY 0x02
#define VLIMIT_DISABLE_DELETE 0x04
***************
*** 49,57 ****
short perm_defaultquota;
};
- int vget_limits(char * domain, struct vlimits * limits);
- int vset_limits(char * domain, struct vlimits * limits);
- int vdel_limits(char * domain);
-
#endif
--- 50,57 ----
short perm_defaultquota;
};
+ int vget_limits(const char * domain, struct vlimits * limits);
+ int vset_limits(const char * domain, const struct vlimits * limits);
+ int vdel_limits(const char * domain);
#endif
diff -c vpopmail-5.3.14/vmysql.c vpopmail-5.3.14.old/vmysql.c
*** vpopmail-5.3.14/vmysql.c Mon Nov 11 22:14:10 2002
--- vpopmail-5.3.14.old/vmysql.c Wed Jan 22 02:09:41 2003
***************
*** 29,35 ****
#include "vlimits.h"
#include "vmysql.h"
-
static MYSQL mysql_update;
static MYSQL mysql_read_getall;
--- 29,34 ----
***************
*** 223,229 ****
#ifndef MANY_DOMAINS
tmpstr = vauth_munch_domain( domain );
#else
! tmpstr = MYSQL_DEFAULT_TABLE;
#endif
snprintf(SqlBufUpdate,SQL_BUF_SIZE,
--- 222,228 ----
#ifndef MANY_DOMAINS
tmpstr = vauth_munch_domain( domain );
#else
! tmpstr = MYSQL_DEFAULT_TABLE;
#endif
snprintf(SqlBufUpdate,SQL_BUF_SIZE,
***************
*** 844,850 ****
}
if (!(res_read = mysql_store_result(&mysql_read))) {
! printf("vsql_getpw: store result failed 4\n");
return(-4);
}
while((row = mysql_fetch_row(res_read))) {
--- 843,849 ----
}
if (!(res_read = mysql_store_result(&mysql_read))) {
! printf("vget_ip_map: store result failed 4\n");
return(-4);
}
while((row = mysql_fetch_row(res_read))) {
***************
*** 868,874 ****
if (mysql_query(&mysql_update,SqlBufUpdate)) {
vcreate_ip_map_table();
if (mysql_query(&mysql_update,SqlBufUpdate)) {
- printf("vmysql: sql error[a]: %s\n", mysql_error(&mysql_update));
return(-1);
}
}
--- 867,872 ----
***************
*** 911,917 ****
res_read = NULL;
if (mysql_query(&mysql_read,SqlBufRead)) {
! vcreate_ip_map_table();
if (mysql_query(&mysql_read,SqlBufRead)) {
return(0);
}
--- 909,915 ----
res_read = NULL;
if (mysql_query(&mysql_read,SqlBufRead)) {
! vcreate_ip_map_table();
if (mysql_query(&mysql_read,SqlBufRead)) {
return(0);
}
***************
*** 1090,1100 ****
"delete from dir_control where domain = \"%s\"",
domain);
if (mysql_query(&mysql_update,SqlBufUpdate)) {
! vcreate_dir_control(domain);
! if (mysql_query(&mysql_update,SqlBufUpdate)) {
printf("vmysql: sql error[e]: %s\n", mysql_error(&mysql_update));
! return(-1);
! }
}
res_update = mysql_store_result(&mysql_update);
mysql_free_result(res_update);
--- 1088,1098 ----
"delete from dir_control where domain = \"%s\"",
domain);
if (mysql_query(&mysql_update,SqlBufUpdate)) {
! vcreate_dir_control(domain);
! if (mysql_query(&mysql_update,SqlBufUpdate)) {
printf("vmysql: sql error[e]: %s\n", mysql_error(&mysql_update));
! return(-1);
! }
}
res_update = mysql_store_result(&mysql_update);
mysql_free_result(res_update);
***************
*** 1399,1405 ****
#ifdef ENABLE_MYSQL_LIMITS
void vcreate_limits_table()
{
! if ( vauth_open_update() != 0 ) return;
snprintf( SqlBufCreate, SQL_BUF_SIZE, "CREATE TABLE limits ( %s )",
LIMITS_TABLE_LAYOUT);
--- 1397,1404 ----
#ifdef ENABLE_MYSQL_LIMITS
void vcreate_limits_table()
{
! if (vauth_open_update() != 0)
! return;
snprintf( SqlBufCreate, SQL_BUF_SIZE, "CREATE TABLE limits ( %s )",
LIMITS_TABLE_LAYOUT);
***************
*** 1411,1432 ****
mysql_free_result(res_update);
}
! int vget_limits( char *domain, struct vlimits *limits )
{
! int err;
! /* if we can not connect, set the verrori value */
! if ( (err=vauth_open_read()) != 0 ) {
! return(-1);
! }
!
! snprintf( SqlBufRead, SQL_BUF_SIZE, "SELECT maxpopaccounts, maxaliases, "
! "maxforwards, maxautoresponders, maxmailinglists, diskquota, "
! "defaultquota, disablepop, disableimap, disabledialup, "
! "disablepasswordchanging, disablewebmail, disablerelay \n"
"FROM limits \n"
! "WHERE domain = '%s'", domain);
if (mysql_query(&mysql_read,SqlBufRead)) {
vcreate_limits_table();
if (mysql_query(&mysql_read,SqlBufRead)) {
--- 1410,1431 ----
mysql_free_result(res_update);
}
! int vget_limits(const char *domain, struct vlimits *limits)
{
! if (vauth_open_read() != 0)
! return(-1);
! snprintf(SqlBufRead, SQL_BUF_SIZE, "SELECT maxpopaccounts, maxaliases, "
! "maxforwards, maxautoresponders, maxmailinglists, 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"
"FROM limits \n"
! "WHERE domain = '%s'", domain);
+
if (mysql_query(&mysql_read,SqlBufRead)) {
vcreate_limits_table();
if (mysql_query(&mysql_read,SqlBufRead)) {
***************
*** 1435,1463 ****
}
}
if (!(res_read = mysql_store_result(&mysql_read))) {
! fprintf(stderr, "vmysql: store result failed\n");
! return -1;
}
if (mysql_num_rows(res_read) == 0) {
! fprintf(stderr, "vnysql: can't find limits for domain '%s'\n", domain);
! return -1;
}
if ((row = mysql_fetch_row(res_read)) != NULL) {
! limits->maxpopaccounts = atoi(row[0]);
! limits->maxaliases = atoi(row[1]);
! limits->maxforwards = atoi(row[2]);
! limits->maxautoresponders = atoi(row[3]);
! limits->maxmailinglists = atoi(row[4]);
! limits->diskquota = atoi(row[5]);
! limits->defaultquota = atoi(row[6]);
! limits->disablepop = atoi(row[7]);
! limits->disableimap = atoi(row[8]);
! limits->disabledialup = atoi(row[9]);
! limits->disablepasswordchanging = atoi(row[10]);
! limits->disablewebmail = atoi(row[11]);
! limits->disablerelay = atoi(row[12]);
}
mysql_free_result(res_read);
--- 1434,1478 ----
}
}
if (!(res_read = mysql_store_result(&mysql_read))) {
! fprintf(stderr, "vmysql: store result failed\n");
! return -1;
}
if (mysql_num_rows(res_read) == 0) {
! fprintf(stderr, "vnysql: can't find limits for domain '%s'\n", domain);
! return -1;
}
if ((row = mysql_fetch_row(res_read)) != NULL) {
! int perm = atol(row[20]);
!
! limits->maxpopaccounts = atoi(row[0]);
! limits->maxaliases = atoi(row[1]);
! limits->maxforwards = atoi(row[2]);
! limits->maxautoresponders = atoi(row[3]);
! limits->maxmailinglists = atoi(row[4]);
! limits->diskquota = atoi(row[5]);
! limits->maxmsgcount = atoi(row[6]);
! limits->defaultquota = atoi(row[7]);
! limits->defaultmaxmsgcount = atoi(row[8]);
! limits->disable_pop = atoi(row[9]);
! limits->disable_imap = atoi(row[10]);
! limits->disable_dialup = atoi(row[11]);
! limits->disable_passwordchanging = atoi(row[12]);
! 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->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]);
}
mysql_free_result(res_read);
***************
*** 1464,1499 ****
return 0;
}
! int vdel_limits( char *domain )
{
! snprintf( SqlBufUpdate, SQL_BUF_SIZE, "DELETE FROM limits WHERE domain = \"%s\"",
! domain);
!
! if (mysql_query(&mysql_update,SqlBufUpdate)) {
return(-1);
- }
- res_update = mysql_store_result(&mysql_update);
- mysql_free_result(res_update);
- return 0;
- }
! int vset_limits( char *domain, struct vlimits *limits )
! {
! int err;
!
! /* if we can not connect, set the verrori value */
! if ( (err=vauth_open_update()) != 0 ) {
! return(-1);
! }
!
! snprintf( SqlBufUpdate, SQL_BUF_SIZE, "REPLACE INTO limits ( "
! "domain, maxpopaccounts, maxaliases, "
! "maxforwards, maxautoresponders, maxmailinglists, diskquota, "
! "defaultquota, disablepop, disableimap, disabledialup, "
! "disablepasswordchanging, disablewebmail, disablerelay ) \n"
"VALUES \n"
! "('%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
! domain,
limits->maxpopaccounts,
limits->maxaliases,
limits->maxforwards,
--- 1479,1500 ----
return 0;
}
! int vset_limits(const char *domain, const struct vlimits *limits)
{
! if (vauth_open_update() != 0)
return(-1);
! snprintf(SqlBufUpdate, SQL_BUF_SIZE, "REPLACE INTO limits ("
! "domain, maxpopaccounts, maxaliases, "
! "maxforwards, maxautoresponders, maxmailinglists, "
! "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"
"VALUES \n"
! "('%s', %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d, %d)",
! domain,
limits->maxpopaccounts,
limits->maxaliases,
limits->maxforwards,
***************
*** 1500,1512 ****
limits->maxautoresponders,
limits->maxmailinglists,
limits->diskquota,
limits->defaultquota,
! limits->disablepop,
! limits->disableimap,
! limits->disabledialup,
! limits->disablepasswordchanging,
! limits->disablewebmail,
! limits->disablerelay);
if (mysql_query(&mysql_update,SqlBufUpdate)) {
vcreate_limits_table();
--- 1501,1525 ----
limits->maxautoresponders,
limits->maxmailinglists,
limits->diskquota,
+ limits->maxmsgcount,
limits->defaultquota,
! limits->defaultmaxmsgcount,
! limits->disable_pop,
! limits->disable_imap,
! limits->disable_dialup,
! limits->disable_passwordchanging,
! limits->disable_webmail,
! limits->disable_relay,
! limits->disable_smtp,
! limits->perm_account,
! limits->perm_alias,
! limits->perm_forward,
! limits->perm_autoresponder,
! (limits->perm_maillist |
! (limits->perm_maillist_users << VLIMIT_DISABLE_BITS) |
! (limits->perm_maillist_moderators << (VLIMIT_DISABLE_BITS * 2))),
! limits->perm_quota,
! limits->perm_defaultquota);
if (mysql_query(&mysql_update,SqlBufUpdate)) {
vcreate_limits_table();
***************
*** 1516,1527 ****
}
}
if (!(res_update = mysql_store_result(&mysql_update))) {
! fprintf(stderr, "vmysql: store result failed\n");
! return -1;
}
mysql_free_result(res_update);
return 0;
}
#endif
--- 1529,1552 ----
}
}
if (!(res_update = mysql_store_result(&mysql_update))) {
! fprintf(stderr, "vmysql: store result failed\n");
! return -1;
}
mysql_free_result(res_update);
return 0;
}
+
+ int vdel_limits(const char *domain)
+ {
+ snprintf(SqlBufUpdate, SQL_BUF_SIZE, "DELETE FROM limits WHERE domain = \"%s\"",
+domain);
+
+ if (mysql_query(&mysql_update,SqlBufUpdate))
+ return(-1);
+ res_update = mysql_store_result(&mysql_update);
+ mysql_free_result(res_update);
+ return 0;
+ }
+
#endif
diff -c vpopmail-5.3.14/vmysql.h vpopmail-5.3.14.old/vmysql.h
*** vpopmail-5.3.14/vmysql.h Sat Dec 7 17:09:42 2002
--- vpopmail-5.3.14.old/vmysql.h Wed Jan 22 01:59:04 2003
***************
*** 252,269 ****
#ifdef ENABLE_MYSQL_LIMITS
#define LIMITS_TABLE_LAYOUT "domain CHAR(64) PRIMARY KEY, \
! maxpopaccounts INT(10) NOT NULL DEFAULT -1, \
! maxaliases INT(10) NOT NULL DEFAULT -1, \
! maxforwards INT(10) NOT NULL DEFAULT -1, \
! maxautoresponders INT(10) NOT NULL DEFAULT -1, \
! maxmailinglists INT(10) NOT NULL DEFAULT -1, \
! diskquota INT(12) NOT NULL DEFAULT 0, \
! defaultquota INT(12) NOT NULL DEFAULT 0, \
! disablepop TINYINT(1) NOT NULL DEFAULT 0, \
! disableimap TINYINT(1) NOT NULL DEFAULT 0, \
! disabledialup TINYINT(1) NOT NULL DEFAULT 0, \
! disablepasswordchanging TINYINT(1) NOT NULL DEFAULT 0, \
! disablewebmail TINYINT(1) NOT NULL DEFAULT 0, \
! disablerelay TINYINT(1) NOT NULL DEFAULT 0, \
! disablesmtp TINYINT(1) NOT NULL DEFAULT 0"
#endif
--- 261,288 ----
#ifdef ENABLE_MYSQL_LIMITS
#define LIMITS_TABLE_LAYOUT "domain CHAR(64) PRIMARY KEY, \
! maxpopaccounts INT(10) NOT NULL DEFAULT -1, \
! maxaliases INT(10) NOT NULL DEFAULT -1, \
! maxforwards INT(10) NOT NULL DEFAULT -1, \
! maxautoresponders INT(10) NOT NULL DEFAULT -1, \
! maxmailinglists INT(10) NOT NULL DEFAULT -1, \
! diskquota INT(12) NOT NULL DEFAULT 0, \
! maxmsgcount INT(12) NOT NULL DEFAULT 0, \
! defaultquota INT(12) NOT NULL DEFAULT 0, \
! defaultmaxmsgcount INT(12) NOT NULL DEFAULT 0, \
! disable_pop TINYINT(1) NOT NULL DEFAULT 0, \
! disable_imap TINYINT(1) NOT NULL DEFAULT 0, \
! disable_dialup TINYINT(1) NOT NULL DEFAULT 0, \
! disable_passwordchanging TINYINT(1) NOT NULL DEFAULT 0, \
! disable_webmail TINYINT(1) NOT NULL DEFAULT 0, \
! disable_relay TINYINT(1) NOT NULL DEFAULT 0, \
! disable_smtp 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, \
! perm_autoresponder TINYINT(2) NOT NULL DEFAULT 0, \
! perm_maillist TINYINT(4) NOT NULL DEFAULT 0, \
! perm_quota TINYINT(2) NOT NULL DEFAULT 0, \
! perm_defaultquota TINYINT(2) NOT NULL DEFAULT 0"
#endif