]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.9-20111224
authorWietse Venema <wietse@porcupine.org>
Sat, 24 Dec 2011 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <viktor@dukhovni.org>
Tue, 5 Feb 2013 06:37:51 +0000 (06:37 +0000)
postfix/WISHLIST
postfix/src/global/dict_memcache.c
postfix/src/global/mail_version.h
postfix/src/proxymap/proxymap.c
postfix/src/trivial-rewrite/resolve.c
postfix/src/trivial-rewrite/transport.c
postfix/src/trivial-rewrite/transport.h

index 4162c84ab9720c00d1a79f1ef70c105b39a21ce0..e12f4dc59b5238f9d1ed518952995ac324c2809d 100644 (file)
@@ -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)
index 9e64d1e1d48898c08f858e870a21a4b1ee818a6e..71dde68d3bf7a54f05d2697c77e299e962ac3a0a 100644 (file)
@@ -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 */
index c7fa9b8fe50ca7dce4fb4131998112f763cf5b57..7efb73b883e6ad42ac2a80d9d93f22a3ff98e7ce 100644 (file)
@@ -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
index 73741096e09590d06692cb88eb399508b93fa6c1..497821a176b04ffd3e8904fc8680514a86cb6d5a 100644 (file)
@@ -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 :
index 315799307cdf84c910c68395f92d9ae7d09c0e04..fe0fc62288182b45ad09f7b58d9569dc0c33c4c7 100644 (file)
@@ -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;
        }
 
index 09fd2ec035ed88ac966af3de5e697d39f7d5aa02..4b3c98bc704ebd20aa6dea4b0ee3afffcdf78846 100644 (file)
@@ -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),
index 0660f97b58997f5173b497294172525e42ce4358..7db0b5000c4a985adc428f69e22fc11b5d5ab1b4 100644 (file)
@@ -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;