]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Support UTF8 in Received flags 4933/head
authorVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 19 Apr 2024 13:14:10 +0000 (14:14 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Fri, 19 Apr 2024 13:14:10 +0000 (14:14 +0100)
Issue: #4919

src/libmime/received.cxx
src/libmime/received.hxx

index ab0a65a6947b4602da0a4558e180881b944a3943..76b210a886cafb17e42612c85ed3eba0b3f9a097 100644 (file)
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2021 Vsevolod Stakhov
+/*
+ * Copyright 2024 Vsevolod Stakhov
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *   http://www.apache.org/licenses/LICENSE-2.0
+ *    http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -616,13 +616,25 @@ received_header_parse(received_header_chain &chain, rspamd_mempool_t *pool,
 
        static constexpr const auto protos_map = frozen::make_unordered_map<frozen::string, received_flags>({{"smtp", received_flags::SMTP},
                                                                                                                                                                                                                 {"esmtp", received_flags::ESMTP},
+                                                                                                                                                                                                                {"utf8esmtp", received_flags::ESMTP |
+                                                                                                                                                                                                                                                  received_flags::UTF8},
                                                                                                                                                                                                                 {"esmtpa", received_flags::ESMTPA |
                                                                                                                                                                                                                                                received_flags::AUTHENTICATED},
+                                                                                                                                                                                                                {"utf8esmtpa", received_flags::ESMTPA |
+                                                                                                                                                                                                                                                       received_flags::AUTHENTICATED |
+                                                                                                                                                                                                                                                       received_flags::UTF8},
                                                                                                                                                                                                                 {"esmtpsa", received_flags::ESMTPSA |
                                                                                                                                                                                                                                                 received_flags::SSL |
                                                                                                                                                                                                                                                 received_flags::AUTHENTICATED},
+                                                                                                                                                                                                                {"utf8esmtpsa", received_flags::ESMTPSA |
+                                                                                                                                                                                                                                                        received_flags::SSL |
+                                                                                                                                                                                                                                                        received_flags::AUTHENTICATED |
+                                                                                                                                                                                                                                                        received_flags::UTF8},
                                                                                                                                                                                                                 {"esmtps", received_flags::ESMTPS |
                                                                                                                                                                                                                                                received_flags::SSL},
+                                                                                                                                                                                                                {"utf8esmtps", received_flags::ESMTPS |
+                                                                                                                                                                                                                                                       received_flags::SSL |
+                                                                                                                                                                                                                                                       received_flags::UTF8},
                                                                                                                                                                                                                 {"lmtp", received_flags::LMTP},
                                                                                                                                                                                                                 {"imap", received_flags::IMAP},
                                                                                                                                                                                                                 {"imaps", received_flags::IMAP |
@@ -800,6 +812,7 @@ received_export_to_lua(received_header_chain *chain, lua_State *L) -> bool
                push_flag(rh, received_flags::ARTIFICIAL, "artificial");
                push_flag(rh, received_flags::AUTHENTICATED, "authenticated");
                push_flag(rh, received_flags::SSL, "ssl");
+               push_flag(rh, received_flags::UTF8, "utf8");
                lua_setfield(L, -2, "flags");
 
                auto push_nullable_string = [L](const mime_string &st, const char *field) {
index 4f423f1a3074e4a27e19fbdfee69cbc038db72c1..5e2b1bfb9121f34f66dc73178c1c5766c1671e41 100644 (file)
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2021 Vsevolod Stakhov
+/*
+ * Copyright 2024 Vsevolod Stakhov
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *   http://www.apache.org/licenses/LICENSE-2.0
+ *    http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
@@ -58,6 +58,7 @@ enum class received_flags {
        ARTIFICIAL = (1u << 11u),
        SSL = (1u << 12u),
        AUTHENTICATED = (1u << 13u),
+       UTF8 = 1u << 14u,
 };
 
 constexpr received_flags operator|(received_flags lhs, received_flags rhs)