]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Add workaround for Postfix hostname
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 31 May 2017 09:36:36 +0000 (10:36 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 31 May 2017 09:36:36 +0000 (10:36 +0100)
src/libserver/milter.c

index d739a9d5e59e43d5aa013432c1b21884a2c93ec9..6d2c7508b686bd09d51a7b45ece81fa2c8e2f501 100644 (file)
@@ -290,6 +290,11 @@ rspamd_milter_process_command (struct rspamd_milter_session *session,
                        guchar proto;
                        guint16 port;
 
+                       /*
+                        * Important notice: Postfix do NOT use this command to pass
+                        * client's info (e.g. hostname is not really here)
+                        * Sendmail will pass it here
+                        */
                        if (session->hostname == NULL) {
                                session->hostname = rspamd_fstring_new_init (pos, zero - pos);
                        }
@@ -1185,6 +1190,13 @@ rspamd_milter_macro_http (struct rspamd_milter_session *session,
                rspamd_http_message_add_header_len (msg, USER_HEADER,
                                found->begin, found->len);
        }
+
+       if (!session->hostname || session->hostname->len == 0) {
+               IF_MACRO("{client_name}") {
+                       rspamd_http_message_add_header_len (msg, HOSTNAME_HEADER,
+                                       found->begin, found->len);
+               }
+       }
 }
 
 struct rspamd_http_message *