$NetBSD: patch-be,v 1.3 2004/03/06 15:08:32 grant Exp $

--- src/cleanup/cleanup_message.c.orig	2004-01-21 12:25:27.000000000 +1100
+++ src/cleanup/cleanup_message.c
@@ -177,15 +177,17 @@ static void cleanup_rewrite_sender(CLEAN
     for (tpp = addr_list; *tpp; tpp++) {
 	cleanup_rewrite_tree(*tpp);
 	if (state->flags & CLEANUP_FLAG_MAP_OK) {
-	    if (cleanup_send_canon_maps)
-		cleanup_map11_tree(state, *tpp, cleanup_send_canon_maps,
-				cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
-	    if (cleanup_comm_canon_maps)
-		cleanup_map11_tree(state, *tpp, cleanup_comm_canon_maps,
-				cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
-	    if (cleanup_masq_domains
-		&& (cleanup_masq_flags & CLEANUP_MASQ_FLAG_HDR_FROM))
+	    if (var_canon_env_rcpt) {
+		if (cleanup_send_canon_maps)
+		    cleanup_map11_tree(state, *tpp, cleanup_send_canon_maps,
+			cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
+		if (cleanup_comm_canon_maps)
+		    cleanup_map11_tree(state, *tpp, cleanup_comm_canon_maps,
+			cleanup_ext_prop_mask & EXT_PROP_CANONICAL);
+		if (cleanup_masq_domains
+		    && (cleanup_masq_flags & CLEANUP_MASQ_FLAG_HDR_FROM))
 		cleanup_masquerade_tree(*tpp, cleanup_masq_domains);
+	    }
 	}
 	if (hdr_opts->type == HDR_FROM && state->from == 0)
 	    state->from = cleanup_extract_internal(header_buf, *tpp);
