Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lmtpd service does not respect user_deny.db #1700

Open
brong opened this issue Jul 9, 2014 · 8 comments
Open

lmtpd service does not respect user_deny.db #1700

brong opened this issue Jul 9, 2014 · 8 comments
Assignees
Labels
enhancement feature request, not a bug LMTP P3

Comments

@brong
Copy link
Member

brong commented Jul 9, 2014

From: Deniss Gaplevsky
Bugzilla-Id: 3856
Version: 2.4.17
Owner: Bron Gondwana

@brong
Copy link
Member Author

brong commented Jul 9, 2014

From: Deniss Gaplevsky

lmtpd network service should respect user_deny.db to bounce new incoming messages with 4xx code back to an queue for the users listed.
lmtpd should works as imapd,pop3d here to allow complete freeze mailbox from updates for maintenance.

@brong
Copy link
Member Author

brong commented Oct 21, 2014

From: Ken Murchison

Fixed in master. Will be in 2.5

@brong
Copy link
Member Author

brong commented Oct 28, 2014

From: Deniss Gaplevsky

please backport it to stable branch

@brong
Copy link
Member Author

brong commented Oct 28, 2014

From: Ken Murchison

Committed to cyrus-imapd-2.4

@brong
Copy link
Member Author

brong commented Nov 18, 2014

From: Leena Heino

This patch seems to break delivery to shared mailboxes when postuser in imapd.conf is set to its default empty value.

If one tries to sent email to shared mailbox then lmtpd just silently closes the connection. No errors are seen in the lmtpd output nor are any errors logged to the logs. The connection is just silently closed and messages will remain undelivered in the mail queue.

@brong
Copy link
Member Author

brong commented Aug 26, 2015

From: Deniss Gaplevsky

the patch does not convert cyrus internal mailbox name into external format (ie ^ => . in username part) before matching user_deny entries.
So imap and others search for "some.user" while lmtpd looks for "some^user"

@brong
Copy link
Member Author

brong commented Mar 4, 2016

From: Deniss Gaplevsky

following patch fix the issue with lmtpd.

--- lmtpd.c     2015-07-06 06:38:29.000000000 +0300
+++ lmtpd.c     2016-03-04 14:50:02.000000000 +0200
@@ -1068,7 +1070,9 @@
            user = namebuf;
        }
 
-       if (userdeny(user, config_ident, msg, sizeof(msg)))
+       (*lmtpd_namespace.mboxname_toexternal)(&lmtpd_namespace, user, user, namebuf);
+
+       if (userdeny(namebuf, config_ident, msg, sizeof(msg)))
            return IMAP_MAILBOX_DISABLED;
     }

Indeed other services (imap/pop) do improper user_deny.db checking against internal username every time but at login

Mar 4 14:59:27 lv-test-2 imap[7799]: fetching user_deny.db entry for 'slim.test'
Mar 4 14:59:27 lv-test-2 imap[7799]: fetching user_deny.db entry for 'slim^test'
Mar 4 14:59:27 lv-test-2 imap[7799]: fetching user_deny.db entry for 'slim^test'

@brong
Copy link
Member Author

brong commented Mar 4, 2016

From: Deniss Gaplevsky

(In reply to comment 6)

correct patch that works with domains is:

--- imap/lmtpd.c        2015-07-06 06:38:29.000000000 +0300
+++ imap/lmtpd.c        2016-03-04 16:11:28.000000000 +0200
@@ -1062,6 +1064,10 @@
 
     if (!r && user) {
        char msg[MAX_MAILBOX_PATH+1];
+       char namebufext[MAX_MAILBOX_BUFFER] = "";
+
+       (*lmtpd_namespace.mboxname_toexternal)(&lmtpd_namespace, user, user, namebufext);
+       if (namebufext) { user = namebufext; }
 
        if (domain) {
            snprintf(namebuf, sizeof(namebuf), "%s@%s", user, domain);

@brong brong added LMTP P3 enhancement feature request, not a bug labels Dec 13, 2016
@brong brong self-assigned this Dec 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request, not a bug LMTP P3
Projects
None yet
Development

No branches or pull requests

1 participant