diff --git a/postfix/WISHLIST b/postfix/WISHLIST index 4162c84ab..e12f4dc59 100644 --- a/postfix/WISHLIST +++ b/postfix/WISHLIST @@ -10,6 +10,9 @@ Wish list: move flush_init() etc. from defer service clients to the bounce daemon? + Is it practical to move errors from global dict_errno + to lookuphandle->dict_errno? + Either make all void dict_* operations return an error code, or require that they reset dict_errno on entry, either exit with a fatal error or set dict_errno on error. @@ -29,10 +32,6 @@ Wish list: it is remote (type memcache: or proxy:). This does not work because memcache can use a non-proxied file as backup). - Is it possible to replace msg_fatal calls in match_ops.c - by msg_warn and longjmp? The callers will have to specify - if they want the code to return instead of terminate. - Things to do after the stable release: What is the feasibility of adding an mta_name (personality) diff --git a/postfix/src/global/dict_memcache.c b/postfix/src/global/dict_memcache.c index 9e64d1e1d..71dde68d3 100644 --- a/postfix/src/global/dict_memcache.c +++ b/postfix/src/global/dict_memcache.c @@ -353,7 +353,12 @@ static void dict_memcache_update(DICT *dict, const char *name, return; /* - * Update the backup database first. + * Update the memcache first. + */ + dict_memcache_set(dict_mc, value, dict_mc->mc_ttl); + + /* + * Update the backup database last. */ if (dict_mc->backup) { dict_errno = 0; @@ -361,11 +366,6 @@ static void dict_memcache_update(DICT *dict, const char *name, backup_errno = dict_errno; } - /* - * Update the memcache last. - */ - dict_memcache_set(dict_mc, value, dict_mc->mc_ttl); - if (msg_verbose) msg_info("%s: %s: update key \"%s\"(%s) => \"%s\" %s", myname, dict_mc->dict.name, name, STR(dict_mc->key_buf), @@ -426,8 +426,7 @@ static int dict_memcache_delete(DICT *dict, const char *name) const char *myname = "dict_memcache_delete"; DICT_MC *dict_mc = (DICT_MC *) dict; int backup_errno = 0; - int del_res = 0; - int mem_res; + int del_res; /* * Skip lookups with an inapplicable key, silently. This is just deleting @@ -438,7 +437,12 @@ static int dict_memcache_delete(DICT *dict, const char *name) return (1); /* - * Update the persistent database first. + * Update the memcache first. + */ + del_res = dict_memcache_del(dict_mc); + + /* + * Update the persistent database last. */ if (dict_mc->backup) { dict_errno = 0; @@ -446,11 +450,6 @@ static int dict_memcache_delete(DICT *dict, const char *name) backup_errno = dict_errno; } - /* - * Update the memcache last. - */ - mem_res = dict_memcache_del(dict_mc); - if (msg_verbose) msg_info("%s: %s: delete key \"%s\"(%s) => %s", myname, dict_mc->dict.name, name, STR(dict_mc->key_buf), @@ -459,7 +458,7 @@ static int dict_memcache_delete(DICT *dict, const char *name) dict_errno = (dict_mc->backup ? backup_errno : dict_mc->mc_errno); - return (dict_mc->backup ? del_res : mem_res); + return (del_res); } /* dict_memcache_sequence - first/next lookup */ diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index c7fa9b8fe..7efb73b88 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 "20111222" +#define MAIL_RELEASE_DATE "20111224" #define MAIL_VERSION_NUMBER "2.9" #ifdef SNAPSHOT diff --git a/postfix/src/proxymap/proxymap.c b/postfix/src/proxymap/proxymap.c index 73741096e..497821a17 100644 --- a/postfix/src/proxymap/proxymap.c +++ b/postfix/src/proxymap/proxymap.c @@ -331,13 +331,15 @@ static DICT *proxy_map_find(const char *map_type_name, int request_flags, dict_flags_str(request_flags & DICT_FLAG_INST_MASK)); if (msg_verbose) msg_info("proxy_map_find: %s", STR(map_type_name_flags)); - if ((dict = dict_handle(STR(map_type_name_flags))) == 0) + if ((dict = dict_handle(STR(map_type_name_flags))) == 0) { dict = dict_open(map_type_name, proxy_writer ? WRITE_OPEN_FLAGS : READ_OPEN_FLAGS, request_flags); - if (dict == 0) - msg_panic("proxy_map_find: dict_open null result"); - dict_register(STR(map_type_name_flags), dict); + if (dict == 0) + msg_panic("proxy_map_find: dict_open null result"); + dict_register(STR(map_type_name_flags), dict); + } + dict_errno = 0; return (dict); } @@ -467,7 +469,6 @@ static void proxymap_update_service(VSTREAM *client_stream) dict->flags = ((dict->flags & ~DICT_FLAG_RQST_MASK) | (request_flags & DICT_FLAG_RQST_MASK) | DICT_FLAG_SYNC_UPDATE | DICT_FLAG_DUP_REPLACE); - dict_errno = 0; dict_put(dict, STR(request_key), STR(request_value)); reply_status = (dict_errno ? PROXY_STAT_RETRY : PROXY_STAT_OK); } @@ -512,7 +513,6 @@ static void proxymap_delete_service(VSTREAM *client_stream) dict->flags = ((dict->flags & ~DICT_FLAG_RQST_MASK) | (request_flags & DICT_FLAG_RQST_MASK) | DICT_FLAG_SYNC_UPDATE); - dict_errno = 0; dict_status = dict_del(dict, STR(request_key)); reply_status = (dict_status == 0 ? PROXY_STAT_OK : dict_status > 0 ? PROXY_STAT_NOKEY : diff --git a/postfix/src/trivial-rewrite/resolve.c b/postfix/src/trivial-rewrite/resolve.c index 315799307..fe0fc6228 100644 --- a/postfix/src/trivial-rewrite/resolve.c +++ b/postfix/src/trivial-rewrite/resolve.c @@ -225,6 +225,8 @@ static void resolve_addr(RES_CONTEXT *rp, char *sender, char *addr, if (loop_count > loop_max) { msg_warn("resolve_addr: <%s>: giving up after %ld iterations", addr, (long) loop_count); + *flags |= RESOLVE_FLAG_FAIL; + FREE_MEMORY_AND_RETURN; break; } diff --git a/postfix/src/trivial-rewrite/transport.c b/postfix/src/trivial-rewrite/transport.c index 09fd2ec03..4b3c98bc7 100644 --- a/postfix/src/trivial-rewrite/transport.c +++ b/postfix/src/trivial-rewrite/transport.c @@ -101,7 +101,7 @@ TRANSPORT_INFO *transport_pre_init(const char *transport_maps_name, DICT_FLAG_LOCK | DICT_FLAG_FOLD_FIX | DICT_FLAG_NO_REGSUB); tp->wildcard_channel = tp->wildcard_nexthop = 0; - tp->transport_errno = 0; + tp->wildcard_errno = 0; tp->expire = 0; return (tp); } @@ -234,14 +234,14 @@ static void transport_wildcard_init(TRANSPORT_INFO *tp) #define PARTIAL DICT_FLAG_FIXED if (find_transport_entry(tp, WILDCARD, "", FULL, channel, nexthop)) { - tp->transport_errno = 0; + tp->wildcard_errno = 0; tp->wildcard_channel = channel; tp->wildcard_nexthop = nexthop; if (msg_verbose) msg_info("wildcard_{chan:hop}={%s:%s}", vstring_str(channel), vstring_str(nexthop)); } else { - tp->transport_errno = dict_errno; + tp->wildcard_errno = dict_errno; vstring_free(channel); vstring_free(nexthop); tp->wildcard_channel = 0; @@ -332,10 +332,10 @@ int transport_lookup(TRANSPORT_INFO *tp, const char *addr, /* * Fall back to the wild-card entry. */ - if (tp->transport_errno || event_time() > tp->expire) + if (tp->wildcard_errno || event_time() > tp->expire) transport_wildcard_init(tp); - if (tp->transport_errno) { - dict_errno = tp->transport_errno; + if (tp->wildcard_errno) { + dict_errno = tp->wildcard_errno; return (NOTFOUND); } else if (tp->wildcard_channel) { update_entry(STR(tp->wildcard_channel), STR(tp->wildcard_nexthop), diff --git a/postfix/src/trivial-rewrite/transport.h b/postfix/src/trivial-rewrite/transport.h index 0660f97b5..7db0b5000 100644 --- a/postfix/src/trivial-rewrite/transport.h +++ b/postfix/src/trivial-rewrite/transport.h @@ -30,7 +30,7 @@ typedef struct TRANSPORT_INFO { MAPS *transport_path; VSTRING *wildcard_channel; VSTRING *wildcard_nexthop; - int transport_errno; + int wildcard_errno; time_t expire; } TRANSPORT_INFO;