Gitweb:
https://git.exim.org/exim.git/commitdiff/2484a8253df7795a45fb5b4aff6df0bf0e4d56e5
Commit: 2484a8253df7795a45fb5b4aff6df0bf0e4d56e5
Parent: fc37f2acaaa440c5265dc01fd693d8f5406f5cf9
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Nov 29 14:34:25 2022 +0000
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Tue Nov 29 16:03:57 2022 +0000
Add variable $sender_helo_verified
---
doc/doc-txt/NewStuff | 1 +
src/src/acl.c | 30 +++++++++++++++++++++++++-----
src/src/expand.c | 1 +
src/src/functions.h | 1 +
4 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff
index 4a912268b..0d4557a8b 100644
--- a/doc/doc-txt/NewStuff
+++ b/doc/doc-txt/NewStuff
@@ -16,6 +16,7 @@ Version 4.97
3. Variable $sender_helo_verified with the result of an ACL "verify = helo".
4. Predefined macros for expansion items, operators, conditions and variables.
+ 3. Variable $sender_helo_verified with the result of an ACL verify=helo.
Version 4.96
------------
diff --git a/src/src/acl.c b/src/src/acl.c
index 143890668..8e1d92457 100644
--- a/src/src/acl.c
+++ b/src/src/acl.c
@@ -1643,6 +1643,30 @@ return period;
+static BOOL
+sender_helo_verified_internal(void)
+{
+/* We can test the result of optional HELO verification that might have
+occurred earlier. If not, we can attempt the verification now. */
+
+if (!f.helo_verified && !f.helo_verify_failed) smtp_verify_helo();
+return f.helo_verified;
+}
+
+static int
+sender_helo_verified_cond(void)
+{
+return sender_helo_verified_internal() ? OK : FAIL;
+}
+
+uschar *
+sender_helo_verified_boolstr(void)
+{
+return sender_helo_verified_internal() ? US"yes" : US"no";
+}
+
+
+
/* This function implements the "verify" condition. It is called when
encountered in any ACL, because some tests are almost always permitted. Some
just don't make sense, and always fail (for example, an attempt to test a host
@@ -1739,11 +1763,7 @@ switch(vp->value)
return FAIL;
case VERIFY_HELO:
- /* We can test the result of optional HELO verification that might have
- occurred earlier. If not, we can attempt the verification now. */
-
- if (!f.helo_verified && !f.helo_verify_failed) smtp_verify_helo();
- return f.helo_verified ? OK : FAIL;
+ return sender_helo_verified_cond();
case VERIFY_CSA:
/* Do Client SMTP Authorization checks in a separate function, and turn the
diff --git a/src/src/expand.c b/src/src/expand.c
index 6def3c102..57ad76f77 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -715,6 +715,7 @@ static var_entry var_table[] = {
{ "sender_fullhost", vtype_stringptr, &sender_fullhost },
{ "sender_helo_dnssec", vtype_bool, &sender_helo_dnssec },
{ "sender_helo_name", vtype_stringptr, &sender_helo_name },
+ { "sender_helo_verified",vtype_string_func, (void *) &sender_helo_verified_boolstr },
{ "sender_host_address", vtype_stringptr, &sender_host_address },
{ "sender_host_authenticated",vtype_stringptr, &sender_host_authenticated },
{ "sender_host_dnssec", vtype_bool, &sender_host_dnssec },
diff --git a/src/src/functions.h b/src/src/functions.h
index a2c8976e8..3ca346c04 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -489,6 +489,7 @@ extern int search_findtype_partial(const uschar *, int *, const uschar **, i
int *, const uschar **);
extern void *search_open(const uschar *, int, int, uid_t *, gid_t *);
extern void search_tidyup(void);
+extern uschar *sender_helo_verified_boolstr(void);
extern void set_process_info(const char *, ...) PRINTF_FUNCTION(1,2);
extern void sha1_end(hctx *, const uschar *, int, uschar *);
extern void sha1_mid(hctx *, const uschar *);