summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2021-04-25 13:02:01 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2021-04-25 21:40:07 +0100
commit82fecf8fd8f749abfc538a06d9eefc7119e014ae (patch)
treef049e6a456201c630e2fbd1312491088806e06d4 /src
parentb9ab1e966ed95017bd6fc45acd04e09ec0c128ed (diff)
Taint: enforce untainted ACL text line
Diffstat (limited to 'src')
-rw-r--r--src/src/acl.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/src/acl.c b/src/src/acl.c
index 2f20821c2..ce8d2189f 100644
--- a/src/src/acl.c
+++ b/src/src/acl.c
@@ -4088,6 +4088,26 @@ while (isspace(*ss)) ss++;
acl_text = ss;
+#ifdef notyet_taintwarn
+if ( !f.running_in_test_harness
+ && is_tainted2(acl_text, LOG_MAIN|LOG_PANIC,
+ "attempt to use tainted ACL text \"%s\"", acl_text))
+ {
+ /* Avoid leaking info to an attacker */
+ *log_msgptr = US"internal configuration error";
+ return ERROR;
+ }
+#else
+if (is_tainted(acl_text) && !f.running_in_test_harness)
+ {
+ log_write(0, LOG_MAIN|LOG_PANIC,
+ "attempt to use tainted ACL text \"%s\"", acl_text);
+ /* Avoid leaking info to an attacker */
+ *log_msgptr = US"internal configuration error";
+ return ERROR;
+ }
+#endi
+
/* Handle the case of a string that does not contain any spaces. Look for a
named ACL among those read from the configuration, or a previously read file.
It is possible that the pointer to the ACL is NULL if the configuration
@@ -4111,14 +4131,6 @@ if (Ustrchr(ss, ' ') == NULL)
else if (*ss == '/')
{
struct stat statbuf;
- if (is_tainted(ss))
- {
- log_write(0, LOG_MAIN|LOG_PANIC,
- "attempt to open tainted ACL file name \"%s\"", ss);
- /* Avoid leaking info to an attacker */
- *log_msgptr = US"internal configuration error";
- return ERROR;
- }
if ((fd = Uopen(ss, O_RDONLY, 0)) < 0)
{
*log_msgptr = string_sprintf("failed to open ACL file \"%s\": %s", ss,