JH/56 Make the majority of info read from config files readonly, for defence-in-
depth against exploits. Suggestion by Qualsy.
+ Not supported on Solaris 10.
Exim version 4.94
# define MISSING_UNSETENV_3
#endif
+#if _POSIX_C_SOURCE < 200809L
+# define MISSING_POSIX_MEMALIGN
+#endif
+
/* SunOS5 doesn't accept getcwd(NULL, 0) to auto-allocate
a buffer */
void
store_writeprotect(int pool)
{
+#if !defined(COMPILE_UTILITY) && !defined(MISSING_POSIX_MEMALIGN)
for (storeblock * b = chainbase[pool]; b; b = b->next)
- {
-#ifndef COMPILE_UTILITY
if (mprotect(b, ALIGNED_SIZEOF_STOREBLOCK + b->length, PROT_READ) != 0)
- DEBUG(D_any) debug_printf("config block mprotect: (%d) %s\n", errno, strerror(errno))
+ DEBUG(D_any) debug_printf("config block mprotect: (%d) %s\n", errno, strerror(errno));
#endif
- ;
- }
}
/******************************************************************************/
if (++nblocks[pool] > maxblocks[pool])
maxblocks[pool] = nblocks[pool];
+#ifndef MISSING_POSIX_MEMALIGN
if (pool == POOL_CONFIG)
{
long pgsize = sysconf(_SC_PAGESIZE);
posix_memalign((void **)&newblock, pgsize, (mlength + pgsize - 1) & ~(pgsize - 1));
}
else
+#endif
newblock = internal_store_malloc(mlength, func, linenumber);
newblock->next = NULL;
newblock->length = length;