aboutsummaryrefslogtreecommitdiff
path: root/gmid.h
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-01-15 14:03:45 +0000
committerOmar Polo <op@omarpolo.com>2021-01-15 14:03:45 +0000
commitdafb57b8af432d800219a8e17900e1ac56a65c14 (patch)
tree760771377723b628d83914a5946805ab86cb14b5 /gmid.h
parent4ad11931ec10c823e98b7c51efc7146d8cbdd012 (diff)
sandbox also on FreeBSD with capsicum
Diffstat (limited to 'gmid.h')
-rw-r--r--gmid.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/gmid.h b/gmid.h
index cbf9da3..3477cfe 100644
--- a/gmid.h
+++ b/gmid.h
@@ -28,11 +28,6 @@
#include <tls.h>
#include <unistd.h>
-#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*);