diff -u qmailadmin-1.0.10/util.c qmailadmin-1.0.10-pooled2/util.c --- qmailadmin-1.0.10/util.cFri Jan 24 23:25:31 2003 +++ qmailadmin-1.0.10-pooled2/util.c Tue Feb 18 18:37:55 2003 @@ -272,7 +272,10 @@ if (quota == NULL) { return 1; } if (tmp = atol(quota)) { tmp *= 1048576; } else { return 1; } - sprintf(returnval, "%-2.2lf", tmp); + if (tmp < 0) { return 0; } + sprintf(returnval, "%-2.0lf", tmp); return 0; }
This should make an automatic auto-correction when quota is less than zero.
Tonino
At 04/03/03 04/03/03 +0100, tonix (Antonio Nati) wrote:
Hi Rick,
it's a small bug in the quota patch of last "official" qmailadmin versions(I did not suppose Inter7 integrate patches without trying them, but that happens sometimes).
diff -u qmailadmin-1.0.10/util.c qmailadmin-1.0.10-pooled2/util.c --- qmailadmin-1.0.10/util.cFri Jan 24 23:25:31 2003 +++ qmailadmin-1.0.10-pooled2/util.c Tue Feb 18 18:37:55 2003 @@ -272,7 +272,10 @@ if (quota == NULL) { return 1; } if (tmp = atol(quota)) { tmp *= 1048576; } else { return 1; } - sprintf(returnval, "%-2.2lf", tmp); + sprintf(returnval, "%-2.0lf", tmp); return 0; }
This should solve it.
Tonino
At 03/03/03 03/03/03 -0600, Rick Romero wrote:On Mon, 2003-03-03 at 09:52, Rick Romero wrote:
> I wanted to mention that when using qmailadmin-1.12 and vpopmail-5.3.18,
> if I set the quota from qmailadmin to 100MB, the quota is set to
> 100483292.00 (I'm just guessing on the bytes, but you get the idea).
>
> For some reason, I belive the .00 makes vdelivermail bounce email saying
> the user is over quota. Using vsetuserquota to set the actual # of
> bytes works fine though.
Ok, so here's the code in vpopmail.c (right at the end):
char *format_maildirquota(const char *q) {
int i;
int per_user_limit;
static char tempquota[500];
/* translate the quota to a number, or leave it */
i = strlen(q) - 1;
tempquota[0] = '\0'; /* make sure tempquota is 0 length */
if(strstr(q, ",") == NULL && q[i] != 'S') {
per_user_limit = atol(q);
for(i=0;q[i]!=0;++i) {
if ( q[i] == 'k' || q[i] == 'K' ) {
per_user_limit = per_user_limit * 1024;
snprintf(tempquota, 500, "%dS", per_user_limit);
break;
}
if ( q[i] == 'm' || q[i] == 'M' ) {
per_user_limit = per_user_limit * 1048576;
sprintf(tempquota, "%dS", per_user_limit);
break;
}
}
Maybe this isn't the problem... but if per_user_int is initialized as an
int, should atol be atoi?
Though, supposedly atol() should stop 'converting' at the period
anyways.. Maybe it's crashing?
> Rick
>
------------------------------------------------------------
[EMAIL PROTECTED] Interazioni di Antonio Nati
http://www.interazioni.it [EMAIL PROTECTED]
------------------------------------------------------------
------------------------------------------------------------
[EMAIL PROTECTED] Interazioni di Antonio Nati
http://www.interazioni.it [EMAIL PROTECTED]
------------------------------------------------------------
