Gitweb:
https://git.exim.org/exim.git/commitdiff/86d51a7b1055b6fad9a4add3b42efd40328b5130
Commit: 86d51a7b1055b6fad9a4add3b42efd40328b5130
Parent: 0ac642d4166a0064b5517b047e80d0191a93d485
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Wed Aug 4 14:11:49 2021 +0100
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Wed Aug 4 14:11:49 2021 +0100
Builtin macros for ACL conditions & modifiers
---
src/OS/Makefile-Base | 5 ++++-
src/src/acl.c | 22 ++++++++++++++++++++++
src/src/macro_predef.c | 5 +++--
src/src/macro_predef.h | 1 +
4 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base
index bc5fbc4..dc5238a 100644
--- a/src/OS/Makefile-Base
+++ b/src/OS/Makefile-Base
@@ -113,7 +113,7 @@ MACRO_HSRC = macro_predef.h os.h globals.h config.h macros.h \
OBJ_MACRO = macro_predef.o \
macro-globals.o macro-readconf.o macro-route.o macro-transport.o macro-drtables.o \
- macro-tls.o \
+ macro-acl.o macro-tls.o \
macro-appendfile.o macro-autoreply.o macro-lmtp.o macro-pipe.o macro-queuefile.o \
macro-smtp.o macro-accept.o macro-dnslookup.o macro-ipliteral.o macro-iplookup.o \
macro-manualroute.o macro-queryprogram.o macro-redirect.o \
@@ -141,6 +141,9 @@ macro-transport.o: transport.c
macro-drtables.o : drtables.c
@echo "$(CC) -DMACRO_PREDEF drtables.c"
$(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ drtables.c
+macro-acl.o: acl.c
+ @echo "$(CC) -DMACRO_PREDEF acl.c"
+ $(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ acl.c
macro-tls.o: tls.c tls-gnu.c tls-openssl.c
@echo "$(CC) -DMACRO_PREDEF tls.c"
$(FE)$(CC) -c $(CFLAGS) -DMACRO_PREDEF $(INCLUDE) -o $@ tls.c
diff --git a/src/src/acl.c b/src/src/acl.c
index f47259c..242425d 100644
--- a/src/src/acl.c
+++ b/src/src/acl.c
@@ -10,6 +10,7 @@
#include "exim.h"
+#ifndef MACRO_PREDEF
/* Default callout timeout */
@@ -53,6 +54,8 @@ static int msgcond[] = {
[ACL_WARN] = BIT(OK)
};
+#endif
+
/* ACL condition and modifier codes - keep in step with the table that
follows.
down. */
@@ -338,6 +341,24 @@ static condition_def conditions[] = {
};
+#ifdef MACRO_PREDEF
+# include "macro_predef.h"
+void
+features_acl(void)
+{
+for (condition_def * c = conditions; c < conditions + nelem(conditions); c++)
+ {
+ uschar buf[64], * p, * s;
+ int n = sprintf(CS buf, "_ACL_%s_", c->is_modifier ? "MOD" : "COND");
+ for (p = buf + n, s = c->name; *s; s++) *p++ = toupper(*s);
+ *p = '\0';
+ builtin_macro_create(buf);
+ }
+}
+#endif
+
+
+#ifndef MACRO_PREDEF
/* Return values from decode_control(); used as index so keep in step
with the controls_list table that follows! */
@@ -4694,6 +4715,7 @@ if (is_tainted(value)) putc('-', f);
fprintf(f, "-acl%c %s %d\n%s\n", name[0], name+1, Ustrlen(value), value);
}
+#endif /* !MACRO_PREDEF */
/* vi: aw ai sw=2
*/
/* End of acl.c */
diff --git a/src/src/macro_predef.c b/src/src/macro_predef.c
index 5340c5a..757b375 100644
--- a/src/src/macro_predef.c
+++ b/src/src/macro_predef.c
@@ -279,11 +279,12 @@ due to conflicts with other common macros. */
# endif
#endif
+features_acl();
+features_crypto();
+
#ifdef WITH_CONTENT_SCAN
features_malware();
#endif
-
-features_crypto();
}
static void
diff --git a/src/src/macro_predef.h b/src/src/macro_predef.h
index 4bc98e0..3c988a3 100644
--- a/src/src/macro_predef.h
+++ b/src/src/macro_predef.h
@@ -12,6 +12,7 @@ extern void builtin_macro_create(const uschar *);
extern void builtin_macro_create_var(const uschar *, const uschar *);
extern void options_from_list(optionlist *, unsigned, const uschar *, uschar *);
+extern void features_acl(void);
extern void features_malware(void);
extern void features_crypto(void);
extern void options_main(void);