void-packages/srcpkgs/sslh/patches/backport-fix-for-libconfig-1.7.3.patch

712 lines
25 KiB
Diff

From: yrutschle <git1@rutschle.net>
Date: Wed, 23 Jun 2021 11:48:59 +0200
Subject: fix for libconfig 1.7.3
diff --git a/sslh-conf.c b/sslh-conf.c
index 2fd0eaf..530ef6b 100644
--- a/sslh-conf.c
+++ b/sslh-conf.c
@@ -1,5 +1,5 @@
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
- * on Wed Jul 29 22:51:16 2020.
+ * on Wed Jun 23 11:46:45 2021.
# conf2struct: generate libconf parsers that read to structs
# Copyright (C) 2018-2019 Yves Rutschle
@@ -48,6 +48,18 @@
/* This gets included in the output .c file */
+/* Libconfig 1.4.9 is still used by major distributions
+ * (e.g. CentOS7) and had a different name for
+ * config_setting_lookup */
+#if LIBCONFIG_VER_MAJOR == 1
+#if LIBCONFIG_VER_MINOR == 4
+#if LIBCONFIG_VER_REVISION == 9
+#define config_setting_lookup config_lookup_from
+#endif
+#endif
+#endif
+
+
/* config_type, lookup_fns, type2str are related, keep them together */
typedef enum {
CFG_BOOL,
@@ -114,6 +126,14 @@ typedef int config_t;
return 0; \
}
+enum {
+ CONFIG_TYPE_INT,
+ CONFIG_TYPE_BOOL,
+ CONFIG_TYPE_INT64,
+ CONFIG_TYPE_FLOAT,
+ CONFIG_TYPE_STRING
+};
+
make_config_setting_lookup(bool);
make_config_setting_lookup(int);
make_config_setting_lookup(int64);
@@ -122,10 +142,14 @@ make_config_setting_lookup(string);
make_config_setting_get(bool, int);
make_config_setting_get(int, int);
-make_config_setting_get(int64, int);
+make_config_setting_get(int64, long long int);
make_config_setting_get(float, double);
make_config_setting_get(string, char*);
+config_setting_t* config_root_setting(config_t* c) {
+ return NULL;
+}
+
config_setting_t* config_lookup(config_t* c, const char* b) {
return NULL;
}
@@ -134,10 +158,38 @@ void config_init(config_t* c) {
return;
}
+char* config_setting_name(config_setting_t* c) {
+ return NULL;
+}
+
+int config_setting_is_list(config_setting_t* c) {
+ return 0;
+}
+
+int config_setting_is_array(config_setting_t* c) {
+ return 0;
+}
+
+int config_setting_is_scalar(config_setting_t* c) {
+ return 0;
+}
+
+int config_setting_index(const config_setting_t *setting) {
+ return 0;
+}
+
config_setting_t* config_setting_lookup(config_setting_t* a, char* b) {
return NULL;
}
+int config_setting_remove(config_setting_t* cfg, char* name) {
+ return 0;
+}
+
+int config_setting_type(config_setting_t* s) {
+ return -1;
+}
+
int config_setting_length(config_setting_t* a) {
return 0;
}
@@ -159,13 +211,30 @@ char* config_error_text(config_t* c) {
}
#endif
+/* This is the same as config_setting_lookup_string() except
+it allocates a new string which belongs to the caller */
+static int myconfig_setting_lookup_stringcpy(
+ const config_setting_t* setting,
+ const char* name,
+ char** value)
+{
+ const char* str;
+ *value = NULL;
+ if (config_setting_lookup_string(setting, name, &str) == CONFIG_TRUE) {
+ asprintf(value, "%s", str);
+ return CONFIG_TRUE;
+ } else {
+ return CONFIG_FALSE;
+ }
+}
+
typedef int (*lookup_fn)(const config_setting_t*, const char*, void*);
lookup_fn lookup_fns[] = {
(lookup_fn)config_setting_lookup_bool,
(lookup_fn)config_setting_lookup_int,
(lookup_fn)config_setting_lookup_int64,
(lookup_fn)config_setting_lookup_float,
- (lookup_fn)config_setting_lookup_string,
+ (lookup_fn)myconfig_setting_lookup_stringcpy,
NULL, /* CFG_GROUP */
NULL, /* CFG_ARRAY */
NULL, /* CFG_LIST */
@@ -380,6 +449,7 @@ struct arg_file* sslhcfg_conffile;
struct arg_str* sslhcfg_chroot;
struct arg_str* sslhcfg_syslog_facility;
struct arg_str* sslhcfg_on_timeout;
+ struct arg_str* sslhcfg_prefix;
struct arg_str* sslhcfg_listen;
struct arg_str* sslhcfg_ssh;
struct arg_str* sslhcfg_tls;
@@ -392,7 +462,7 @@ struct arg_file* sslhcfg_conffile;
struct arg_str* sslhcfg_anyprot;
struct arg_end* sslhcfg_end;
-
+
static struct config_desc table_sslhcfg_protocols[] = {
@@ -460,6 +530,22 @@ static struct config_desc table_sslhcfg_protocols[] = {
/* default_val*/ .default_val.def_string = NULL
},
+ {
+ /* name */ "is_udp",
+ /* type */ CFG_BOOL,
+ /* sub_group*/ NULL,
+ /* arg_cl */ NULL,
+ /* base_addr */ NULL,
+ /* offset */ offsetof(struct sslhcfg_protocols_item, is_udp),
+ /* offset_len */ 0,
+ /* offset_present */ 0,
+ /* size */ sizeof(int),
+ /* array_type */ -1,
+ /* mandatory */ 0,
+ /* optional */ 0,
+ /* default_val*/ .default_val.def_bool = 0
+ },
+
{
/* name */ "fork",
/* type */ CFG_BOOL,
@@ -492,6 +578,22 @@ static struct config_desc table_sslhcfg_protocols[] = {
/* default_val*/ .default_val.def_bool = 0
},
+ {
+ /* name */ "transparent",
+ /* type */ CFG_BOOL,
+ /* sub_group*/ NULL,
+ /* arg_cl */ NULL,
+ /* base_addr */ NULL,
+ /* offset */ offsetof(struct sslhcfg_protocols_item, transparent),
+ /* offset_len */ 0,
+ /* offset_present */ 0,
+ /* size */ sizeof(int),
+ /* array_type */ -1,
+ /* mandatory */ 0,
+ /* optional */ 0,
+ /* default_val*/ .default_val.def_bool = 0
+ },
+
{
/* name */ "log_level",
/* type */ CFG_INT,
@@ -589,7 +691,7 @@ static struct config_desc table_sslhcfg_protocols[] = {
},
{ 0 }
};
-
+
static struct config_desc table_sslhcfg_listen[] = {
@@ -625,6 +727,22 @@ static struct config_desc table_sslhcfg_listen[] = {
/* default_val*/ .default_val.def_string = NULL
},
+ {
+ /* name */ "is_udp",
+ /* type */ CFG_BOOL,
+ /* sub_group*/ NULL,
+ /* arg_cl */ NULL,
+ /* base_addr */ NULL,
+ /* offset */ offsetof(struct sslhcfg_listen_item, is_udp),
+ /* offset_len */ 0,
+ /* offset_present */ 0,
+ /* size */ sizeof(int),
+ /* array_type */ -1,
+ /* mandatory */ 0,
+ /* optional */ 0,
+ /* default_val*/ .default_val.def_bool = 0
+ },
+
{
/* name */ "keepalive",
/* type */ CFG_BOOL,
@@ -642,7 +760,7 @@ static struct config_desc table_sslhcfg_listen[] = {
},
{ 0 }
};
-
+
static struct config_desc table_sslhcfg[] = {
@@ -822,6 +940,22 @@ static struct config_desc table_sslhcfg[] = {
/* default_val*/ .default_val.def_string = "ssh"
},
+ {
+ /* name */ "prefix",
+ /* type */ CFG_STRING,
+ /* sub_group*/ NULL,
+ /* arg_cl */ & sslhcfg_prefix,
+ /* base_addr */ NULL,
+ /* offset */ offsetof(struct sslhcfg_item, prefix),
+ /* offset_len */ 0,
+ /* offset_present */ 0,
+ /* size */ sizeof(char*),
+ /* array_type */ -1,
+ /* mandatory */ 0,
+ /* optional */ 0,
+ /* default_val*/ .default_val.def_string = ""
+ },
+
{
/* name */ "listen",
/* type */ CFG_LIST,
@@ -859,7 +993,7 @@ static struct compound_cl_target sslhcfg_anyprot_targets [] = {
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "anyprot" },
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
- { & table_sslhcfg_protocols[6], 0, .value.def_int = 1 },
+ { & table_sslhcfg_protocols[8], 0, .value.def_int = 1 },
{ 0 }
};
@@ -867,7 +1001,7 @@ static struct compound_cl_target sslhcfg_socks5_targets [] = {
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "socks5" },
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
- { & table_sslhcfg_protocols[6], 0, .value.def_int = 1 },
+ { & table_sslhcfg_protocols[8], 0, .value.def_int = 1 },
{ 0 }
};
@@ -875,7 +1009,7 @@ static struct compound_cl_target sslhcfg_adb_targets [] = {
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "adb" },
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
- { & table_sslhcfg_protocols[6], 0, .value.def_int = 1 },
+ { & table_sslhcfg_protocols[8], 0, .value.def_int = 1 },
{ 0 }
};
@@ -883,7 +1017,7 @@ static struct compound_cl_target sslhcfg_http_targets [] = {
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "http" },
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
- { & table_sslhcfg_protocols[6], 0, .value.def_int = 1 },
+ { & table_sslhcfg_protocols[8], 0, .value.def_int = 1 },
{ 0 }
};
@@ -891,7 +1025,7 @@ static struct compound_cl_target sslhcfg_xmpp_targets [] = {
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "xmpp" },
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
- { & table_sslhcfg_protocols[6], 0, .value.def_int = 1 },
+ { & table_sslhcfg_protocols[8], 0, .value.def_int = 1 },
{ 0 }
};
@@ -899,8 +1033,8 @@ static struct compound_cl_target sslhcfg_tinc_targets [] = {
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "tinc" },
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
- { & table_sslhcfg_protocols[6], 0, .value.def_int = 1 },
- { & table_sslhcfg_protocols[5], 0, .value.def_bool = 1 },
+ { & table_sslhcfg_protocols[8], 0, .value.def_int = 1 },
+ { & table_sslhcfg_protocols[6], 0, .value.def_bool = 1 },
{ 0 }
};
@@ -908,8 +1042,8 @@ static struct compound_cl_target sslhcfg_openvpn_targets [] = {
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "openvpn" },
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
- { & table_sslhcfg_protocols[6], 0, .value.def_int = 1 },
- { & table_sslhcfg_protocols[5], 0, .value.def_bool = 1 },
+ { & table_sslhcfg_protocols[8], 0, .value.def_int = 1 },
+ { & table_sslhcfg_protocols[6], 0, .value.def_bool = 1 },
{ 0 }
};
@@ -917,8 +1051,8 @@ static struct compound_cl_target sslhcfg_tls_targets [] = {
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "tls" },
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
- { & table_sslhcfg_protocols[6], 0, .value.def_int = 1 },
- { & table_sslhcfg_protocols[5], 0, .value.def_bool = 1 },
+ { & table_sslhcfg_protocols[8], 0, .value.def_int = 1 },
+ { & table_sslhcfg_protocols[6], 0, .value.def_bool = 1 },
{ 0 }
};
@@ -926,9 +1060,9 @@ static struct compound_cl_target sslhcfg_ssh_targets [] = {
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "ssh" },
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
- { & table_sslhcfg_protocols[4], 0, .value.def_bool = 1 },
- { & table_sslhcfg_protocols[6], 0, .value.def_int = 1 },
{ & table_sslhcfg_protocols[5], 0, .value.def_bool = 1 },
+ { & table_sslhcfg_protocols[8], 0, .value.def_int = 1 },
+ { & table_sslhcfg_protocols[6], 0, .value.def_bool = 1 },
{ 0 }
};
@@ -942,7 +1076,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: listen */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_listen,
- .base_entry = & table_sslhcfg [11],
+ .base_entry = & table_sslhcfg [12],
.targets = sslhcfg_listen_targets,
@@ -954,7 +1088,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: ssh */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_ssh,
- .base_entry = & table_sslhcfg [12],
+ .base_entry = & table_sslhcfg [13],
.targets = sslhcfg_ssh_targets,
@@ -966,7 +1100,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: tls */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_tls,
- .base_entry = & table_sslhcfg [12],
+ .base_entry = & table_sslhcfg [13],
.targets = sslhcfg_tls_targets,
@@ -978,7 +1112,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: openvpn */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_openvpn,
- .base_entry = & table_sslhcfg [12],
+ .base_entry = & table_sslhcfg [13],
.targets = sslhcfg_openvpn_targets,
@@ -990,7 +1124,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: tinc */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_tinc,
- .base_entry = & table_sslhcfg [12],
+ .base_entry = & table_sslhcfg [13],
.targets = sslhcfg_tinc_targets,
@@ -1002,7 +1136,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: xmpp */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_xmpp,
- .base_entry = & table_sslhcfg [12],
+ .base_entry = & table_sslhcfg [13],
.targets = sslhcfg_xmpp_targets,
@@ -1014,7 +1148,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: http */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_http,
- .base_entry = & table_sslhcfg [12],
+ .base_entry = & table_sslhcfg [13],
.targets = sslhcfg_http_targets,
@@ -1026,7 +1160,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: adb */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_adb,
- .base_entry = & table_sslhcfg [12],
+ .base_entry = & table_sslhcfg [13],
.targets = sslhcfg_adb_targets,
@@ -1038,7 +1172,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: socks5 */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_socks5,
- .base_entry = & table_sslhcfg [12],
+ .base_entry = & table_sslhcfg [13],
.targets = sslhcfg_socks5_targets,
@@ -1050,7 +1184,7 @@ static struct compound_cl_arg compound_cl_args[] = {
{ /* arg: anyprot */
.regex = "(.+):(\\w+)",
.arg_cl = & sslhcfg_anyprot,
- .base_entry = & table_sslhcfg [12],
+ .base_entry = & table_sslhcfg [13],
.targets = sslhcfg_anyprot_targets,
@@ -1108,7 +1242,7 @@ static void print_setting(config_type type, void* val)
/* Changes all dashes to underscores in a string of
* vice-versa */
-void strswap_ud(const char target, char* str)
+static void strswap_ud(const char target, char* str)
{
char* c;
for (c = str; *c; c++)
@@ -1118,7 +1252,7 @@ void strswap_ud(const char target, char* str)
/* Same as config_setting_lookup() but looks up with dash or
* underscore so `my_setting` and `my-setting` match the same */
-config_setting_t* config_setting_lookup_ud(config_setting_t* cfg, struct config_desc* desc)
+static config_setting_t* config_setting_lookup_ud(config_setting_t* cfg, struct config_desc* desc)
{
config_setting_t* setting;
char name[strlen(desc->name)+1];;
@@ -1134,7 +1268,7 @@ config_setting_t* config_setting_lookup_ud(config_setting_t* cfg, struct config_
return setting;
}
-int lookup_typed_ud(config_setting_t* cfg, void* target, struct config_desc *desc)
+static int lookup_typed_ud(config_setting_t* cfg, void* target, struct config_desc *desc)
{
lookup_fn lookup_fn = lookup_fns[desc->type];
char name[strlen(desc->name)+1];;
@@ -1148,6 +1282,22 @@ int lookup_typed_ud(config_setting_t* cfg, void* target, struct config_desc *des
return lookup_fn(cfg, name, ((char*)target) + desc->offset);
}
+/* Removes a setting, trying both underscores and dashes as
+* name (so deleting 'my-setting' deletes both 'my_setting'
+* and 'my-setting') */
+static int setting_delete_ud(config_setting_t* cfg, struct config_desc *desc)
+{
+ char name[strlen(desc->name)+1];;
+ strcpy(name, desc->name);
+
+ strswap_ud('_', name);
+ if (config_setting_remove(cfg, name) == CONFIG_TRUE)
+ return CONFIG_TRUE;
+
+ strswap_ud('-', name);
+ return config_setting_remove(cfg, name);
+}
+
/* When traversing configuration, allocate memory for plural
* types, init for scalars */
static void read_block_init(void* target, config_setting_t* cfg, struct config_desc* desc)
@@ -1232,6 +1382,7 @@ static int read_block_setval(void* target,
TRACE_READ(("[%d] = ", i));
print_setting(desc->array_type, (char*)block + desc->size *i); TRACE_READ(("\n"));
}
+ setting_delete_ud(cfg, desc);
}
break;
@@ -1253,6 +1404,7 @@ static int read_block_setval(void* target,
return 0;
}
print_setting(desc->type, (((char*)target) + desc->offset));
+ setting_delete_ud(cfg, desc);
in_cfg = 1;
} else {
TRACE_READ((" not in config file"));
@@ -1544,6 +1696,86 @@ static int c2s_parse_file(const char* filename, config_t* c, char**errmsg)
return 1;
}
+/* Allocates a new string that represents the setting value, which must be a scalar */
+static void scalar_to_string(char** strp, config_setting_t* s)
+{
+ switch(config_setting_type(s)) {
+ case CONFIG_TYPE_INT:
+ asprintf(strp, "%d\n", config_setting_get_int(s));
+ break;
+
+ case CONFIG_TYPE_BOOL:
+ asprintf(strp, "%s\n", config_setting_get_bool(s) ? "[true]" : "[false]" );
+ break;
+
+ case CONFIG_TYPE_INT64:
+ asprintf(strp, "%lld\n", config_setting_get_int64(s));
+ break;
+
+ case CONFIG_TYPE_FLOAT:
+ asprintf(strp, "%lf\n", config_setting_get_float(s));
+ break;
+
+ case CONFIG_TYPE_STRING:
+ asprintf(strp, "%s\n", config_setting_get_string(s));
+ break;
+
+ default: /* This means a bug */
+ fprintf(stderr, "Unexpected type %d\n", config_setting_type(s));
+ exit(1);
+ }
+}
+
+/* Typesets all the settings in a configuration as a
+* newly-allocated string. The string management is caller's
+* responsability.
+* Returns the number of scalars in the configuration */
+static int cfg_as_string(config_setting_t* parent, const char* path, char** strp)
+{
+ int i, len, res = 0;
+ config_setting_t* child;
+ char* subpath, *value, *old;
+ const char* name;
+
+ len = config_setting_length(parent);
+ for (i = 0; i < len; i++) {
+ child = config_setting_get_elem(parent, i);
+ name = config_setting_name(child);
+ if (!name) name = "";
+
+ if(config_setting_is_list(parent) ||
+ config_setting_is_array(parent)) {
+ asprintf(&subpath, "%s[%d]%s", path, config_setting_index(child), name);
+ } else {
+ asprintf(&subpath, "%s/%s", path, name);
+ }
+
+ if (config_setting_is_scalar(child)) {
+ scalar_to_string(&value, child);
+
+ /* Add value to the output string */
+ if (*strp) {
+ asprintf(&old, "%s", *strp);
+ free(*strp);
+ } else {
+ asprintf(&old, "%s", "");
+ }
+ asprintf(strp, "%s%s:%s", old, subpath, value);
+ free(value);
+ free(old);
+
+ res++; /* At least one scalar was found */
+ } else {
+ /* It's an aggregate -- descend into it */
+ res += cfg_as_string(child, subpath, strp);
+ }
+
+ free(subpath);
+ }
+ return res;
+}
+
+
/* 0: success
<0: error */
int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
@@ -1567,6 +1799,7 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
sslhcfg_chroot = arg_strn("C", "chroot", "<path>", 0, 1, "Root to change to after set-up"),
sslhcfg_syslog_facility = arg_strn(NULL, "syslog-facility", "<str>", 0, 1, "Facility to syslog to"),
sslhcfg_on_timeout = arg_strn(NULL, "on-timeout", "<str>", 0, 1, "Target to connect to when timing out"),
+ sslhcfg_prefix = arg_strn(NULL, "prefix", "<str>", 0, 1, "Reserved for testing"),
sslhcfg_listen = arg_strn("p", "listen", "<host:port>", 0, 10, "Listen on host:port"),
sslhcfg_ssh = arg_strn(NULL, "ssh", "<host:port>", 0, 10, "Set up ssh target"),
sslhcfg_tls = arg_strn(NULL, "tls", "<host:port>", 0, 10, "Set up TLS/SSL target"),
@@ -1592,14 +1825,14 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
config_init(&c);
- if (sslhcfg_conffile->count) {
+ if (sslhcfg_conffile && sslhcfg_conffile->count) {
if (!c2s_parse_file(sslhcfg_conffile->filename[0], &c, &errmsg)) {
fprintf(stderr, "%s\n", errmsg);
return -1;
}
}
- s = config_lookup(&c, "/");
+ s = config_root_setting(&c);
res = read_block(s, cfg, table_sslhcfg, &errmsg);
if (!res) {
@@ -1613,6 +1846,11 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
return -1;
}
+ errmsg = NULL;
+ res = cfg_as_string(s, "", &errmsg);
+ if (res)
+ fprintf(stderr, "Unknown settings:\n%s\n", errmsg);
+
return 0;
}
@@ -1645,12 +1883,18 @@ static void sslhcfg_protocols_fprint(
fprintf(out, " <unset>");
fprintf(out, "\n");
indent(out, depth);
+ fprintf(out, "is_udp: %d", sslhcfg_protocols->is_udp);
+ fprintf(out, "\n");
+ indent(out, depth);
fprintf(out, "fork: %d", sslhcfg_protocols->fork);
fprintf(out, "\n");
indent(out, depth);
fprintf(out, "tfo_ok: %d", sslhcfg_protocols->tfo_ok);
fprintf(out, "\n");
indent(out, depth);
+ fprintf(out, "transparent: %d", sslhcfg_protocols->transparent);
+ fprintf(out, "\n");
+ indent(out, depth);
fprintf(out, "log_level: %d", sslhcfg_protocols->log_level);
fprintf(out, "\n");
indent(out, depth);
@@ -1694,6 +1938,9 @@ static void sslhcfg_listen_fprint(
fprintf(out, "port: %s", sslhcfg_listen->port);
fprintf(out, "\n");
indent(out, depth);
+ fprintf(out, "is_udp: %d", sslhcfg_listen->is_udp);
+ fprintf(out, "\n");
+ indent(out, depth);
fprintf(out, "keepalive: %d", sslhcfg_listen->keepalive);
fprintf(out, "\n");
}
@@ -1743,6 +1990,9 @@ void sslhcfg_fprint(
indent(out, depth);
fprintf(out, "on_timeout: %s", sslhcfg->on_timeout);
fprintf(out, "\n");
+ indent(out, depth);
+ fprintf(out, "prefix: %s", sslhcfg->prefix);
+ fprintf(out, "\n");
indent(out, depth);
fprintf(out, "listen [%zu]:\n", sslhcfg->listen_len);
diff --git a/sslh-conf.h b/sslh-conf.h
index 9f48cf7..fbcc1c6 100644
--- a/sslh-conf.h
+++ b/sslh-conf.h
@@ -1,5 +1,5 @@
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
- * on Wed Jul 29 22:51:16 2020.
+ * on Wed Jun 23 11:46:45 2021.
# conf2struct: generate libconf parsers that read to structs
# Copyright (C) 2018-2019 Yves Rutschle
@@ -43,6 +43,7 @@
struct sslhcfg_listen_item {
char* host;
char* port;
+ int is_udp;
int keepalive;
};
@@ -52,8 +53,10 @@ struct sslhcfg_protocols_item {
char* port;
int service_is_present;
char* service;
+ int is_udp;
int fork;
int tfo_ok;
+ int transparent;
int log_level;
int keepalive;
size_t sni_hostnames_len;
@@ -84,6 +87,7 @@ struct sslhcfg_item {
char* chroot;
char* syslog_facility;
char* on_timeout;
+ char* prefix;
size_t listen_len;
struct sslhcfg_listen_item* listen;
size_t protocols_len;
diff --git a/sslh-fork.c b/sslh-fork.c