Track tainted data and refuse to expand it
[exim.git] / src / src / drtables.c
index cd12dd1da8dc8350463e7a0741966b678b9ec1ec..05975628445debcd6cf430ded748b15d34c5b9df 100644 (file)
@@ -35,6 +35,10 @@ set to NULL for those that are not compiled into the binary. */
 #include "auths/dovecot.h"
 #endif
 
+#ifdef AUTH_EXTERNAL
+#include "auths/external.h"
+#endif
+
 #ifdef AUTH_GSASL
 #include "auths/gsasl_exim.h"
 #endif
@@ -101,6 +105,20 @@ auth_info auths_available[] = {
   },
 #endif
 
+#ifdef AUTH_EXTERNAL
+  {
+  .driver_name =       US"external",
+  .options =           auth_external_options,
+  .options_count =     &auth_external_options_count,
+  .options_block =     &auth_external_option_defaults,
+  .options_len =       sizeof(auth_external_options_block),
+  .init =              auth_external_init,
+  .servercode =                auth_external_server,
+  .clientcode =                auth_external_client,
+  .version_report =    NULL
+  },
+#endif
+
 #ifdef AUTH_GSASL
   {
   .driver_name =       US"gsasl",
@@ -491,7 +509,7 @@ static struct lookupmodulestr *lookupmodules = NULL;
 static void
 addlookupmodule(void *dl, struct lookup_module_info *info)
 {
-struct lookupmodulestr *p = store_malloc(sizeof(struct lookupmodulestr));
+struct lookupmodulestr *p = store_get(sizeof(struct lookupmodulestr), FALSE);
 
 p->dl = dl;
 p->info = info;
@@ -546,6 +564,9 @@ extern lookup_module_info dsearch_lookup_module_info;
 #if defined(LOOKUP_IBASE) && LOOKUP_IBASE!=2
 extern lookup_module_info ibase_lookup_module_info;
 #endif
+#if defined(LOOKUP_JSON)
+extern lookup_module_info json_lookup_module_info;
+#endif
 #if defined(LOOKUP_LDAP)
 extern lookup_module_info ldap_lookup_module_info;
 #endif
@@ -599,12 +620,12 @@ init_lookup_list(void)
   int countmodules = 0;
   int moduleerrors = 0;
 #endif
-  struct lookupmodulestr *p;
   static BOOL lookup_list_init_done = FALSE;
-
+  rmark reset_point;
 
   if (lookup_list_init_done)
     return;
+  reset_point = store_mark();
   lookup_list_init_done = TRUE;
 
 #if defined(LOOKUP_CDB) && LOOKUP_CDB!=2
@@ -631,6 +652,10 @@ init_lookup_list(void)
   addlookupmodule(NULL, &ldap_lookup_module_info);
 #endif
 
+#ifdef LOOKUP_JSON
+  addlookupmodule(NULL, &json_lookup_module_info);
+#endif
+
 #if defined(LOOKUP_LSEARCH) && LOOKUP_LSEARCH!=2
   addlookupmodule(NULL, &lsearch_lookup_module_info);
 #endif
@@ -762,17 +787,10 @@ init_lookup_list(void)
   memset(lookup_list, 0, sizeof(lookup_info *) * lookup_list_count);
 
   /* now add all lookups to the real list */
-  p = lookupmodules;
-  while (p) {
-    struct lookupmodulestr *pnext;
-
+  for (struct lookupmodulestr * p = lookupmodules; p; p = p->next)
     for (int j = 0; j < p->info->lookupcount; j++)
       add_lookup_to_list(p->info->lookups[j]);
-
-    pnext = p->next;
-    store_free(p);
-    p = pnext;
-  }
+  store_reset(reset_point);
   /* just to be sure */
   lookupmodules = NULL;
 }