Add authenticated domain/mailbox/alias/password admin console
Port 1027 used to be an unauthenticated console (see ServerCore's ConsoleServer/ConsoleSession fix) that also exposed the raw SMTP command set (AUTH/DATA/EHLO/EXPN/HELO/...) to anyone who could reach it. It's now started only when barantmail.cfg has a real "admin" section configured (BARANTMailConfig::hasAdmin/getAdminPort/ getAdminUser/getAdminPassword), matching the same optional-listener pattern already used for smtpTLS/imap/pop3, and registers four real commands instead of the SMTP command table: domain add|remove|list mailbox add|remove|list alias add|remove|list password reset MailFileSystem gained the actual domain/mailbox/alias/password CRUD these commands call (createDomain/removeDomain/listDomains, createMailbox/removeMailbox/listMailboxes, createAlias/removeAlias/ listAliases, setPassword), matching its existing on-disk layout: a domain is a directory, a mailbox is a directory with Inbox/Spam/Trash and a .password file, an alias is a plain file listing target mailboxes one per line. getAliasMailboxes() was previously an unconditional stub that always returned empty (confirmed via grep to have zero callers anywhere), so an alias could be "created" but could never actually receive mail. It's now wired for real: SMTPServer::inCreate() checks ifAliasExists()/getAliasMailboxes() during local delivery and copies the same spam-scanned message to every target mailbox (extracted into a new deliverToMailbox() helper so the alias and single-mailbox delivery paths share it).
This commit is contained in:
1 parent
cd5e0a9905
commit
e8b2a79907
17 files changed
+667
-12
No files matched your search
@@ -40,6 +40,33 @@ namespace mail {
|
||||
coreutils::MString getFolderPath(coreutils::ZString &mailbox, std::string folder);
|
||||
bool ifFolderExists(coreutils::ZString &mailbox, std::string folder);
|
||||
|
||||
// Domain/mailbox/alias maintenance for the admin console (see
|
||||
// __ADMIN_DOMAIN/__ADMIN_MAILBOX/__ADMIN_ALIAS) - a domain is
|
||||
// just a directory directly under mailPath; a mailbox is a
|
||||
// directory under that with Inbox/Spam/Trash and a .password
|
||||
// file (matching checkPassword()'s own expectations exactly);
|
||||
// an alias is a plain FILE at that same level (matching
|
||||
// ifAliasExists()'s own S_ISREG check) listing its target
|
||||
// mailboxes one per line. Each returns false and fills `error`
|
||||
// with a human-readable reason on failure, rather than throwing -
|
||||
// the console commands calling these want to report a clean
|
||||
// failure line to the operator, not crash the whole server on a
|
||||
// typo'd domain name.
|
||||
|
||||
bool createDomain(coreutils::ZString &domain, std::string &error);
|
||||
bool removeDomain(coreutils::ZString &domain, std::string &error);
|
||||
std::vector<coreutils::MString> listDomains();
|
||||
|
||||
bool createMailbox(coreutils::ZString &mailbox, coreutils::ZString &password, std::string &error);
|
||||
bool removeMailbox(coreutils::ZString &mailbox, std::string &error);
|
||||
std::vector<coreutils::MString> listMailboxes(coreutils::ZString &domain);
|
||||
|
||||
bool createAlias(coreutils::ZString &alias, coreutils::ZString &targets, std::string &error);
|
||||
bool removeAlias(coreutils::ZString &alias, std::string &error);
|
||||
std::vector<coreutils::MString> listAliases(coreutils::ZString &domain);
|
||||
|
||||
bool setPassword(coreutils::ZString &mailbox, coreutils::ZString &newPassword, std::string &error);
|
||||
|
||||
private:
|
||||
coreutils::ZString &mailPath;
|
||||
coreutils::MString queuePath;
|
||||
|
||||
Reference in new issue
Block a user