From 6a78d6670fa2e84b29dabd0d7f9c10d4f6a2d51c Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Mon, 9 Jan 2017 00:00:00 -0500 Subject: [PATCH] postfix-3.2-20170109-nonprod --- postfix/HISTORY | 7 ++++++ postfix/WISHLIST | 6 ++++- postfix/src/cleanup/cleanup_addr.c | 10 ++++---- postfix/src/cleanup/cleanup_map11.c | 6 ++--- postfix/src/global/mail_addr_crunch.c | 12 +++++----- postfix/src/global/mail_addr_crunch.h | 17 +++++++------ postfix/src/global/mail_addr_find.c | 27 +++++++++++---------- postfix/src/global/mail_addr_find.h | 9 +++---- postfix/src/global/mail_addr_map.c | 29 ++++++++++++----------- postfix/src/global/mail_addr_map.h | 4 ++-- postfix/src/global/mail_addr_map_tester.c | 8 +++---- postfix/src/global/mail_version.h | 2 +- postfix/src/global/split_addr.c | 3 +++ postfix/src/global/split_addr.h | 4 ++++ postfix/src/global/strip_addr.c | 5 +++- postfix/src/global/strip_addr.h | 9 +++---- postfix/src/local/bounce_workaround.c | 7 +++--- postfix/src/local/recipient.c | 2 +- postfix/src/oqmgr/qmgr_message.c | 3 +-- postfix/src/pipe/pipe.c | 5 ++-- postfix/src/qmgr/qmgr_message.c | 3 +-- postfix/src/smtp/smtp_map11.c | 2 +- postfix/src/smtp/smtp_proto.c | 1 + postfix/src/smtp/smtp_sasl_glue.c | 2 +- postfix/src/smtpd/smtpd_check.c | 9 ++++--- postfix/src/trivial-rewrite/resolve.c | 14 +++++------ postfix/src/trivial-rewrite/transport.c | 4 ++-- postfix/src/virtual/mailbox.c | 13 +++++----- 28 files changed, 122 insertions(+), 101 deletions(-) diff --git a/postfix/HISTORY b/postfix/HISTORY index d9428c0db..64a78948b 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -22785,3 +22785,10 @@ Apologies for any names omitted. relocated_maps). These features may be migrated later to enable quoted-form address lookup keys, for consistency with other Postfix features. + +20170109 + + Cleanup: reduce the number of modified files, to make a + back-port more feasible. This renames foo() to foo_opt(), + and renames the backwards_compatibility foo_noconv() to + their old name foo(). diff --git a/postfix/WISHLIST b/postfix/WISHLIST index 109e8c82c..30a980513 100644 --- a/postfix/WISHLIST +++ b/postfix/WISHLIST @@ -6,7 +6,11 @@ Wish list: Disable -DSNAPSHOT and -DNONPROD in makedefs. - Document RFC5321 localpart quoting in DATABASE_README. + Document RFC5322 localpart quoting in DATABASE_README. + + Add quote_822_local() flag to indicate if an address + is complete or localpart only. This avoids incorrect + results when a localpart-only input contains '@'. In the bounce daemon, set util_utf8_enable if returning an SMTPUTF8 message. diff --git a/postfix/src/cleanup/cleanup_addr.c b/postfix/src/cleanup/cleanup_addr.c index 842d0d924..b6396ada8 100644 --- a/postfix/src/cleanup/cleanup_addr.c +++ b/postfix/src/cleanup/cleanup_addr.c @@ -165,9 +165,8 @@ off_t cleanup_addr_sender(CLEANUP_STATE *state, const char *buf) if ((state->flags & CLEANUP_FLAG_BCC_OK) && *STR(clean_addr) && cleanup_send_bcc_maps) { - if ((bcc = mail_addr_find_noconv(cleanup_send_bcc_maps, - STR(clean_addr), - IGNORE_EXTENSION)) != 0) { + if ((bcc = mail_addr_find(cleanup_send_bcc_maps, STR(clean_addr), + IGNORE_EXTENSION)) != 0) { cleanup_addr_bcc(state, bcc); } else if (cleanup_send_bcc_maps->error) { msg_warn("%s: %s map lookup problem -- " @@ -229,9 +228,8 @@ void cleanup_addr_recipient(CLEANUP_STATE *state, const char *buf) if ((state->flags & CLEANUP_FLAG_BCC_OK) && *STR(clean_addr) && cleanup_rcpt_bcc_maps) { - if ((bcc = mail_addr_find_noconv(cleanup_rcpt_bcc_maps, - STR(clean_addr), - IGNORE_EXTENSION)) != 0) { + if ((bcc = mail_addr_find(cleanup_rcpt_bcc_maps, STR(clean_addr), + IGNORE_EXTENSION)) != 0) { cleanup_addr_bcc(state, bcc); } else if (cleanup_rcpt_bcc_maps->error) { msg_warn("%s: %s map lookup problem -- " diff --git a/postfix/src/cleanup/cleanup_map11.c b/postfix/src/cleanup/cleanup_map11.c index 6e835b0e2..941e156f2 100644 --- a/postfix/src/cleanup/cleanup_map11.c +++ b/postfix/src/cleanup/cleanup_map11.c @@ -104,9 +104,9 @@ int cleanup_map11_external(CLEANUP_STATE *state, VSTRING *addr, * the place. */ for (count = 0; count < MAX_RECURSION; count++) { - if ((new_addr = mail_addr_map(maps, STR(addr), propagate, - MAIL_ADDR_FORM_EXTERNAL, - MAIL_ADDR_FORM_EXTERNAL)) != 0) { + if ((new_addr = mail_addr_map_opt(maps, STR(addr), propagate, + MAIL_ADDR_FORM_EXTERNAL, + MAIL_ADDR_FORM_EXTERNAL)) != 0) { if (new_addr->argc > 1) msg_warn("%s: multi-valued %s entry for %s", state->queue_id, maps->title, STR(addr)); diff --git a/postfix/src/global/mail_addr_crunch.c b/postfix/src/global/mail_addr_crunch.c index 7e7db1a06..73d7206df 100644 --- a/postfix/src/global/mail_addr_crunch.c +++ b/postfix/src/global/mail_addr_crunch.c @@ -10,13 +10,13 @@ /* const char *string; /* const char *extension; /* -/* ARGV *mail_addr_crunch(string, extension, in_form, out_form) +/* ARGV *mail_addr_crunch_opt(string, extension, in_form, out_form) /* const char *string; /* const char *extension; /* int in_form; /* int out_form; /* LEGACY SUPPORT -/* ARGV *mail_addr_crunch_noconv(string, extension) +/* ARGV *mail_addr_crunch(string, extension) /* const char *string; /* const char *extension; /* DESCRIPTION @@ -28,10 +28,10 @@ /* between internal and external forms. The caller is expected /* to pass the result to argv_free(). /* -/* mail_addr_crunch() gives more control, at the cost of +/* mail_addr_crunch_opt() gives more control, at the cost of /* additional conversions between internal and external forms. /* -/* mail_addr_crunch_noconv() is used by legacy code and performs +/* mail_addr_crunch() is used by legacy code and performs /* no conversion between internal and external forms. /* /* Arguments: @@ -82,7 +82,7 @@ /* mail_addr_crunch - break string into addresses, optionally add extension */ -ARGV *mail_addr_crunch(const char *string, const char *extension, +ARGV *mail_addr_crunch_opt(const char *string, const char *extension, int in_form, int out_form) { VSTRING *intern_addr = vstring_alloc(100); @@ -216,7 +216,7 @@ int main(int unused_argc, char **unused_argv) vstream_fflush(VSTREAM_OUT); } while (vstring_get_nonl(buf, VSTREAM_IN) != VSTREAM_EOF) { - argv = mail_addr_crunch(STR(buf), (VSTRING_LEN(extension) ? + argv = mail_addr_crunch_opt(STR(buf), (VSTRING_LEN(extension) ? STR(extension) : 0), in_form, out_form); for (cpp = argv->argv; *cpp; cpp++) diff --git a/postfix/src/global/mail_addr_crunch.h b/postfix/src/global/mail_addr_crunch.h index 3ee39fff1..64ed02e7d 100644 --- a/postfix/src/global/mail_addr_crunch.h +++ b/postfix/src/global/mail_addr_crunch.h @@ -20,21 +20,24 @@ * Global library. */ #include -#include /* * External interface. */ -extern ARGV *mail_addr_crunch(const char *, const char *, int, int); +extern ARGV *mail_addr_crunch_opt(const char *, const char *, int, int); - /* The least-overhead form. */ + /* + * The least-overhead form. + */ #define mail_addr_crunch_ext_to_int(string, extension) \ - mail_addr_crunch((string), (extension), MAIL_ADDR_FORM_EXTERNAL, \ + mail_addr_crunch_opt((string), (extension), MAIL_ADDR_FORM_EXTERNAL, \ MAIL_ADDR_FORM_INTERNAL) - /* The legacy form. */ -#define mail_addr_crunch_noconv(string, extension) \ - mail_addr_crunch((string), (extension), MAIL_ADDR_FORM_NOCONV, \ + /* + * The legacy form. + */ +#define mail_addr_crunch(string, extension) \ + mail_addr_crunch_opt((string), (extension), MAIL_ADDR_FORM_NOCONV, \ MAIL_ADDR_FORM_NOCONV) /* LICENSE diff --git a/postfix/src/global/mail_addr_find.c b/postfix/src/global/mail_addr_find.c index 7adf59330..a5aff22bd 100644 --- a/postfix/src/global/mail_addr_find.c +++ b/postfix/src/global/mail_addr_find.c @@ -11,14 +11,15 @@ /* const char *address; /* char **extension; /* -/* const char *mail_addr_find(maps, address, extension, in_form, out_form) +/* const char *mail_addr_find_opt(maps, address, extension, +/* in_form, out_form) /* MAPS *maps; /* const char *address; /* char **extension; /* int in_form; /* int out_form; /* LEGACY SUPPORT -/* const char *mail_addr_find_noconv(maps, address, extension) +/* const char *mail_addr_find(maps, address, extension) /* MAPS *maps; /* const char *address; /* char **extension; @@ -38,20 +39,20 @@ /* (unquoted/quoted) conversions of the query, extension, or /* result. /* -/* mail_addr_find() gives more control, at the cost of +/* mail_addr_find_opt() gives more control, at the cost of /* additional conversions between internal and external forms. /* In particular, the output conversion to internal form assumes /* that the lookup result is an email address. /* -/* mail_addr_find_noconv() is used by legacy code that is not +/* mail_addr_find() is used by legacy code that is not /* yet aware of internal versus external addres formats. /* /* mail_addr_find_trans() implements transitional functionality. -/* It behaves like mail_addr_find(...INTERNAL, ...NOCONV) and +/* It behaves like mail_addr_find_opt(...INTERNAL, ...NOCONV) and /* searches a table with the quoted form of the address, but /* if the lookup produces no result, and the quoted address /* differs from the unquoted form, it also tries -/* mail_addr_find(...NOCONV, ...NOCONV). +/* mail_addr_find_opt(...NOCONV, ...NOCONV). /* /* An address that is in the form \fIuser\fR matches itself. /* @@ -137,18 +138,18 @@ const char *mail_addr_find_trans(MAPS *path, const char *address, char **extp) static VSTRING *quoted_addr; /* - * First, let mail_addr_find() search with the address converted to + * First, let mail_addr_find_opt() search with the address converted to * external form. Fall back to a search with the address in internal * (unconverted) form, if no match was found and the internal and * external forms differ. */ - if ((result = mail_addr_find(path, address, extp, + if ((result = mail_addr_find_opt(path, address, extp, MAIL_ADDR_FORM_INTERNAL, MAIL_ADDR_FORM_NOCONV)) == 0) { if (quoted_addr == 0) quoted_addr = vstring_alloc(100); quote_822_local(quoted_addr, address); if (strcmp(STR(quoted_addr), address) != 0) - result = mail_addr_find(path, address, extp, + result = mail_addr_find_opt(path, address, extp, MAIL_ADDR_FORM_NOCONV, MAIL_ADDR_FORM_NOCONV); } return (result); @@ -168,8 +169,8 @@ static const char *find_addr(MAPS *path, const char *address, int flags, /* mail_addr_find - map a canonical address */ -const char *mail_addr_find(MAPS *path, const char *address, char **extp, - int in_form, int out_form) +const char *mail_addr_find_opt(MAPS *path, const char *address, char **extp, + int in_form, int out_form) { const char *myname = "mail_addr_find"; VSTRING *ext_addr_buf = 0; @@ -205,7 +206,7 @@ const char *mail_addr_find(MAPS *path, const char *address, char **extp, int_bare_key = saved_ext = 0; } else { int_bare_key = - strip_addr_internal(int_full_key, &saved_ext, var_rcpt_delim); + strip_addr(int_full_key, &saved_ext, var_rcpt_delim); } /* @@ -364,7 +365,7 @@ int main(int argc, char **argv) expect_res = mystrtok(&bp, ":"); expect_ext = mystrtok(&bp, ":"); extent = 0; - result = mail_addr_find(path, key_field, &extent, in_form, out_form); + result = mail_addr_find_opt(path, key_field, &extent, in_form, out_form); vstream_printf("%s:%s -> %s:%s (%s)\n", in_field, key_field, out_field, result ? result : path->error ? "(try again)" : diff --git a/postfix/src/global/mail_addr_find.h b/postfix/src/global/mail_addr_find.h index aa3a97450..e515e2033 100644 --- a/postfix/src/global/mail_addr_find.h +++ b/postfix/src/global/mail_addr_find.h @@ -20,16 +20,17 @@ /* * External interface. */ -extern const char *mail_addr_find(MAPS *, const char *, char **, int, int); +extern const char *mail_addr_find_opt(MAPS *, const char *, char **, int, int); +extern const char *mail_addr_find_trans(MAPS *, const char *, char **); /* The least-overhead form. */ #define mail_addr_find_int_to_ext(maps, address, extension) \ - mail_addr_find((maps), (address), (extension), \ + mail_addr_find_opt((maps), (address), (extension), \ MAIL_ADDR_FORM_INTERNAL, MAIL_ADDR_FORM_EXTERNAL) /* The legacy form. */ -#define mail_addr_find_noconv(maps, address, extension) \ - mail_addr_find((maps), (address), (extension), \ +#define mail_addr_find(maps, address, extension) \ + mail_addr_find_opt((maps), (address), (extension), \ MAIL_ADDR_FORM_NOCONV, MAIL_ADDR_FORM_NOCONV) /* LICENSE diff --git a/postfix/src/global/mail_addr_map.c b/postfix/src/global/mail_addr_map.c index fafb05dd7..e7b244941 100644 --- a/postfix/src/global/mail_addr_map.c +++ b/postfix/src/global/mail_addr_map.c @@ -11,7 +11,7 @@ /* const char *address; /* int propagate; /* -/* ARGV *mail_addr_map(path, address, propagate, in_form, out_form) +/* ARGV *mail_addr_map_opt(path, address, propagate, in_form, out_form) /* MAPS *path; /* const char *address; /* int propagate; @@ -21,7 +21,7 @@ /* named address, or a null pointer if none is found. The /* search address and results are in internal (unquoted) form. /* -/* mail_addr_map() gives more control, at the cost of additional +/* mail_addr_map_opt() gives more control, at the cost of additional /* conversions between internal and external forms. /* /* When the \fBpropagate\fR argument is non-zero, @@ -34,7 +34,7 @@ /* the original user in /* \fIotherdomain\fR. /* -/* mail_addr_map() gives additional control over whether the +/* mail_addr_map_opt() gives additional control over whether the /* input is in internal (unquoted) or external (quoted) form. /* to internal form and invokes mail_addr_map_int_to_ext(). /* This may introduce additional unqoute822_local() and @@ -96,8 +96,8 @@ /* mail_addr_map - map a canonical address */ -ARGV *mail_addr_map(MAPS *path, const char *address, int propagate, - int in_form, int out_form) +ARGV *mail_addr_map_opt(MAPS *path, const char *address, int propagate, + int in_form, int out_form) { VSTRING *buffer = 0; const char *myname = "mail_addr_map"; @@ -116,9 +116,10 @@ ARGV *mail_addr_map(MAPS *path, const char *address, int propagate, /* * Optionally convert input from external form. We prefer internal-form - * input to avoid an unnecessary input conversion in mail_addr_find(). - * But the consequence is that we have to convert the internal-form - * input's localpart to external form when mapping @domain -> @domain. + * input to avoid an unnecessary input conversion in + * mail_addr_find_opt(). But the consequence is that we have to convert + * the internal-form input's localpart to external form when mapping + * @domain -> @domain. */ if (in_form == MAIL_ADDR_FORM_EXTERNAL) { int_address = vstring_alloc(100); @@ -132,11 +133,11 @@ ARGV *mail_addr_map(MAPS *path, const char *address, int propagate, /* * Look up the full address; if no match is found, look up the address * with the extension stripped off, and remember the unmatched extension. - * We explicitly call the mail_addr_find() variant that does not convert - * the lookup result. + * We explicitly call the mail_addr_find_opt() variant that does not + * convert the lookup result. */ - if ((string = mail_addr_find(path, int_addr, &extension, - in_form, mid_form)) != 0) { + if ((string = mail_addr_find_opt(path, int_addr, &extension, + in_form, mid_form)) != 0) { /* * Prepend the original user to @otherdomain, but do not propagate @@ -160,8 +161,8 @@ ARGV *mail_addr_map(MAPS *path, const char *address, int propagate, * Canonicalize the result, and propagate the unmatched extension to * each address found. */ - argv = mail_addr_crunch(string, propagate ? extension : 0, - mid_form, out_form); + argv = mail_addr_crunch_opt(string, propagate ? extension : 0, + mid_form, out_form); if (buffer) vstring_free(buffer); if (ext_address) diff --git a/postfix/src/global/mail_addr_map.h b/postfix/src/global/mail_addr_map.h index 87f926850..945417b86 100644 --- a/postfix/src/global/mail_addr_map.h +++ b/postfix/src/global/mail_addr_map.h @@ -25,11 +25,11 @@ /* * External interface. */ -extern ARGV *mail_addr_map(MAPS *, const char *, int, int, int); +extern ARGV *mail_addr_map_opt(MAPS *, const char *, int, int, int); /* The least-overhead form. */ #define mail_addr_map_internal(path, address, propagate) \ - mail_addr_map((path), (address), (propagate), \ + mail_addr_map_opt((path), (address), (propagate), \ MAIL_ADDR_FORM_INTERNAL, MAIL_ADDR_FORM_INTERNAL) /* LICENSE diff --git a/postfix/src/global/mail_addr_map_tester.c b/postfix/src/global/mail_addr_map_tester.c index 4bdd4bba7..aae1a3bf5 100644 --- a/postfix/src/global/mail_addr_map_tester.c +++ b/postfix/src/global/mail_addr_map_tester.c @@ -73,8 +73,8 @@ typedef struct { #define PLUS_RECIPIENT_DELIMITER "+" /* - * All these tests must pass, so that we know that mail_addr_map() works as - * intended. + * All these tests must pass, so that we know that mail_addr_map_opt() works + * as intended. */ static MAIL_ADDR_MAP_TEST pass_tests[] = { { @@ -284,8 +284,8 @@ int main(int argc, char **argv) | DICT_FLAG_FOLD_FIX | DICT_FLAG_UTF8_REQUEST); UPDATE(var_rcpt_delim, test->delimiter); - result = mail_addr_map(maps, test->address, test->propagate, - test->in_form, test->out_form); + result = mail_addr_map_opt(maps, test->address, test->propagate, + test->in_form, test->out_form); if (compare(test->testname, test->expect_argv, test->expect_argc, result ? result->argv : 0, result ? result->argc : 0) != 0) { msg_info("database = %s", test->database); diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index ced90d0bf..1694eae0a 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20170108" +#define MAIL_RELEASE_DATE "20170109" #define MAIL_VERSION_NUMBER "3.2" #ifdef SNAPSHOT diff --git a/postfix/src/global/split_addr.c b/postfix/src/global/split_addr.c index 58b8da799..2bed146bd 100644 --- a/postfix/src/global/split_addr.c +++ b/postfix/src/global/split_addr.c @@ -15,6 +15,9 @@ /* found, and returns a pointer to the remainder. The address /* must be in internal (unquoted) form. /* +/* split_addr() is a backwards-compatible form for legacy code. +/* It is an alias for split_addr_internal(). +/* /* Reserved addresses are not split: postmaster, mailer-daemon, /* double-bounce. Addresses that begin with owner-, or addresses /* that end in -request are not split when the owner_request_special diff --git a/postfix/src/global/split_addr.h b/postfix/src/global/split_addr.h index e278ee2cd..b68dc6144 100644 --- a/postfix/src/global/split_addr.h +++ b/postfix/src/global/split_addr.h @@ -15,6 +15,10 @@ extern char *split_addr_internal(char *, const char *); + /* Legacy API. */ + +#define split_addr split_addr_internal + /* LICENSE /* .ad /* .fi diff --git a/postfix/src/global/strip_addr.c b/postfix/src/global/strip_addr.c index da6670df6..d75db640e 100644 --- a/postfix/src/global/strip_addr.c +++ b/postfix/src/global/strip_addr.c @@ -17,6 +17,9 @@ /* The caller is expected to pass the copy to myfree(). /* The input and result are in internal form. /* +/* strip_addr() is a backwards-compatible form for legacy code. +/* It is an alias for strip_addr_internal(). +/* /* Arguments: /* .IP address /* Address localpart or user@domain form in internal form. @@ -78,7 +81,7 @@ char *strip_addr_internal(const char *full, char **extension, stripped = mystrdup(full); if ((ratsign = strrchr(stripped, '@')) != 0) *ratsign = 0; - if ((extent = split_addr_internal(stripped, delimiter_set)) != 0) { + if ((extent = split_addr(stripped, delimiter_set)) != 0) { extent -= 1; if (extension) { *extent = full[strlen(stripped)]; diff --git a/postfix/src/global/strip_addr.h b/postfix/src/global/strip_addr.h index e482ee47a..18895bac6 100644 --- a/postfix/src/global/strip_addr.h +++ b/postfix/src/global/strip_addr.h @@ -11,10 +11,11 @@ /* DESCRIPTION /* .nf - /* - * External interface. - */ -extern char * strip_addr_internal(const char *, char **, const char *); + /* External interface. */ + +extern char *strip_addr_internal(const char *, char **, const char *); + +#define strip_addr strip_addr_internal /* LICENSE /* .ad diff --git a/postfix/src/local/bounce_workaround.c b/postfix/src/local/bounce_workaround.c index 027c0ec95..7fe4aaa14 100644 --- a/postfix/src/local/bounce_workaround.c +++ b/postfix/src/local/bounce_workaround.c @@ -108,10 +108,9 @@ int bounce_workaround(LOCAL_STATE state) FIND_OWNER(owner_alias, owner_expansion, state.msg_attr.rcpt.address); if (alias_maps->error == 0 && owner_expansion == 0 - && (stripped_recipient = - strip_addr_internal(state.msg_attr.rcpt.address, - (char **) 0, - var_rcpt_delim)) != 0) { + && (stripped_recipient = strip_addr(state.msg_attr.rcpt.address, + (char **) 0, + var_rcpt_delim)) != 0) { myfree(owner_alias); FIND_OWNER(owner_alias, owner_expansion, stripped_recipient); myfree(stripped_recipient); diff --git a/postfix/src/local/recipient.c b/postfix/src/local/recipient.c index 7f083b548..e3f4d1ceb 100644 --- a/postfix/src/local/recipient.c +++ b/postfix/src/local/recipient.c @@ -267,7 +267,7 @@ int deliver_recipient(LOCAL_STATE state, USER_ATTR usr_attr) state.msg_attr.user = mystrdup(state.msg_attr.local); if (*var_rcpt_delim) { state.msg_attr.extension = - split_addr_internal(state.msg_attr.user, var_rcpt_delim); + split_addr(state.msg_attr.user, var_rcpt_delim); if (state.msg_attr.extension && strchr(state.msg_attr.extension, '/')) { msg_warn("%s: address with illegal extension: %s", state.msg_attr.queue_id, state.msg_attr.local); diff --git a/postfix/src/oqmgr/qmgr_message.c b/postfix/src/oqmgr/qmgr_message.c index dcc948ec0..26d9bd37e 100644 --- a/postfix/src/oqmgr/qmgr_message.c +++ b/postfix/src/oqmgr/qmgr_message.c @@ -1204,8 +1204,7 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message) : strlen(STR(reply.recipient))); vstring_strncpy(queue_name, STR(reply.recipient), len); /* Remove the address extension from the recipient localpart. */ - if (*var_rcpt_delim - && split_addr_internal(STR(queue_name), var_rcpt_delim)) + if (*var_rcpt_delim && split_addr(STR(queue_name), var_rcpt_delim)) vstring_truncate(queue_name, strlen(STR(queue_name))); /* Assume the recipient domain is equivalent to nexthop. */ vstring_sprintf_append(queue_name, "@%s", STR(reply.nexthop)); diff --git a/postfix/src/pipe/pipe.c b/postfix/src/pipe/pipe.c index 649d83469..dd995132d 100644 --- a/postfix/src/pipe/pipe.c +++ b/postfix/src/pipe/pipe.c @@ -754,7 +754,7 @@ static ARGV *expand_argv(const char *service, char **argv, msg_warn("no @ in recipient address: %s", rcpt_list->info[i].address); if (*var_rcpt_delim) - split_addr_internal(STR(buf), var_rcpt_delim); + split_addr(STR(buf), var_rcpt_delim); if (*STR(buf) == 0) continue; dict_update(PIPE_DICT_TABLE, PIPE_DICT_USER, STR(buf)); @@ -772,8 +772,7 @@ static ARGV *expand_argv(const char *service, char **argv, msg_warn("no @ in recipient address: %s", rcpt_list->info[i].address); if (*var_rcpt_delim == 0 - || (ext = split_addr_internal(STR(buf), - var_rcpt_delim)) == 0) + || (ext = split_addr(STR(buf), var_rcpt_delim)) == 0) ext = ""; /* insert null arg */ dict_update(PIPE_DICT_TABLE, PIPE_DICT_EXTENSION, ext); } diff --git a/postfix/src/qmgr/qmgr_message.c b/postfix/src/qmgr/qmgr_message.c index ce1a57d4a..495d52d93 100644 --- a/postfix/src/qmgr/qmgr_message.c +++ b/postfix/src/qmgr/qmgr_message.c @@ -1263,8 +1263,7 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message) : strlen(STR(reply.recipient))); vstring_strncpy(queue_name, STR(reply.recipient), len); /* Remove the address extension from the recipient localpart. */ - if (*var_rcpt_delim - && split_addr_internal(STR(queue_name), var_rcpt_delim)) + if (*var_rcpt_delim && split_addr(STR(queue_name), var_rcpt_delim)) vstring_truncate(queue_name, strlen(STR(queue_name))); /* Assume the recipient domain is equivalent to nexthop. */ vstring_sprintf_append(queue_name, "@%s", STR(reply.nexthop)); diff --git a/postfix/src/smtp/smtp_map11.c b/postfix/src/smtp/smtp_map11.c index f49b9122d..745e4b126 100644 --- a/postfix/src/smtp/smtp_map11.c +++ b/postfix/src/smtp/smtp_map11.c @@ -80,7 +80,7 @@ int smtp_map11_external(VSTRING *addr, MAPS *maps, int propagate) ARGV *new_addr; const char *result; - if ((new_addr = mail_addr_map(maps, STR(addr), propagate, + if ((new_addr = mail_addr_map_opt(maps, STR(addr), propagate, MAIL_ADDR_FORM_EXTERNAL, MAIL_ADDR_FORM_EXTERNAL)) != 0) { if (new_addr->argc > 1) msg_warn("multi-valued %s result for %s", maps->title, STR(addr)); diff --git a/postfix/src/smtp/smtp_proto.c b/postfix/src/smtp/smtp_proto.c index 328ad9275..89a3aab94 100644 --- a/postfix/src/smtp/smtp_proto.c +++ b/postfix/src/smtp/smtp_proto.c @@ -142,6 +142,7 @@ #include #include #include +#include #include #include #include diff --git a/postfix/src/smtp/smtp_sasl_glue.c b/postfix/src/smtp/smtp_sasl_glue.c index 257c72ac2..d2c1c3c59 100644 --- a/postfix/src/smtp/smtp_sasl_glue.c +++ b/postfix/src/smtp/smtp_sasl_glue.c @@ -184,7 +184,7 @@ int smtp_sasl_passwd_lookup(SMTP_SESSION *session) smtp_sasl_passwd_map->error = 0; if ((smtp_mode && var_smtp_sender_auth && state->request->sender[0] - && (value = mail_addr_find_noconv(smtp_sasl_passwd_map, + && (value = mail_addr_find(smtp_sasl_passwd_map, state->request->sender, (char **) 0)) != 0) || (smtp_sasl_passwd_map->error == 0 && (value = maps_find(smtp_sasl_passwd_map, diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index 052f20f22..f281cff79 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -1155,8 +1155,7 @@ static const char *check_mail_addr_find(SMTPD_STATE *state, { const char *result; - if ((result = mail_addr_find_noconv(maps, key, ext)) != 0 - || maps->error == 0) + if ((result = mail_addr_find(maps, key, ext)) != 0 || maps->error == 0) return (result); if (maps->error == DICT_ERR_RETRY) /* Warning is already logged. */ @@ -3187,7 +3186,7 @@ static int check_mail_access(SMTPD_STATE *state, const char *table, if (*var_rcpt_delim == 0) { bare_addr = 0; } else { - bare_addr = strip_addr_internal(addr, (char **) 0, var_rcpt_delim); + bare_addr = strip_addr(addr, (char **) 0, var_rcpt_delim); } #define CHECK_MAIL_ACCESS_RETURN(x) \ @@ -5196,8 +5195,8 @@ static int check_rcpt_maps(SMTPD_STATE *state, const char *sender, * Search the recipient lookup tables of the respective address class. * * XXX Use the less expensive maps_find() (built-in case folding) instead of - * the baroque mail_addr_find(). But then we have to strip the domain and - * deal with address extensions ourselves. + * the baroque mail_addr_find(). But then we have to strip the domain + * and deal with address extensions ourselves. * * XXX But that would break sites that use the virtual delivery agent for * local delivery, because the virtual delivery agent requires diff --git a/postfix/src/trivial-rewrite/resolve.c b/postfix/src/trivial-rewrite/resolve.c index 69bd2c4fa..70c3fdcaa 100644 --- a/postfix/src/trivial-rewrite/resolve.c +++ b/postfix/src/trivial-rewrite/resolve.c @@ -560,10 +560,10 @@ static void resolve_addr(RES_CONTEXT *rp, char *sender, char *addr, */ else { if (rp->snd_def_xp_info - && (xport = mail_addr_find_noconv(rp->snd_def_xp_info, + && (xport = mail_addr_find(rp->snd_def_xp_info, sender_key = (*sender ? sender : var_null_def_xport_maps_key), - (char **) 0)) != 0) { + (char **) 0)) != 0) { if (*xport == 0) { msg_warn("%s: ignoring null lookup result for %s", rp->snd_def_xp_maps_name, sender_key); @@ -589,10 +589,10 @@ static void resolve_addr(RES_CONTEXT *rp, char *sender, char *addr, * override the recipient domain. */ if (rp->snd_relay_info - && (relay = mail_addr_find_noconv(rp->snd_relay_info, - sender_key = (*sender ? sender : + && (relay = mail_addr_find(rp->snd_relay_info, + sender_key = (*sender ? sender : var_null_relay_maps_key), - (char **) 0)) != 0) { + (char **) 0)) != 0) { if (*relay == 0) { msg_warn("%s: ignoring null lookup result for %s", rp->snd_relay_maps_name, sender_key); @@ -716,8 +716,8 @@ static void resolve_addr(RES_CONTEXT *rp, char *sender, char *addr, if (relocated_maps != 0) { const char *newloc; - if ((newloc = mail_addr_find_noconv(relocated_maps, STR(nextrcpt), - IGNORE_ADDR_EXTENSION)) != 0) { + if ((newloc = mail_addr_find(relocated_maps, STR(nextrcpt), + IGNORE_ADDR_EXTENSION)) != 0) { vstring_strcpy(channel, MAIL_SERVICE_ERROR); /* 5.1.6 is the closest match, but not perfect. */ vstring_sprintf(nexthop, "5.1.6 User has moved to %s", newloc); diff --git a/postfix/src/trivial-rewrite/transport.c b/postfix/src/trivial-rewrite/transport.c index e9fc071c0..f270b8dde 100644 --- a/postfix/src/trivial-rewrite/transport.c +++ b/postfix/src/trivial-rewrite/transport.c @@ -287,8 +287,8 @@ int transport_lookup(TRANSPORT_INFO *tp, const char *addr, * look up the stripped address with the PARTIAL flag to avoid matching * partial lookup keys with regular expressions. */ - if ((stripped_addr = strip_addr_internal(addr, DISCARD_EXTENSION, - var_rcpt_delim)) != 0) { + if ((stripped_addr = strip_addr(addr, DISCARD_EXTENSION, + var_rcpt_delim)) != 0) { found = find_transport_entry(tp, stripped_addr, rcpt_domain, PARTIAL, channel, nexthop); diff --git a/postfix/src/virtual/mailbox.c b/postfix/src/virtual/mailbox.c index fce73b152..51e646de7 100644 --- a/postfix/src/virtual/mailbox.c +++ b/postfix/src/virtual/mailbox.c @@ -193,9 +193,8 @@ int deliver_mailbox(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp) */ #define IGNORE_EXTENSION ((char **) 0) - mailbox_res = mail_addr_find_noconv(virtual_mailbox_maps, - state.msg_attr.user, - IGNORE_EXTENSION); + mailbox_res = mail_addr_find(virtual_mailbox_maps, state.msg_attr.user, + IGNORE_EXTENSION); if (mailbox_res == 0) { if (virtual_mailbox_maps->error == 0) return (NO); @@ -214,8 +213,8 @@ int deliver_mailbox(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp) /* * Look up the mailbox owner rights. Defer in case of trouble. */ - uid_res = mail_addr_find_noconv(virtual_uid_maps, state.msg_attr.user, - IGNORE_EXTENSION); + uid_res = mail_addr_find(virtual_uid_maps, state.msg_attr.user, + IGNORE_EXTENSION); if (uid_res == 0) { msg_warn("recipient %s: not found in %s", state.msg_attr.user, virtual_uid_maps->title); @@ -237,8 +236,8 @@ int deliver_mailbox(LOCAL_STATE state, USER_ATTR usr_attr, int *statusp) /* * Look up the mailbox group rights. Defer in case of trouble. */ - gid_res = mail_addr_find_noconv(virtual_gid_maps, state.msg_attr.user, - IGNORE_EXTENSION); + gid_res = mail_addr_find(virtual_gid_maps, state.msg_attr.user, + IGNORE_EXTENSION); if (gid_res == 0) { msg_warn("recipient %s: not found in %s", state.msg_attr.user, virtual_gid_maps->title);