X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=secnet.git;a=blobdiff_plain;f=secnet.h;h=ecbc9de8a502841ff72b1ae42480cb99974100b4;hp=5d72f956ef4587851acb8b4f8d32943b6b140757;hb=22c77971bb13c37344fc73fe9b8d72ed96181df2;hpb=54d5ef0053f1f9ef4e34dacba002513e5ccea0fd diff --git a/secnet.h b/secnet.h index 5d72f95..ecbc9de 100644 --- a/secnet.h +++ b/secnet.h @@ -14,8 +14,10 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -58,6 +60,10 @@ extern struct log_if *system_log; /* from process.c */ extern void start_signal_handling(void); +void afterfork(void); +/* Must be called before exec in every child made after + start_signal_handling. Safe to call in earlier children too. */ + /***** CONFIGURATION support *****/ extern bool_t just_check_config; /* If True then we're going to exit after @@ -169,6 +175,7 @@ extern void *safe_realloc_ary(void *p, size_t size, size_t count, const char *message); void setcloexec(int fd); /* cannot fail */ +void setnonblock(int fd); /* cannot fail */ void pipe_cloexec(int fd[2]); /* pipe(), setcloexec() twice; cannot fail */ extern int sys_cmd(const char *file, const char *argc, ...); @@ -262,12 +269,19 @@ bool_t remove_hook(uint32_t phase, hook_fn *f, void *state); extern uint32_t current_phase; extern void enter_phase(uint32_t new_phase); +void phase_hooks_init(void); /* for main() only */ + /* Some features (like netlink 'soft' routes) require that secnet retain root privileges. They should indicate that here when appropriate. */ extern bool_t require_root_privileges; extern cstring_t require_root_privileges_explanation; +/* Some modules may want to know whether secnet is going to drop + privilege, so that they know whether to do privsep. Call only + in phases SETUP and later. */ +bool_t will_droppriv(void); + /***** END of program lifetime support *****/ /***** MODULE support *****/ @@ -282,6 +296,7 @@ extern void init_builtin_modules(dict_t *dict); extern init_module resolver_module; extern init_module random_module; extern init_module udp_module; +extern init_module polypath_module; extern init_module util_module; extern init_module site_module; extern init_module transform_eax_module; @@ -597,6 +612,8 @@ void lg_vperror(struct log_if *lg, const char *desc, struct cloc *loc, void lg_perror(struct log_if *lg, const char *desc, struct cloc *loc, int class, int errnoval, const char *fmt, ...) FORMAT(printf,6,7); +void lg_exitstatus(struct log_if *lg, const char *desc, struct cloc *loc, + int class, int status, const char *progname); /* The cfgfatal() family of functions require messages that end in '\n' */ extern NORETURN(cfgfatal(struct cloc loc, cstring_t facility,