From: Wietse Venema Date: Mon, 6 Jan 2003 05:00:00 +0000 (-0500) Subject: postfix-2.0.0-20030106 X-Git-Tag: v2.1-RC1-20040331~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80a7521b21605f714e94dbb34895fdf7661abf48;p=thirdparty%2Fpostfix.git postfix-2.0.0-20030106 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 581117f68..63c7c98ad 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -7665,6 +7665,31 @@ Apologies for any names omitted. than a year until I found out how to reproduce it. File: util/vstream.c. +20030105 + + Cleanup: removed the address syntax check from the queue + manager, since a better test was implemented recently in + the trivial-rewrite server. Files: *qmgr/qmgr_message.c. + + Bugfix: redirect bounce/defer to the address verification + service where appropriate. Files: *qmgr/qmgr_bounce.c, + *qmgr/qmgr_defer.c. + + Bugfix: "no such file or directory" warnings after "postfix + reload" when a chrooted smtpd reconnects to the proxy + service. Fix: use "private/proxymap" if possible, otherwise + use "$queue_dir/private/proxymap". File: global/dict_proxy.c. + + Robustness: daemons now chdir() to the queue directory before + running the pre-jail initialization code, so that daemons + running in stand-alone mode produce more consistent results. + Files: master/single_server.c, master/multi_server.c. + master/trigger_server.c. + + Bugfix: "sendmail -bs" tried to access the proxymap service. + It should not try to open any user/domain/uce related tables + at all. File: smtpd/smtpd.c. + Open problems: Med: do not postpone rejected "MAIL FROM" size information, diff --git a/postfix/src/global/dict_proxy.c b/postfix/src/global/dict_proxy.c index 28a6b3566..70bc5b87f 100644 --- a/postfix/src/global/dict_proxy.c +++ b/postfix/src/global/dict_proxy.c @@ -194,11 +194,11 @@ DICT *dict_proxy_open(const char *map, int open_flags, int dict_flags) * XXX Use absolute pathname to make this work from non-daemon processes. */ if (proxy_stream == 0) { - if (access(var_queue_dir, F_OK) == 0) + if (access(MAIL_CLASS_PRIVATE "/" MAIL_SERVICE_PROXYMAP, F_OK) == 0) + prefix = MAIL_CLASS_PRIVATE; + else prefix = kludge = concatenate(var_queue_dir, "/", MAIL_CLASS_PRIVATE, (char *) 0); - else - prefix = MAIL_CLASS_PRIVATE; proxy_stream = clnt_stream_create(prefix, MAIL_SERVICE_PROXYMAP, var_ipc_idle_limit, diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 61919dd0c..04deb4c76 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change the patchlevel and the release date. Snapshots change the * release date only, unless they include the same bugfix as a patch release. */ -#define MAIL_RELEASE_DATE "20030105" +#define MAIL_RELEASE_DATE "20030106" #define VAR_MAIL_VERSION "mail_version" #define DEF_MAIL_VERSION "2.0.0-" MAIL_RELEASE_DATE diff --git a/postfix/src/master/multi_server.c b/postfix/src/master/multi_server.c index 9fdbd657b..f4d12996d 100644 --- a/postfix/src/master/multi_server.c +++ b/postfix/src/master/multi_server.c @@ -629,14 +629,14 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...) /* * Run pre-jail initialization. */ + if (chdir(var_queue_dir) < 0) + msg_fatal("chdir(\"%s\"): %m", var_queue_dir); if (pre_init) pre_init(multi_server_name, multi_server_argv); /* * Optionally, restrict the damage that this process can do. */ - if (chdir(var_queue_dir) < 0) - msg_fatal("chdir(\"%s\"): %m", var_queue_dir); resolve_local_init(); chroot_uid(root_dir, user_name); diff --git a/postfix/src/master/single_server.c b/postfix/src/master/single_server.c index 9e269e98d..c2feb94a6 100644 --- a/postfix/src/master/single_server.c +++ b/postfix/src/master/single_server.c @@ -574,14 +574,14 @@ NORETURN single_server_main(int argc, char **argv, SINGLE_SERVER_FN service,...) /* * Run pre-jail initialization. */ + if (chdir(var_queue_dir) < 0) + msg_fatal("chdir(\"%s\"): %m", var_queue_dir); if (pre_init) pre_init(single_server_name, single_server_argv); /* * Optionally, restrict the damage that this process can do. */ - if (chdir(var_queue_dir) < 0) - msg_fatal("chdir(\"%s\"): %m", var_queue_dir); resolve_local_init(); chroot_uid(root_dir, user_name); diff --git a/postfix/src/master/trigger_server.c b/postfix/src/master/trigger_server.c index 685973a07..e7640ed2f 100644 --- a/postfix/src/master/trigger_server.c +++ b/postfix/src/master/trigger_server.c @@ -584,14 +584,14 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,.. /* * Run pre-jail initialization. */ + if (chdir(var_queue_dir) < 0) + msg_fatal("chdir(\"%s\"): %m", var_queue_dir); if (pre_init) pre_init(trigger_server_name, trigger_server_argv); /* * Optionally, restrict the damage that this process can do. */ - if (chdir(var_queue_dir) < 0) - msg_fatal("chdir(\"%s\"): %m", var_queue_dir); resolve_local_init(); chroot_uid(root_dir, user_name); diff --git a/postfix/src/nqmgr/qmgr_bounce.c b/postfix/src/nqmgr/qmgr_bounce.c index 0f9d50bee..8e12bf176 100644 --- a/postfix/src/nqmgr/qmgr_bounce.c +++ b/postfix/src/nqmgr/qmgr_bounce.c @@ -67,7 +67,7 @@ void qmgr_bounce_recipient(QMGR_MESSAGE *message, QMGR_RCPT *recipient, int status; va_start(ap, format); - status = vbounce_append(BOUNCE_FLAG_KEEP, message->queue_id, + status = vbounce_append(message->tflags, message->queue_id, recipient->orig_rcpt, recipient->address, "none", message->arrival_time, format, ap); va_end(ap); diff --git a/postfix/src/nqmgr/qmgr_defer.c b/postfix/src/nqmgr/qmgr_defer.c index 21ffdd6fd..c286ef3a2 100644 --- a/postfix/src/nqmgr/qmgr_defer.c +++ b/postfix/src/nqmgr/qmgr_defer.c @@ -158,7 +158,7 @@ void qmgr_defer_recipient(QMGR_MESSAGE *message, QMGR_RCPT *recipient, /* * Update the message structure and log the message disposition. */ - message->flags |= defer_append(BOUNCE_FLAG_KEEP, message->queue_id, + message->flags |= defer_append(message->tflags, message->queue_id, recipient->orig_rcpt, recipient->address, "none", message->arrival_time, "%s", reason); } diff --git a/postfix/src/nqmgr/qmgr_message.c b/postfix/src/nqmgr/qmgr_message.c index 7d77c849c..9ff0c6d60 100644 --- a/postfix/src/nqmgr/qmgr_message.c +++ b/postfix/src/nqmgr/qmgr_message.c @@ -643,22 +643,6 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message) resolve_clnt_init(&reply); for (recipient = list.info; recipient < list.info + list.len; recipient++) { - /* - * This may be a bit late in the game, but it is the most convenient - * place to scrutinize the destination address syntax. We have a - * complete queue file, so bouncing is easy. That luxury is not - * available to the cleanup service. The main issue is that we want - * to have this test in one place, instead of having to do this in - * every front-ent program. - */ - if ((at = strrchr(recipient->address, '@')) != 0 - && (at + 1)[strspn(at + 1, "[]0123456789.")] != 0 - && valid_hostname(at + 1, DONT_GRIPE) == 0) { - qmgr_bounce_recipient(message, recipient, - "bad host/domain syntax: \"%s\"", at + 1); - continue; - } - /* * Resolve the destination to (transport, nexthop, address). The * result address may differ from the one specified by the sender. diff --git a/postfix/src/proxymap/proxymap.c b/postfix/src/proxymap/proxymap.c index 39b4f713f..345862e0b 100644 --- a/postfix/src/proxymap/proxymap.c +++ b/postfix/src/proxymap/proxymap.c @@ -181,7 +181,8 @@ static VSTRING *map_type_name_flags; /* proxy_map_find - look up or open table */ -static DICT *proxy_map_find(const char *map_type_name, int request_flags) +static DICT *proxy_map_find(const char *map_type_name, int request_flags, + int *statp) { DICT *dict; @@ -193,13 +194,17 @@ static DICT *proxy_map_find(const char *map_type_name, int request_flags) * Canonicalize the map name. If the map is not on the approved list, * deny the request. */ +#define PROXY_MAP_FIND_ERROR_RETURN(x) { *statp = (x); return (0); } + while (strncmp(map_type_name, PROXY_COLON, PROXY_COLON_LEN) == 0) map_type_name += PROXY_COLON_LEN; + if (strchr(map_type_name, ':') == 0) + PROXY_MAP_FIND_ERROR_RETURN(PROXY_STAT_BAD); if (htable_locate(proxy_read_maps, map_type_name) == 0) { msg_warn("request for unapproved table: \"%s\"", map_type_name); msg_warn("to approve a table for %s access, specify it in %s with %s", MAIL_SERVICE_PROXYMAP, MAIN_CONF_FILE, VAR_PROXY_READ_MAPS); - return (0); + PROXY_MAP_FIND_ERROR_RETURN(PROXY_STAT_DENY); } /* @@ -234,8 +239,8 @@ static void proxymap_lookup_service(VSTREAM *client_stream) ATTR_TYPE_END) != 3) { reply_status = PROXY_STAT_BAD; reply_value = ""; - } else if ((dict = proxy_map_find(STR(request_map), request_flags)) == 0) { - reply_status = PROXY_STAT_DENY; + } else if ((dict = proxy_map_find(STR(request_map), request_flags, + &reply_status)) == 0) { reply_value = ""; } else if ((reply_value = dict_get(dict, STR(request_key))) != 0) { reply_status = PROXY_STAT_OK; @@ -274,8 +279,8 @@ static void proxymap_open_service(VSTREAM *client_stream) ATTR_TYPE_END) != 2) { reply_status = PROXY_STAT_BAD; reply_flags = 0; - } else if ((dict = proxy_map_find(STR(request_map), request_flags)) == 0) { - reply_status = PROXY_STAT_DENY; + } else if ((dict = proxy_map_find(STR(request_map), request_flags, + &reply_status)) == 0) { reply_flags = 0; } else { reply_status = PROXY_STAT_OK; @@ -305,8 +310,8 @@ static void proxymap_service(VSTREAM *client_stream, char *unused_service, /* * This routine runs whenever a client connects to the socket dedicated - * to the address verification service. All connection-management stuff - * is handled by the common code in multi_server.c. + * to the proxymap service. All connection-management stuff is handled by + * the common code in multi_server.c. */ if (attr_scan(client_stream, ATTR_FLAG_MORE | ATTR_FLAG_STRICT, diff --git a/postfix/src/qmgr/qmgr_bounce.c b/postfix/src/qmgr/qmgr_bounce.c index 23b92447b..15d59e07c 100644 --- a/postfix/src/qmgr/qmgr_bounce.c +++ b/postfix/src/qmgr/qmgr_bounce.c @@ -62,7 +62,7 @@ void qmgr_bounce_recipient(QMGR_MESSAGE *message, QMGR_RCPT *recipient, int status; va_start(ap, format); - status = vbounce_append(BOUNCE_FLAG_KEEP, message->queue_id, + status = vbounce_append(message->tflags, message->queue_id, recipient->orig_rcpt, recipient->address, "none", message->arrival_time, format, ap); va_end(ap); diff --git a/postfix/src/qmgr/qmgr_defer.c b/postfix/src/qmgr/qmgr_defer.c index c897605e6..60fccd8dc 100644 --- a/postfix/src/qmgr/qmgr_defer.c +++ b/postfix/src/qmgr/qmgr_defer.c @@ -153,7 +153,7 @@ void qmgr_defer_recipient(QMGR_MESSAGE *message, QMGR_RCPT *recipient, /* * Update the message structure and log the message disposition. */ - message->flags |= defer_append(BOUNCE_FLAG_KEEP, message->queue_id, + message->flags |= defer_append(message->tflags, message->queue_id, recipient->orig_rcpt, recipient->address, "none", message->arrival_time, "%s", reason); } diff --git a/postfix/src/qmgr/qmgr_message.c b/postfix/src/qmgr/qmgr_message.c index 16a0c2245..b04ba3f1e 100644 --- a/postfix/src/qmgr/qmgr_message.c +++ b/postfix/src/qmgr/qmgr_message.c @@ -523,22 +523,6 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message) resolve_clnt_init(&reply); for (recipient = list.info; recipient < list.info + list.len; recipient++) { - /* - * This may be a bit late in the game, but it is the most convenient - * place to scrutinize the destination address syntax. We have a - * complete queue file, so bouncing is easy. That luxury is not - * available to the cleanup service. The main issue is that we want - * to have this test in one place, instead of having to do this in - * every front-ent program. - */ - if ((at = strrchr(recipient->address, '@')) != 0 - && (at + 1)[strspn(at + 1, "[]0123456789.")] != 0 - && valid_hostname(at + 1, DONT_GRIPE) == 0) { - qmgr_bounce_recipient(message, recipient, - "bad host/domain syntax: \"%s\"", at + 1); - continue; - } - /* * Resolve the destination to (transport, nexthop, address). The * result address may differ from the one specified by the sender. diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 7db37ba26..03a4d2c7a 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -1621,7 +1621,8 @@ static void pre_jail_init(char *unused_name, char **unused_argv) */ smtpd_noop_cmds = string_list_init(MATCH_FLAG_NONE, var_smtpd_noop_cmds); verp_clients = namadr_list_init(MATCH_FLAG_NONE, var_verp_clients); - smtpd_check_init(); + if (getuid() == 0 || getuid() == var_owner_uid) + smtpd_check_init(); debug_peer_init(); if (var_smtpd_sasl_enable)