summaryrefslogtreecommitdiffstats
path: root/usr.sbin/smtpd/lka_session.c
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2014-04-30 09:17:29 +0000
committergilles <gilles@openbsd.org>2014-04-30 09:17:29 +0000
commit99bdd714228213b62a859456b53c064554caf865 (patch)
treecd6e49f92fac64bbab07f871f3917f82ec7c6250 /usr.sbin/smtpd/lka_session.c
parentThe RSA engine (used by pony) has to wait for a response from the (diff)
downloadwireguard-openbsd-99bdd714228213b62a859456b53c064554caf865.tar.xz
wireguard-openbsd-99bdd714228213b62a859456b53c064554caf865.zip
when using maildir, do not create automatically create folders to match tag
in email address (ie: gilles+tag => ~/Maildir/.tag), instead use the folder if it already exists and deliver to the mail Maildir otherwise. ok eric@ and chl@
Diffstat (limited to 'usr.sbin/smtpd/lka_session.c')
-rw-r--r--usr.sbin/smtpd/lka_session.c50
1 files changed, 2 insertions, 48 deletions
diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c
index 8b738685100..d3ab19e01ba 100644
--- a/usr.sbin/smtpd/lka_session.c
+++ b/usr.sbin/smtpd/lka_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka_session.c,v 1.66 2014/04/19 12:55:23 gilles Exp $ */
+/* $OpenBSD: lka_session.c,v 1.67 2014/04/30 09:17:29 gilles Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
@@ -40,8 +40,6 @@
#include "smtpd.h"
#include "log.h"
-#define TAG_CHAR '+' /* gilles+tag@ */
-
#define EXPAND_DEPTH 10
#define F_WAITING 0x01
@@ -70,7 +68,6 @@ static void lka_resume(struct lka_session *);
static size_t lka_expand_format(char *, size_t, const struct envelope *,
const struct userinfo *);
static void mailaddr_to_username(const struct mailaddr *, char *, size_t);
-static int mailaddr_tag(const struct mailaddr *, char *, size_t);
static int mod_lowercase(char *, size_t);
static int mod_uppercase(char *, size_t);
@@ -85,8 +82,6 @@ struct modifiers {
{ "strip", mod_strip },
{ "raw", NULL }, /* special case, must stay last */
};
-static const char *unsafe = MAILADDR_ESCAPE;
-
static int init;
static struct tree sessions;
@@ -479,7 +474,6 @@ lka_submit(struct lka_session *lks, struct rule *rule, struct expandnode *xn)
struct envelope *ep;
struct expandnode *xn2;
int r;
- char tag[EXPAND_BUFFER];
ep = xmemdup(&lks->envelope, sizeof *ep, "lka_submit");
ep->expire = rule->r_qexpire;
@@ -548,24 +542,6 @@ lka_submit(struct lka_session *lks, struct rule *rule, struct expandnode *xn)
ep->agent.mda.method = rule->r_action;
(void)strlcpy(ep->agent.mda.buffer, rule->r_value.buffer,
sizeof ep->agent.mda.buffer);
-
- memset(tag, 0, sizeof tag);
- if (! mailaddr_tag(&ep->dest, tag, sizeof tag)) {
- lks->error = LKA_PERMFAIL;
- free(ep);
- return;
- }
- if (rule->r_action == A_MAILDIR && tag[0]) {
- (void)strlcat(ep->agent.mda.buffer, "/.",
- sizeof(ep->agent.mda.buffer));
- if (strlcat(ep->agent.mda.buffer, tag,
- sizeof(ep->agent.mda.buffer))
- >= sizeof(ep->agent.mda.buffer)) {
- lks->error = LKA_TEMPFAIL;
- free(ep);
- return;
- }
- }
}
else
fatalx("lka_deliver: bad node type");
@@ -712,7 +688,7 @@ lka_expand_token(char *dest, size_t len, const char *token,
if (! raw && replace)
for (i = 0; (size_t)i < strlen(tmp); ++i)
- if (strchr(unsafe, tmp[i]))
+ if (strchr(MAILADDR_ESCAPE, tmp[i]))
tmp[i] = ':';
/* expanded string is empty */
@@ -849,28 +825,6 @@ mailaddr_to_username(const struct mailaddr *maddr, char *dst, size_t len)
*tag++ = '\0';
}
-static int
-mailaddr_tag(const struct mailaddr *maddr, char *dest, size_t len)
-{
- char *tag;
- char *sanitized;
-
- if ((tag = strchr(maddr->user, TAG_CHAR))) {
- tag++;
- while (*tag == '.')
- tag++;
- }
- if (tag == NULL)
- return 1;
-
- if (strlcpy(dest, tag, len) >= len)
- return 0;
- for (sanitized = dest; *sanitized; sanitized++)
- if (strchr(unsafe, *sanitized))
- *sanitized = ':';
- return 1;
-}
-
static int
mod_lowercase(char *buf, size_t len)
{