No. qmailadmin "assumes" Megabytes and multiplies the entered
number in the field by 1048576 and puts the number in the .qmailadmin-limits
file or database. The maildir++ quotas read the number and do a
straight atol() on it (since the only thing thats supposed to
follow the number is the letter capital S).
>From the vpopmail README.quotas:
Old vpopmail style: 1000000 or 1MB or 1000KB
(1MB quota)
maildirquota style: 1000000S or 1000000S,1000C
(1MB quota, or 1MB Quota / 1000 Message Count limit, whichever comes first)
(BTW, this isn't *exactly* correct. This means 1000000 bytes,
not 1 MB, which is 1048576, so the correct entry would be 1048576S).
In some circumstances, the old style still works, but in many
areas it does not. The old style was removed from the functions
that read the .qmailadmin-limits file. The reason for this is
that the maildirquota.c functions also ignore/strip the 'MB' or 'KB'
when checking if a user is over quota, so the pw->pw_shell structure
needs to be in maildir++ quota format.
I don't know if vmoduser has been updated to change the
MB format into a number yet. I don't think so. To be safe, don't
use the 'MB' format.
Brian
> Just to clarify, this is only for storage in the database(s) right? An
> administrator (via qmailadmin or vmoduser, etc) can still enter a quota
> as 15M right? You might want to clarify that on the list so that
> others aren't confused, scared, etc.
>
> Matt
>
> On Monday, March 17, 2003, at 07:56 AM, Brian Kolaci wrote:
>
> > The abbreviations for Megabytes & Kilobytes "M", "m", "K" and "k"
> > have all been deprecated in the latest release of vpopmail
> > and qmailadmin. You should use all numbers now. The limits API
> > doesn't support this (and probably won't due to the database
> > holding numbers and not strings for these values).
> >
> > Read the vpopmail README.quotas file and you'll see the string format
> > for quotas and an explanation. Its along the lines ######S,####C
> > (size & count only, M & K for meg & kilo are gone now).
> >
> > Just use a number.
> >
> > Thanks,
> >
> > Brian
> >
> >> On Friday, March 14, 2003, at 11:52 AM, bob ketterhagen wrote:
> >>> I have my user quotas set to 10m.
> >>> <example>
> >>> /home/vpopmail/bin/vmoduser -q 10m [EMAIL PROTECTED]
> >>> /home/vpopmail/bin/vuserinfo [EMAIL PROTECTED]
> >>> quota: 10m
> >>> usage: 61%
> >>> </example>
> >>>
> >>> When I use vuserinfo to check a user, I see what I should see, a 10m
> >>> quota. When I log into qmailadmin It shows how much quota the user
> >>> has
> >>> used <example 6.19> but in the field that shows how many meg's their
> >>> quota is, I see 0.00 This is the same with all my vpopmail accounts.
> >>
> >> This patch for quota_to_megabytes in util.c checks to see if the quota
> >> is in megabytes instead of bytes. The patch also corrects an error in
> >> quota_to_bytes previously pointed out by [EMAIL PROTECTED] In
> >> addition to his fix, I use atof instead of atol, allowing for decimal
> >> quotas (e.g., 7.5 MB). I also looked into his switch from %lf to %f,
> >> and confirmed that %f is for double.
> >>
> >> It also adds some useful comments describing each function (at first,
> >> I
> >> was confused as to when each was used) and some formatting changes (to
> >> be more consistent with what I've seen in the source so far). Ken,
> >> please apply to the latest build.
> >>
> >> --- qmailadmin-1.0.12/util.c Fri Jan 24 15:25:31 2003
> >> +++ qmailadmin-1.0.12-tc/util.c Sun Mar 16 22:24:11 2003
> >> @@ -261,30 +261,39 @@
> >> if (size > 0) {
> >> size = size / 1048576; // Convert to MBs.
> >> }
> >> - sprintf(tmpbuff, "%-2.2lf", size);
> >> + sprintf(tmpbuff, "%.2f", size);
> >> tmpstr = tmpbuff;
> >> return tmpstr;
> >> }
> >> +/* quota_to_bytes: used to convert user entered quota (given in MB)
> >> + back to bytes for vpasswd file */
> >> int quota_to_bytes(char returnval[], char *quota) {
> >> char *tmpstr;
> >> double tmp;
> >>
> >> if (quota == NULL) { return 1; }
> >> - if (tmp = atol(quota)) { tmp *= 1048576; }
> >> + if (tmp = atof(quota)) {
> >> + tmp *= 1048576;
> >> + sprintf(returnval, "%.0f", tmp);
> >> + return 0;
> >> + }
> >> else { return 1; }
> >> - sprintf(returnval, "%-2.2lf", tmp);
> >> - return 0;
> >> }
> >> +/* quota_to_megabytes: used to convert vpasswd representation of
> >> quota
> >> + to number of megabytes. */
> >> int quota_to_megabytes(char returnval[], char *quota) {
> >> char *tmpstr;
> >> double tmp;
> >> + int i;
> >>
> >> if (quota == NULL) { return 1; }
> >> - if (tmp = atol(quota)) {
> >> - if (tmp != 0) { tmp /= 1048576.0; }
> >> - }
> >> - else { return 0; }
> >> - sprintf(returnval, "%-2.2lf", tmp);
> >> + i = strlen(quota);
> >> + if ((quota[i-1] == 'M') || (quota[i-1] == 'm')) {
> >> + tmp = atol(quota); /* already in megabytes */
> >> + } else if (tmp = atol(quota)) {
> >> + if (tmp != 0) { tmp /= 1048576.0; }
> >> + } else { return 0; }
> >> + sprintf(returnval, "%.2f", tmp);
> >> return 0;
> >> }
> >>
> >> --
> >> Tom Collins
> >> [EMAIL PROTECTED]
> >>
> >>
> >
> >
>