Check query strings of query-style lookups for quoting. Bug 2850
[exim.git] / src / src / store.h
1 /*************************************************
2 *     Exim - an Internet mail transport agent    *
3 *************************************************/
4
5 /* Copyright (c) University of Cambridge 1995 - 2009 */
6 /* Copyright (c) The Exim Maintainers 2020 - 2021 */
7 /* See the file NOTICE for conditions of use and distribution. */
8
9 /* Header for Exim's memory allocation functions */
10
11 #ifndef STORE_H
12 #define STORE_H
13
14 /* Define symbols for identifying the store pools. */
15
16 enum { POOL_MAIN,
17        POOL_PERM,
18        POOL_CONFIG,
19        POOL_SEARCH,
20        POOL_MESSAGE,
21
22        POOL_TAINT_BASE,
23
24        POOL_TAINT_MAIN = POOL_TAINT_BASE,
25        POOL_TAINT_PERM,
26        POOL_TAINT_CONFIG,
27        POOL_TAINT_SEARCH,
28        POOL_TAINT_MESSAGE,
29
30        N_PAIRED_POOLS
31 };
32
33 /* This variable (the one for the current pool) is set by store_get() to its
34 yield, and by store_reset() to NULL. This allows string_cat() to optimize its
35 store handling. */
36
37 extern void * store_last_get[];
38
39 /* This variable contains the current store pool number. */
40
41 extern int store_pool;
42
43 /* Macros for calling the memory allocation routines with
44 tracing information for debugging. */
45
46 #define store_extend(addr, old, new) \
47   store_extend_3(addr, old, new, __FUNCTION__, __LINE__)
48
49 #define store_free(addr) \
50         store_free_3(addr, __FUNCTION__, __LINE__)
51 /* store_get & store_get_perm are in local_scan.h */
52 #define store_get_quoted(size, proto_mem, quoter) \
53         store_get_quoted_3((size), (proto_mem), (quoter), __FUNCTION__, __LINE__)
54 #define store_malloc(size) \
55         store_malloc_3(size, __FUNCTION__, __LINE__)
56 #define store_mark(void) \
57         store_mark_3(__FUNCTION__, __LINE__)
58 #define store_newblock(oldblock, newsize, datalen) \
59         store_newblock_3(oldblock, newsize, datalen, __FUNCTION__, __LINE__)
60 #define store_release_above(addr) \
61         store_release_above_3(addr, __FUNCTION__, __LINE__)
62 #define store_reset(mark) \
63         store_reset_3(mark, __FUNCTION__, __LINE__)
64
65
66 /* The real functions */
67 typedef void ** rmark;
68
69 extern BOOL    store_extend_3(void *, int, int, const char *, int);
70 extern void    store_free_3(void *, const char *, int);
71 /* store_get_3 & store_get_perm_3 are in local_scan.h */
72 extern void *  store_get_quoted_3(int, const void *, unsigned, const char *, int);
73 extern void *  store_malloc_3(size_t, const char *, int)                ALLOC ALLOC_SIZE(1) WARN_UNUSED_RESULT;
74 extern rmark   store_mark_3(const char *, int);
75 extern void *  store_newblock_3(void *, int, int, const char *, int);
76 extern void    store_release_above_3(void *, const char *, int);
77 extern rmark   store_reset_3(rmark, const char *, int);
78
79 #define GET_UNTAINTED   (const void *)0
80 #define GET_TAINTED     (const void *)1
81
82 extern int      quoter_for_address(const void *);
83 extern BOOL     is_quoted_like(const void *, unsigned);
84 extern BOOL     is_real_quoter(int);
85 extern void     debug_print_taint(const void * p);
86
87 #endif  /* STORE_H */
88
89 /* End of store.h */