mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Configure sandbox using consdiffmgr; free cdm on exit.
This commit is contained in:
parent
2655a72d89
commit
24f7059704
@ -77,6 +77,17 @@ consensus_cache_open(const char *subdir, int max_entries)
|
||||
return cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the sandbox (if any) configured by <b>cfg</b> to allow the
|
||||
* operations that <b>cache</b> will need.
|
||||
*/
|
||||
int
|
||||
consensus_cache_register_with_sandbox(consensus_cache_t *cache,
|
||||
struct sandbox_cfg_elem **cfg)
|
||||
{
|
||||
return storage_dir_register_with_sandbox(cache->dir, cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper: clear all entries from <b>cache</b> (but do not delete
|
||||
* any that aren't marked for removal
|
||||
|
@ -13,6 +13,9 @@ HANDLE_DECL(consensus_cache_entry, consensus_cache_entry_t, )
|
||||
|
||||
consensus_cache_t *consensus_cache_open(const char *subdir, int max_entries);
|
||||
void consensus_cache_free(consensus_cache_t *cache);
|
||||
struct sandbox_cfg_elem;
|
||||
int consensus_cache_register_with_sandbox(consensus_cache_t *cache,
|
||||
struct sandbox_cfg_elem **cfg);
|
||||
void consensus_cache_unmap_lazy(consensus_cache_t *cache, time_t cutoff);
|
||||
void consensus_cache_delete_pending(consensus_cache_t *cache);
|
||||
consensus_cache_entry_t *consensus_cache_add(consensus_cache_t *cache,
|
||||
|
@ -627,6 +627,16 @@ consdiffmgr_configure(const consdiff_cfg_t *cfg)
|
||||
(void) cdm_cache_get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell the sandbox (if any) configured by <b>cfg</b> to allow the
|
||||
* operations that the consensus diff manager will need.
|
||||
*/
|
||||
int
|
||||
consdiffmgr_register_with_sandbox(struct sandbox_cfg_elem **cfg)
|
||||
{
|
||||
return consensus_cache_register_with_sandbox(cdm_cache_get(), cfg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan the consensus diff manager's cache for any grossly malformed entries,
|
||||
* and mark them as deletable. Return 0 if no problems were found; 1
|
||||
|
@ -32,6 +32,8 @@ consdiff_status_t consdiffmgr_find_diff_from(
|
||||
void consdiffmgr_rescan(void);
|
||||
int consdiffmgr_cleanup(void);
|
||||
void consdiffmgr_configure(const consdiff_cfg_t *cfg);
|
||||
struct sandbox_cfg_elem;
|
||||
int consdiffmgr_register_with_sandbox(struct sandbox_cfg_elem **cfg);
|
||||
void consdiffmgr_free_all(void);
|
||||
int consdiffmgr_validate(void);
|
||||
|
||||
|
@ -64,6 +64,7 @@
|
||||
#include "connection.h"
|
||||
#include "connection_edge.h"
|
||||
#include "connection_or.h"
|
||||
#include "consdiffmgr.h"
|
||||
#include "control.h"
|
||||
#include "cpuworker.h"
|
||||
#include "crypto_s2k.h"
|
||||
@ -3162,6 +3163,7 @@ tor_free_all(int postfork)
|
||||
sandbox_free_getaddrinfo_cache();
|
||||
protover_free_all();
|
||||
bridges_free_all();
|
||||
consdiffmgr_free_all();
|
||||
if (!postfork) {
|
||||
config_free_all();
|
||||
or_state_free_all();
|
||||
@ -3584,6 +3586,8 @@ sandbox_init_filter(void)
|
||||
OPEN_DATADIR("stats");
|
||||
STAT_DATADIR("stats");
|
||||
STAT_DATADIR2("stats", "dirreq-stats");
|
||||
|
||||
consdiffmgr_register_with_sandbox(&cfg);
|
||||
}
|
||||
|
||||
init_addrinfo();
|
||||
|
Loading…
Reference in New Issue
Block a user