Revert introduction of alloc_insecure_tainted_data
[exim.git] / src / src / functions.h
index c03f88304017304c7841df59ead9fdb6979466d8..e4d9b1a58d93f0d0f6278b47e429ffc60d350de5 100644 (file)
@@ -1135,50 +1135,20 @@ if (f.running_in_test_harness && f.testsuite_delays) millisleep(millisec);
 
 /******************************************************************************/
 /* Taint-checked file opens */
-static inline uschar *
-is_tainted2(const void *p, int lflags, const char* fmt, ...)
-{
-va_list ap;
-uschar *msg;
-rmark mark;
-
-if (!is_tainted(p))
-  return NULL;
-
-mark = store_mark();
-va_start(ap, fmt);
-msg = string_from_gstring(string_vformat(NULL, SVFMT_TAINT_NOCHK|SVFMT_EXTEND, fmt, ap));
-va_end(ap);
-
-#ifdef ALLOW_INSECURE_TAINTED_DATA
-if (allow_insecure_tainted_data)
-  {
-  if LOGGING(tainted) log_write(0, LOG_MAIN, "Warning: %s", msg);
-  store_reset(mark);
-  return NULL;
-  }
-#endif
-
-if (lflags) log_write(0, lflags, "%s", msg);
-return msg; /* no store_reset(), as the message might be used afterwards and Exim
-            is expected to exit anyway, so we do not care about the leaked
-            storage */
-}
 
 static inline int
 exim_open2(const char *pathname, int flags)
 {
-if (!is_tainted2(pathname, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname))
-  return open(pathname, flags);
+if (!is_tainted(pathname)) return open(pathname, flags);
+log_write(0, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname);
 errno = EACCES;
 return -1;
 }
-
 static inline int
 exim_open(const char *pathname, int flags, mode_t mode)
 {
-if (!is_tainted2(pathname, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname))
-  return open(pathname, flags, mode);
+if (!is_tainted(pathname)) return open(pathname, flags, mode);
+log_write(0, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname);
 errno = EACCES;
 return -1;
 }
@@ -1186,16 +1156,16 @@ return -1;
 static inline int
 exim_openat(int dirfd, const char *pathname, int flags)
 {
-if (!is_tainted2(pathname, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname))
-  return openat(dirfd, pathname, flags);
+if (!is_tainted(pathname)) return openat(dirfd, pathname, flags);
+log_write(0, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname);
 errno = EACCES;
 return -1;
 }
 static inline int
 exim_openat4(int dirfd, const char *pathname, int flags, mode_t mode)
 {
-if (!is_tainted2(pathname, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname))
-  return openat(dirfd, pathname, flags, mode);
+if (!is_tainted(pathname)) return openat(dirfd, pathname, flags, mode);
+log_write(0, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname);
 errno = EACCES;
 return -1;
 }
@@ -1204,8 +1174,8 @@ return -1;
 static inline FILE *
 exim_fopen(const char *pathname, const char *mode)
 {
-if (!is_tainted2(pathname, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname))
-  return fopen(pathname, mode);
+if (!is_tainted(pathname)) return fopen(pathname, mode);
+log_write(0, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname);
 errno = EACCES;
 return NULL;
 }
@@ -1213,8 +1183,8 @@ return NULL;
 static inline DIR *
 exim_opendir(const uschar * name)
 {
-if (!is_tainted2(name, LOG_MAIN|LOG_PANIC, "Tainted dirname '%s'", name))
-  return opendir(CCS name);
+if (!is_tainted(name)) return opendir(CCS name);
+log_write(0, LOG_MAIN|LOG_PANIC, "Tainted dirname '%s'", name);
 errno = EACCES;
 return NULL;
 }