mirror of
https://github.com/yrutschle/sslh.git
synced 2025-06-11 21:02:18 +03:00
Fix on-timeout setting so it is no longer ignored (issue #253)
This commit is contained in:
parent
bae16ab29e
commit
588883eb42
11
probe.c
11
probe.c
@ -59,8 +59,6 @@ static struct protocol_probe_desc builtins[] = {
|
|||||||
{ "anyprot", is_true }
|
{ "anyprot", is_true }
|
||||||
};
|
};
|
||||||
|
|
||||||
static char* on_timeout = "ssh";
|
|
||||||
|
|
||||||
/* TODO I think this has to go */
|
/* TODO I think this has to go */
|
||||||
struct protocol_probe_desc* get_builtins(void) {
|
struct protocol_probe_desc* get_builtins(void) {
|
||||||
return builtins;
|
return builtins;
|
||||||
@ -70,13 +68,6 @@ int get_num_builtins(void) {
|
|||||||
return ARRAY_SIZE(builtins);
|
return ARRAY_SIZE(builtins);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sets the protocol name to connect to in case of timeout */
|
|
||||||
void set_ontimeout(const char* name)
|
|
||||||
{
|
|
||||||
int res = asprintf(&on_timeout, "%s", name);
|
|
||||||
CHECK_RES_DIE(res, "asprintf");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Returns the protocol to connect to in case of timeout;
|
/* Returns the protocol to connect to in case of timeout;
|
||||||
* if not found, return the first protocol specified
|
* if not found, return the first protocol specified
|
||||||
*/
|
*/
|
||||||
@ -84,7 +75,7 @@ struct sslhcfg_protocols_item* timeout_protocol(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < cfg.protocols_len; i++) {
|
for (i = 0; i < cfg.protocols_len; i++) {
|
||||||
if (!strcmp(cfg.protocols[i].name, on_timeout)) return &cfg.protocols[i];
|
if (!strcmp(cfg.protocols[i].name, cfg.on_timeout)) return &cfg.protocols[i];
|
||||||
}
|
}
|
||||||
return &cfg.protocols[0];
|
return &cfg.protocols[0];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user