https://gitlab.synchro.net/main/sbbs/-/commit/0613136afdecf8aedac2bad2
Added Files:
exec/tests/user/mailbox_full/quota.js quota_child.inc
Modified Files:
docs/v322_new.md exec/load/userdefs.js src/sbbs3/getmail.c getmail.h js_system.cpp js_user.cpp mailsrvr.cpp sbbsdefs.h src/sbbs3/scfg/scfgmsg.c
Log Message:
Mailbox Quota counts the Inbox and refuses mail at the quota
Mailbox Quota (per user) (mailbox_quota in msgs.ini, default 1 GB) limited
only a user's private mail base: the folders, Sent copies and Trash kept
for WebMail. The Inbox, in the shared mail base, was not counted, so a
user with hundreds of megabytes of mail could read "63 KB of 1 GB", and
nothing stopped more mail arriving. The quota now means all of a user's
mail, and new mail for a user who has reached it is refused.
user_mailbox_full() (getmail.c), which the SMTP server, the terminal's
e-mail and forward commands, bulk mail and WebMail's send already call
for Maximum Messages Waiting, gains a second reason, MAILBOX_FULL_BYTES:
- Asked after the message count (which still answers MAILBOX_FULL_MSGS),
and only with a quota set. Full means used >= quota; the size of the
new message is not counted (it is not known at RCPT TO).
- Used = the private base + the mail waiting in the Inbox, spam included.
Inbox: one pass over the mail index, then one seek and one 256-byte
read of the header file per message to the user, summing header and
data blocks as the mailbox library does (data shared with other
recipients counts in full for each). The reads stop once the quota is
reached. Files attached to Inbox mail are not counted here. No running
total is kept anywhere.
- Private base: the "bytes" value of data/user/NNNN/mailbox.usage.ini,
which the mailbox library will write (only a plain number is
believed); without it the sizes of
mailbox.shd and mailbox.sdt (never less than the space in use, and
more after Trash was emptied); nothing when there is no base.
- A user with the W exemption is subject to neither limit, a system
sender is never refused, and with both limits at 0 the function
returns before reading anything, as before.
user_mailbox_bytes() returns the whole figure.
No caller's decision changes: all compare with MAILBOX_NOT_FULL. So the
byte reason is refused exactly where a full Inbox is: SMTP answers
"450 Mailbox full: <rcpt>" (or forwards without a local copy when the
user forwards and keeps copies) and logs the quota that was reached;
the terminal and bulk mail show the MailboxFull text; WebMail refuses
the send. FidoNet netmail, QWK network mail, mail from the system, a
script's own save_msg() and a restore from Trash are not checked. User.mailbox_full() returns 2 for the byte reason.
For sysops: a system that never used WebMail now refuses mail for a user
whose Inbox holds 1 GB (the default quota). With Maximum Messages
Waiting at 0, every delivery to a non-exempt user reads one header
block per message in that user's Inbox. The W exemption's description
becomes "not subject to mail storage limits"; the SCFG help of Mailbox
Quota and the release notes say what the quota covers.
Measured on a mail base of 9,262 index records and a 56 MB header file,
local disk, files cached, by a read-only program doing the same reads:
index pass 0.07 to 0.15 ms; headers 0.3 to 0.5 microseconds each (24
messages 0.01 ms, 919 messages 0.3 ms, 5,486 messages 1.9 to 2.7 ms).
Not measured through a network mount, where each header read is a round
trip to the file server.
Tested by script (exec/tests/user/mailbox_full/quota.js, a scratch configuration, user base and mail base per case): under, at and over the
quota; quota 0; the W exemption; a system sender; spam counted, a
deleted message not; each limit answering with its own reason, the count
first; the private figure from mailbox.usage.ini, from the file sizes
without it or without its key, and none without a base. The SMTP,
terminal e-mail, forward and bulk mail paths were read and compiled, not
run. Built with GCC only.
Co-Authored-By: Claude Fable 5.2 <
noreply@anthropic.com>