aboutsummaryrefslogtreecommitdiffstats
path: root/transact.c
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2006-08-07 10:23:24 +0000
committerMatthias Andree <matthias.andree@gmx.de>2006-08-07 10:23:24 +0000
commit8343a356bb4d2f91f135a1e52e0902f9f1100a3b (patch)
tree8293019375cd725c2f0edabcd1fbf7beea0e8e03 /transact.c
parentfbd1a3e930b0b37ddab226a06fb983c9753c0682 (diff)
downloadfetchmail-8343a356bb4d2f91f135a1e52e0902f9f1100a3b.tar.gz
fetchmail-8343a356bb4d2f91f135a1e52e0902f9f1100a3b.tar.bz2
fetchmail-8343a356bb4d2f91f135a1e52e0902f9f1100a3b.zip
Support user@example.org (full-address) mappings for multidrop
on the left-hand side of mappings. svn path=/branches/BRANCH_6-3/; revision=4885
Diffstat (limited to 'transact.c')
-rw-r--r--transact.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/transact.c b/transact.c
index f29fa5b9..88a5aacf 100644
--- a/transact.c
+++ b/transact.c
@@ -55,18 +55,33 @@ int mytimeout; /* value of nonreponse timeout */
struct msgblk msgblk;
static int accept_count, reject_count;
+/** add given address to xmit_names if it exactly matches a full address
+ * \returns nonzero if matched */
+static int map_address(const char *addr, struct query *ctl, struct idlist **xmit_names)
+{
+ const char *lname;
+
+ lname = idpair_find(&ctl->localnames, addr);
+ if (lname) {
+ if (outlevel >= O_DEBUG)
+ report(stdout, GT_("mapped address %s to local %s\n"), addr, lname);
+ save_str(xmit_names, lname, XMIT_ACCEPT);
+ accept_count++;
+ }
+ return lname != NULL;
+}
+
+/** add given name to xmit_names if it matches declared localnames */
static void map_name(const char *name, struct query *ctl, struct idlist **xmit_names)
-/* add given name to xmit_names if it matches declared localnames */
/* name: name to map */
/* ctl: list of permissible aliases */
/* xmit_names: list of recipient names parsed out */
{
const char *lname;
- int off = 0;
-
- lname = idpair_find(&ctl->localnames, name+off);
+
+ lname = idpair_find(&ctl->localnames, name);
if (!lname && ctl->wildcard)
- lname = name+off;
+ lname = name;
if (lname != (char *)NULL)
{
@@ -119,6 +134,11 @@ static void find_server_names(const char *hdr,
if ((atsign = strchr((char *)cp, '@'))) {
struct idlist *idp;
+ /* try to match full address first, this takes
+ * precedence over localdomains and alias mappings */
+ if (map_address(cp, ctl, xmit_names))
+ goto nomap;
+
/*
* Does a trailing segment of the hostname match something
* on the localdomains list? If so, save the whole name