[exim-cvs] local_scan: align local_scan.h and docs re. store…

Startseite
Nachricht löschen
Nachricht beantworten
Autor: Exim Git Commits Mailing List
Datum:  
To: exim-cvs
Betreff: [exim-cvs] local_scan: align local_scan.h and docs re. store_get()
Gitweb: https://git.exim.org/exim.git/commitdiff/4ec0fcb6737da9bc2603056d56fbf6e41e061967
Commit:     4ec0fcb6737da9bc2603056d56fbf6e41e061967
Parent:     2fd4074dd2ca95b14e0256f740965c40671e31eb
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Dec 10 20:04:15 2019 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Dec 10 20:04:15 2019 +0000


    local_scan: align local_scan.h and docs re. store_get()
---
 doc/doc-docbook/spec.xfpt | 12 +++++++++---
 src/src/local_scan.h      |  8 ++++++++
 src/src/store.h           |  8 ++------
 3 files changed, 19 insertions(+), 9 deletions(-)


diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index fd51701..5e48221 100644
--- a/doc/doc-docbook/spec.xfpt
+++ b/doc/doc-docbook/spec.xfpt
@@ -34327,12 +34327,18 @@ dropping of a TCP/IP connection), you can call &'smtp_fflush()'&, which has no
arguments. It flushes the output stream, and returns a non-zero value if there
is an error.

-.vitem &*void&~*store_get(int)*&
+.new
+.vitem &*void&~*store_get(int,BOOL)*&
This function accesses Exim's internal store (memory) manager. It gets a new
-chunk of memory whose size is given by the argument. Exim bombs out if it ever
+chunk of memory whose size is given by the first argument.
+The second argument should be given as TRUE if the memory will be used for
+data possibly coming from an attacker (eg. the message content),
+FALSE if it is locally-sourced.
+Exim bombs out if it ever
runs out of memory. See the next section for a discussion of memory handling.
+.wen

-.vitem &*void&~*store_get_perm(int)*&
+.vitem &*void&~*store_get_perm(int,BOOL)*&
This function is like &'store_get()'&, but it always gets memory from the
permanent pool. See the next section for a discussion of memory handling.

diff --git a/src/src/local_scan.h b/src/src/local_scan.h
index e0a9708..da9a891 100644
--- a/src/src/local_scan.h
+++ b/src/src/local_scan.h
@@ -193,6 +193,14 @@ extern void    smtp_vprintf(const char *, BOOL, va_list);
     string_sprintf_trc(fmt, US __FUNCTION__, __LINE__, __VA_ARGS__)
 extern uschar *string_sprintf_trc(const char *, const uschar *, unsigned, ...) ALMOST_PRINTF(1,4);


+#define store_get(size, tainted) \
+    store_get_3(size, tainted, __FUNCTION__, __LINE__)
+extern void   *store_get_3(int, BOOL, const char *, int)    ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT;
+#define store_get_perm(size, tainted) \
+    store_get_perm_3(size, tainted, __FUNCTION__, __LINE__)
+extern void   *store_get_perm_3(int, BOOL, const char *, int)    ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT;
+
+
 #if defined(LOCAL_SCAN) || defined(DLFUNC_IMPL)
 /* When compiling a local_scan() file we want to rename a published API, so that
 we can use an inlined implementation in the compiles of the main Exim files,
diff --git a/src/src/store.h b/src/src/store.h
index 52f211e..39b0f6e 100644
--- a/src/src/store.h
+++ b/src/src/store.h
@@ -34,10 +34,7 @@ tracing information for debugging. */


 #define store_free(addr) \
     store_free_3(addr, __FUNCTION__, __LINE__)
-#define store_get(size, tainted) \
-    store_get_3(size, tainted, __FUNCTION__, __LINE__)
-#define store_get_perm(size, tainted) \
-    store_get_perm_3(size, tainted, __FUNCTION__, __LINE__)
+/* store_get & store_get_perm are in local_scan.h */
 #define store_malloc(size) \
     store_malloc_3(size, __FUNCTION__, __LINE__)
 #define store_mark(void) \
@@ -55,8 +52,7 @@ typedef void ** rmark;


 extern BOOL    store_extend_3(void *, BOOL, int, int, const char *, int);
 extern void    store_free_3(void *, const char *, int);
-extern void   *store_get_3(int, BOOL, const char *, int)    ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT;
-extern void   *store_get_perm_3(int, BOOL, const char *, int)    ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT;
+/* store_get_3 & store_get_perm_3 are in local_scan.h */
 extern void   *store_malloc_3(int, const char *, int)        ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT;
 extern rmark   store_mark_3(const char *, int);
 extern void   *store_newblock_3(void *, BOOL, int, int, const char *, int);