From dafb57b8af432d800219a8e17900e1ac56a65c14 Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Fri, 15 Jan 2021 14:03:45 +0000 Subject: sandbox also on FreeBSD with capsicum --- gmid.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'gmid.h') diff --git a/gmid.h b/gmid.h index cbf9da3..3477cfe 100644 --- a/gmid.h +++ b/gmid.h @@ -28,11 +28,6 @@ #include #include -#ifndef __OpenBSD__ -# define pledge(a, b) 0 -# define unveil(a, b) 0 -#endif - #ifndef INFTIM # define INFTIM -1 #endif @@ -52,6 +47,12 @@ #define HOSTSLEN 64 +#define LOGE(c, fmt, ...) logs(LOG_ERR, c, fmt, __VA_ARGS__) +#define LOGW(c, fmt, ...) logs(LOG_WARNING, c, fmt, __VA_ARGS__) +#define LOGN(c, fmt, ...) logs(LOG_NOTICE, c, fmt, __VA_ARGS__) +#define LOGI(c, fmt, ...) logs(LOG_INFO, c, fmt, __VA_ARGS__) +#define LOGD(c, fmt, ...) logs(LOG_DEBUG, c, fmt, __VA_ARGS__) + struct vhost { const char *domain; const char *cert; @@ -118,6 +119,8 @@ enum { }; /* gmid.c */ +__attribute__ ((format (printf, 3, 4))) void logs(int, struct client*, const char*, ...); + void sig_handler(int); int starts_with(const char*, const char*); @@ -149,7 +152,6 @@ void yyerror(const char*); int parse_portno(const char*); void parse_conf(const char*); void load_vhosts(struct tls_config*); -void sandbox(); void usage(const char*); @@ -158,6 +160,9 @@ extern int yylineno; extern int yyparse(void); extern int yylex(void); +/* sandbox.c */ +void sandbox(); + /* utf8.c */ int valid_multibyte_utf8(struct parser*); -- cgit v1.2.3