mirror of
https://github.com/haproxy/haproxy.git
synced 2026-06-11 01:41:49 -04:00
[MEDIUM] fix configuration sanity checks for TCP listeners
A log chain of if/else prevented many sanity checks from being performed on TCP listeners, resulting in dangerous configs being accepted. Removed the offending 'else'.
This commit is contained in:
parent
19629edd48
commit
7c1ffc1e8f
1 changed files with 13 additions and 7 deletions
|
|
@ -2411,7 +2411,8 @@ int readcfgfile(const char *file)
|
|||
file, proxy_type_str(curproxy), curproxy->id);
|
||||
cfgerr++;
|
||||
}
|
||||
else if ((curproxy->mode != PR_MODE_HEALTH) && (curproxy->options & PR_O_BALANCE)) {
|
||||
|
||||
if ((curproxy->mode != PR_MODE_HEALTH) && (curproxy->options & PR_O_BALANCE)) {
|
||||
if (curproxy->options & PR_O_TRANSP) {
|
||||
Alert("parsing %s : %s '%s' cannot use both transparent and balance mode.\n",
|
||||
file, proxy_type_str(curproxy), curproxy->id);
|
||||
|
|
@ -2429,15 +2430,12 @@ int readcfgfile(const char *file)
|
|||
file, proxy_type_str(curproxy), curproxy->id);
|
||||
}
|
||||
}
|
||||
else if (curproxy->mode == PR_MODE_TCP || curproxy->mode == PR_MODE_HEALTH) { /* TCP PROXY or HEALTH CHECK */
|
||||
|
||||
if (curproxy->mode == PR_MODE_TCP || curproxy->mode == PR_MODE_HEALTH) { /* TCP PROXY or HEALTH CHECK */
|
||||
if (curproxy->cookie_name != NULL) {
|
||||
Warning("parsing %s : cookie will be ignored for %s '%s'.\n",
|
||||
file, proxy_type_str(curproxy), curproxy->id);
|
||||
}
|
||||
if ((newsrv = curproxy->srv) != NULL) {
|
||||
Warning("parsing %s : servers will be ignored for %s '%s'.\n",
|
||||
file, proxy_type_str(curproxy), curproxy->id);
|
||||
}
|
||||
if (curproxy->rsp_exp != NULL) {
|
||||
Warning("parsing %s : server regular expressions will be ignored for %s '%s'.\n",
|
||||
file, proxy_type_str(curproxy), curproxy->id);
|
||||
|
|
@ -2458,7 +2456,15 @@ int readcfgfile(const char *file)
|
|||
file, proxy_type_str(curproxy), curproxy->id);
|
||||
}
|
||||
}
|
||||
else if (curproxy->mode == PR_MODE_HTTP) { /* HTTP PROXY */
|
||||
|
||||
if (curproxy->mode == PR_MODE_HEALTH) { /* TCP PROXY or HEALTH CHECK */
|
||||
if ((newsrv = curproxy->srv) != NULL) {
|
||||
Warning("parsing %s : servers will be ignored for %s '%s'.\n",
|
||||
file, proxy_type_str(curproxy), curproxy->id);
|
||||
}
|
||||
}
|
||||
|
||||
if (curproxy->mode == PR_MODE_HTTP) { /* HTTP PROXY */
|
||||
if ((curproxy->cookie_name != NULL) && ((newsrv = curproxy->srv) == NULL)) {
|
||||
Alert("parsing %s : HTTP proxy %s has a cookie but no server list !\n",
|
||||
file, curproxy->id);
|
||||
|
|
|
|||
Loading…
Reference in a new issue