mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-25 04:17:42 +00:00
CLEANUP: Compare the return value of XXXcmp()
functions with zero
According to coding-style.txt it is recommended to use: `strcmp(a, b) == 0` instead of `!strcmp(a, b)` So let's do this. The change was performed by running the following (very long) coccinelle patch on src/: @@ statement S; expression E; expression F; @@ if ( ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) != 0 ) ( S | { ... } ) @@ statement S; expression E; expression F; @@ if ( - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 ) ( S | { ... } ) @@ expression E; expression F; expression G; @@ ( G && ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) != 0 ) @@ expression E; expression F; expression G; @@ ( G || ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) != 0 ) @@ expression E; expression F; expression G; @@ ( ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) != 0 && G ) @@ expression E; expression F; expression G; @@ ( ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) != 0 || G ) @@ expression E; expression F; expression G; @@ ( G && - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 ) @@ expression E; expression F; expression G; @@ ( G || - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 ) @@ expression E; expression F; expression G; @@ ( - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 && G ) @@ expression E; expression F; expression G; @@ ( - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 || G ) @@ expression E; expression F; expression G; @@ ( - ! ( dns_hostname_cmp | eb_memcmp | memcmp | strcasecmp | strcmp | strncasecmp | strncmp ) - (E, F) + (E, F) == 0 )
This commit is contained in:
parent
f89d43a381
commit
e5ff14100a
@ -1026,11 +1026,11 @@ struct acl_cond *build_acl_cond(const char *file, int line, struct list *known_a
|
||||
if (err)
|
||||
*err = NULL;
|
||||
|
||||
if (!strcmp(*args, "if")) {
|
||||
if (strcmp(*args, "if") == 0) {
|
||||
pol = ACL_COND_IF;
|
||||
args++;
|
||||
}
|
||||
else if (!strcmp(*args, "unless")) {
|
||||
else if (strcmp(*args, "unless") == 0) {
|
||||
pol = ACL_COND_UNLESS;
|
||||
args++;
|
||||
}
|
||||
@ -1229,7 +1229,7 @@ int acl_find_targets(struct proxy *p)
|
||||
|
||||
list_for_each_entry(acl, &p->acl, list) {
|
||||
list_for_each_entry(expr, &acl->expr, list) {
|
||||
if (!strcmp(expr->kw, "http_auth_group")) {
|
||||
if (strcmp(expr->kw, "http_auth_group") == 0) {
|
||||
/* Note: the ARGT_USR argument may only have been resolved earlier
|
||||
* by smp_resolve_args().
|
||||
*/
|
||||
|
@ -165,10 +165,10 @@ int cfg_parse_rule_set_timeout(const char **args, int idx, int *out_timeout,
|
||||
const char *res;
|
||||
const char *timeout_name = args[idx++];
|
||||
|
||||
if (!strcmp(timeout_name, "server")) {
|
||||
if (strcmp(timeout_name, "server") == 0) {
|
||||
*name = ACT_TIMEOUT_SERVER;
|
||||
}
|
||||
else if (!strcmp(timeout_name, "tunnel")) {
|
||||
else if (strcmp(timeout_name, "tunnel") == 0) {
|
||||
*name = ACT_TIMEOUT_TUNNEL;
|
||||
}
|
||||
else {
|
||||
|
@ -61,7 +61,7 @@ auth_find_userlist(char *name)
|
||||
return NULL;
|
||||
|
||||
for (l = userlist; l; l = l->next)
|
||||
if (!strcmp(l->name, name))
|
||||
if (strcmp(l->name, name) == 0)
|
||||
return l;
|
||||
|
||||
return NULL;
|
||||
@ -139,7 +139,7 @@ int userlist_postinit()
|
||||
|
||||
while ((group = strtok(group?NULL:curuser->u.groups_names, ","))) {
|
||||
for (ag = curuserlist->groups; ag; ag = ag->next) {
|
||||
if (!strcmp(ag->name, group))
|
||||
if (strcmp(ag->name, group) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ int userlist_postinit()
|
||||
|
||||
while ((user = strtok(user?NULL:ag->groupusers, ","))) {
|
||||
for (curuser = curuserlist->users; curuser; curuser = curuser->next) {
|
||||
if (!strcmp(curuser->user, user))
|
||||
if (strcmp(curuser->user, user) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
@ -241,7 +241,7 @@ check_user(struct userlist *ul, const char *user, const char *pass)
|
||||
#endif
|
||||
|
||||
for (u = ul->users; u; u = u->next)
|
||||
if (!strcmp(user, u->user))
|
||||
if (strcmp(user, u->user) == 0)
|
||||
break;
|
||||
|
||||
if (!u)
|
||||
|
@ -2376,19 +2376,19 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strcmp(args[0], "roundrobin")) {
|
||||
if (strcmp(args[0], "roundrobin") == 0) {
|
||||
curproxy->lbprm.algo &= ~BE_LB_ALGO;
|
||||
curproxy->lbprm.algo |= BE_LB_ALGO_RR;
|
||||
}
|
||||
else if (!strcmp(args[0], "static-rr")) {
|
||||
else if (strcmp(args[0], "static-rr") == 0) {
|
||||
curproxy->lbprm.algo &= ~BE_LB_ALGO;
|
||||
curproxy->lbprm.algo |= BE_LB_ALGO_SRR;
|
||||
}
|
||||
else if (!strcmp(args[0], "first")) {
|
||||
else if (strcmp(args[0], "first") == 0) {
|
||||
curproxy->lbprm.algo &= ~BE_LB_ALGO;
|
||||
curproxy->lbprm.algo |= BE_LB_ALGO_FAS;
|
||||
}
|
||||
else if (!strcmp(args[0], "leastconn")) {
|
||||
else if (strcmp(args[0], "leastconn") == 0) {
|
||||
curproxy->lbprm.algo &= ~BE_LB_ALGO;
|
||||
curproxy->lbprm.algo |= BE_LB_ALGO_LC;
|
||||
}
|
||||
@ -2418,11 +2418,11 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "source")) {
|
||||
else if (strcmp(args[0], "source") == 0) {
|
||||
curproxy->lbprm.algo &= ~BE_LB_ALGO;
|
||||
curproxy->lbprm.algo |= BE_LB_ALGO_SH;
|
||||
}
|
||||
else if (!strcmp(args[0], "uri")) {
|
||||
else if (strcmp(args[0], "uri") == 0) {
|
||||
int arg = 1;
|
||||
|
||||
curproxy->lbprm.algo &= ~BE_LB_ALGO;
|
||||
@ -2432,7 +2432,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
|
||||
curproxy->lbprm.arg_opt3 = 0; // "depth"
|
||||
|
||||
while (*args[arg]) {
|
||||
if (!strcmp(args[arg], "len")) {
|
||||
if (strcmp(args[arg], "len") == 0) {
|
||||
if (!*args[arg+1] || (atoi(args[arg+1]) <= 0)) {
|
||||
memprintf(err, "%s : '%s' expects a positive integer (got '%s').", args[0], args[arg], args[arg+1]);
|
||||
return -1;
|
||||
@ -2440,7 +2440,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
|
||||
curproxy->lbprm.arg_opt2 = atoi(args[arg+1]);
|
||||
arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[arg], "depth")) {
|
||||
else if (strcmp(args[arg], "depth") == 0) {
|
||||
if (!*args[arg+1] || (atoi(args[arg+1]) <= 0)) {
|
||||
memprintf(err, "%s : '%s' expects a positive integer (got '%s').", args[0], args[arg], args[arg+1]);
|
||||
return -1;
|
||||
@ -2451,11 +2451,11 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
|
||||
curproxy->lbprm.arg_opt3 = atoi(args[arg+1]) + 1;
|
||||
arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[arg], "whole")) {
|
||||
else if (strcmp(args[arg], "whole") == 0) {
|
||||
curproxy->lbprm.arg_opt1 |= 1;
|
||||
arg += 1;
|
||||
}
|
||||
else if (!strcmp(args[arg], "path-only")) {
|
||||
else if (strcmp(args[arg], "path-only") == 0) {
|
||||
curproxy->lbprm.arg_opt1 |= 2;
|
||||
arg += 1;
|
||||
}
|
||||
@ -2465,7 +2465,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "url_param")) {
|
||||
else if (strcmp(args[0], "url_param") == 0) {
|
||||
if (!*args[1]) {
|
||||
memprintf(err, "%s requires an URL parameter name.", args[0]);
|
||||
return -1;
|
||||
@ -2477,7 +2477,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
|
||||
curproxy->lbprm.arg_str = strdup(args[1]);
|
||||
curproxy->lbprm.arg_len = strlen(args[1]);
|
||||
if (*args[2]) {
|
||||
if (strcmp(args[2], "check_post")) {
|
||||
if (strcmp(args[2], "check_post") != 0) {
|
||||
memprintf(err, "%s only accepts 'check_post' modifier (got '%s').", args[0], args[2]);
|
||||
return -1;
|
||||
}
|
||||
@ -2503,7 +2503,7 @@ int backend_parse_balance(const char **args, char **err, struct proxy *curproxy)
|
||||
curproxy->lbprm.arg_opt1 = 0;
|
||||
|
||||
if (*args[1]) {
|
||||
if (strcmp(args[1], "use_domain_only")) {
|
||||
if (strcmp(args[1], "use_domain_only") != 0) {
|
||||
memprintf(err, "%s only accepts 'use_domain_only' modifier (got '%s').", args[0], args[1]);
|
||||
return -1;
|
||||
}
|
||||
|
@ -451,7 +451,7 @@ cache_store_check(struct proxy *px, struct flt_conf *fconf)
|
||||
* post_check.
|
||||
*/
|
||||
list_for_each_entry(cache, &caches_config, list) {
|
||||
if (!strcmp(cache->id, cconf->c.name))
|
||||
if (strcmp(cache->id, cconf->c.name) == 0)
|
||||
goto found;
|
||||
}
|
||||
|
||||
@ -1555,7 +1555,7 @@ static int parse_cache_rule(struct proxy *proxy, const char *name, struct act_ru
|
||||
list_for_each_entry(fconf, &proxy->filter_configs, list) {
|
||||
if (fconf->id == cache_store_flt_id) {
|
||||
cconf = fconf->conf;
|
||||
if (cconf && !strcmp((char *)cconf->c.name, name)) {
|
||||
if (cconf && strcmp((char *)cconf->c.name, name) == 0) {
|
||||
rule->arg.act.p[0] = cconf;
|
||||
return 1;
|
||||
}
|
||||
@ -2111,7 +2111,7 @@ int post_check_cache()
|
||||
continue;
|
||||
|
||||
cconf = fconf->conf;
|
||||
if (!strcmp(cache->id, cconf->c.name)) {
|
||||
if (strcmp(cache->id, cconf->c.name) == 0) {
|
||||
free(cconf->c.name);
|
||||
cconf->flags |= CACHE_FLT_INIT;
|
||||
cconf->c.cache = cache;
|
||||
@ -2545,7 +2545,7 @@ parse_cache_flt(char **args, int *cur_arg, struct proxy *px,
|
||||
continue;
|
||||
|
||||
cconf = f->conf;
|
||||
if (strcmp(name, cconf->c.name)) {
|
||||
if (strcmp(name, cconf->c.name) != 0) {
|
||||
cconf = NULL;
|
||||
continue;
|
||||
}
|
||||
|
@ -34,21 +34,21 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
int err_code = 0;
|
||||
char *errmsg = NULL;
|
||||
|
||||
if (!strcmp(args[0], "global")) { /* new section */
|
||||
if (strcmp(args[0], "global") == 0) { /* new section */
|
||||
/* no option, nothing special to do */
|
||||
alertif_too_many_args(0, file, linenum, args, &err_code);
|
||||
goto out;
|
||||
}
|
||||
else if (!strcmp(args[0], "daemon")) {
|
||||
else if (strcmp(args[0], "daemon") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.mode |= MODE_DAEMON;
|
||||
}
|
||||
else if (!strcmp(args[0], "master-worker")) {
|
||||
else if (strcmp(args[0], "master-worker") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*args[1]) {
|
||||
if (!strcmp(args[1], "no-exit-on-failure")) {
|
||||
if (strcmp(args[1], "no-exit-on-failure") == 0) {
|
||||
global.tune.options |= GTUNE_NOEXIT_ONFAILURE;
|
||||
} else {
|
||||
ha_alert("parsing [%s:%d] : '%s' only supports 'no-exit-on-failure' option.\n", file, linenum, args[0]);
|
||||
@ -58,27 +58,27 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.mode |= MODE_MWORKER;
|
||||
}
|
||||
else if (!strcmp(args[0], "noepoll")) {
|
||||
else if (strcmp(args[0], "noepoll") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.tune.options &= ~GTUNE_USE_EPOLL;
|
||||
}
|
||||
else if (!strcmp(args[0], "nokqueue")) {
|
||||
else if (strcmp(args[0], "nokqueue") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.tune.options &= ~GTUNE_USE_KQUEUE;
|
||||
}
|
||||
else if (!strcmp(args[0], "noevports")) {
|
||||
else if (strcmp(args[0], "noevports") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.tune.options &= ~GTUNE_USE_EVPORTS;
|
||||
}
|
||||
else if (!strcmp(args[0], "nopoll")) {
|
||||
else if (strcmp(args[0], "nopoll") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.tune.options &= ~GTUNE_USE_POLL;
|
||||
}
|
||||
else if (!strcmp(args[0], "busy-polling")) { /* "no busy-polling" or "busy-polling" */
|
||||
else if (strcmp(args[0], "busy-polling") == 0) { /* "no busy-polling" or "busy-polling" */
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == KWM_NO)
|
||||
@ -86,7 +86,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
else
|
||||
global.tune.options |= GTUNE_BUSY_POLLING;
|
||||
}
|
||||
else if (!strcmp(args[0], "set-dumpable")) { /* "no set-dumpable" or "set-dumpable" */
|
||||
else if (strcmp(args[0], "set-dumpable") == 0) { /* "no set-dumpable" or "set-dumpable" */
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == KWM_NO)
|
||||
@ -94,7 +94,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
else
|
||||
global.tune.options |= GTUNE_SET_DUMPABLE;
|
||||
}
|
||||
else if (!strcmp(args[0], "insecure-fork-wanted")) { /* "no insecure-fork-wanted" or "insecure-fork-wanted" */
|
||||
else if (strcmp(args[0], "insecure-fork-wanted") == 0) { /* "no insecure-fork-wanted" or "insecure-fork-wanted" */
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == KWM_NO)
|
||||
@ -102,7 +102,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
else
|
||||
global.tune.options |= GTUNE_INSECURE_FORK;
|
||||
}
|
||||
else if (!strcmp(args[0], "insecure-setuid-wanted")) { /* "no insecure-setuid-wanted" or "insecure-setuid-wanted" */
|
||||
else if (strcmp(args[0], "insecure-setuid-wanted") == 0) { /* "no insecure-setuid-wanted" or "insecure-setuid-wanted" */
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == KWM_NO)
|
||||
@ -110,32 +110,32 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
else
|
||||
global.tune.options |= GTUNE_INSECURE_SETUID;
|
||||
}
|
||||
else if (!strcmp(args[0], "nosplice")) {
|
||||
else if (strcmp(args[0], "nosplice") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.tune.options &= ~GTUNE_USE_SPLICE;
|
||||
}
|
||||
else if (!strcmp(args[0], "nogetaddrinfo")) {
|
||||
else if (strcmp(args[0], "nogetaddrinfo") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.tune.options &= ~GTUNE_USE_GAI;
|
||||
}
|
||||
else if (!strcmp(args[0], "noreuseport")) {
|
||||
else if (strcmp(args[0], "noreuseport") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.tune.options &= ~GTUNE_USE_REUSEPORT;
|
||||
}
|
||||
else if (!strcmp(args[0], "quiet")) {
|
||||
else if (strcmp(args[0], "quiet") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.mode |= MODE_QUIET;
|
||||
}
|
||||
else if (!strcmp(args[0], "zero-warning")) {
|
||||
else if (strcmp(args[0], "zero-warning") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.mode |= MODE_ZERO_WARNING;
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.runqueue-depth")) {
|
||||
else if (strcmp(args[0], "tune.runqueue-depth") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.tune.runqueue_depth != 0) {
|
||||
@ -151,7 +151,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
global.tune.runqueue_depth = atol(args[1]);
|
||||
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.maxpollevents")) {
|
||||
else if (strcmp(args[0], "tune.maxpollevents") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.tune.maxpollevents != 0) {
|
||||
@ -166,7 +166,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.maxpollevents = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.maxaccept")) {
|
||||
else if (strcmp(args[0], "tune.maxaccept") == 0) {
|
||||
long max;
|
||||
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
@ -189,11 +189,11 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.maxaccept = max;
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.chksize")) {
|
||||
else if (strcmp(args[0], "tune.chksize") == 0) {
|
||||
ha_warning("parsing [%s:%d]: the option '%s' is deprecated and will be removed in next version.\n",
|
||||
file, linenum, args[0]);
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.recv_enough")) {
|
||||
else if (strcmp(args[0], "tune.recv_enough") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -203,7 +203,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.recv_enough = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.buffers.limit")) {
|
||||
else if (strcmp(args[0], "tune.buffers.limit") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -219,7 +219,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
global.tune.buf_limit = global.tune.reserved_bufs + 1;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.buffers.reserve")) {
|
||||
else if (strcmp(args[0], "tune.buffers.reserve") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -233,7 +233,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
if (global.tune.buf_limit && global.tune.buf_limit <= global.tune.reserved_bufs)
|
||||
global.tune.buf_limit = global.tune.reserved_bufs + 1;
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.bufsize")) {
|
||||
else if (strcmp(args[0], "tune.bufsize") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -250,7 +250,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.maxrewrite")) {
|
||||
else if (strcmp(args[0], "tune.maxrewrite") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -265,7 +265,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.idletimer")) {
|
||||
else if (strcmp(args[0], "tune.idletimer") == 0) {
|
||||
unsigned int idle;
|
||||
const char *res;
|
||||
|
||||
@ -304,7 +304,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.idle_timer = idle;
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.rcvbuf.client")) {
|
||||
else if (strcmp(args[0], "tune.rcvbuf.client") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.tune.client_rcvbuf != 0) {
|
||||
@ -319,7 +319,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.client_rcvbuf = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.rcvbuf.server")) {
|
||||
else if (strcmp(args[0], "tune.rcvbuf.server") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.tune.server_rcvbuf != 0) {
|
||||
@ -334,7 +334,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.server_rcvbuf = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.sndbuf.client")) {
|
||||
else if (strcmp(args[0], "tune.sndbuf.client") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.tune.client_sndbuf != 0) {
|
||||
@ -349,7 +349,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.client_sndbuf = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.sndbuf.server")) {
|
||||
else if (strcmp(args[0], "tune.sndbuf.server") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.tune.server_sndbuf != 0) {
|
||||
@ -364,7 +364,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.server_sndbuf = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.pipesize")) {
|
||||
else if (strcmp(args[0], "tune.pipesize") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -374,7 +374,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.pipesize = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.http.cookielen")) {
|
||||
else if (strcmp(args[0], "tune.http.cookielen") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -384,7 +384,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.cookie_len = atol(args[1]) + 1;
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.http.logurilen")) {
|
||||
else if (strcmp(args[0], "tune.http.logurilen") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -394,7 +394,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.tune.requri_len = atol(args[1]) + 1;
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.http.maxhdr")) {
|
||||
else if (strcmp(args[0], "tune.http.maxhdr") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -410,7 +410,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.comp.maxlevel")) {
|
||||
else if (strcmp(args[0], "tune.comp.maxlevel") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*args[1]) {
|
||||
@ -428,7 +428,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "tune.pattern.cache-size")) {
|
||||
else if (strcmp(args[0], "tune.pattern.cache-size") == 0) {
|
||||
if (*args[1]) {
|
||||
global.tune.pattern_cache = atoi(args[1]);
|
||||
if (global.tune.pattern_cache < 0) {
|
||||
@ -444,7 +444,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "uid")) {
|
||||
else if (strcmp(args[0], "uid") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.uid != 0) {
|
||||
@ -464,7 +464,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
|
||||
}
|
||||
else if (!strcmp(args[0], "gid")) {
|
||||
else if (strcmp(args[0], "gid") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.gid != 0) {
|
||||
@ -483,13 +483,13 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "external-check")) {
|
||||
else if (strcmp(args[0], "external-check") == 0) {
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
global.external_check = 1;
|
||||
}
|
||||
/* user/group name handling */
|
||||
else if (!strcmp(args[0], "user")) {
|
||||
else if (strcmp(args[0], "user") == 0) {
|
||||
struct passwd *ha_user;
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
@ -508,7 +508,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "group")) {
|
||||
else if (strcmp(args[0], "group") == 0) {
|
||||
struct group *ha_group;
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
@ -528,7 +528,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
}
|
||||
/* end of user/group name handling*/
|
||||
else if (!strcmp(args[0], "nbproc")) {
|
||||
else if (strcmp(args[0], "nbproc") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -545,7 +545,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "nbthread")) {
|
||||
else if (strcmp(args[0], "nbthread") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -561,7 +561,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "maxconn")) {
|
||||
else if (strcmp(args[0], "maxconn") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.maxconn != 0) {
|
||||
@ -583,7 +583,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
#endif /* SYSTEM_MAXCONN */
|
||||
}
|
||||
else if (!strcmp(args[0], "ssl-server-verify")) {
|
||||
else if (strcmp(args[0], "ssl-server-verify") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -601,7 +601,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "maxconnrate")) {
|
||||
else if (strcmp(args[0], "maxconnrate") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.cps_lim != 0) {
|
||||
@ -616,7 +616,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.cps_lim = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "maxsessrate")) {
|
||||
else if (strcmp(args[0], "maxsessrate") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.sps_lim != 0) {
|
||||
@ -631,7 +631,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.sps_lim = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "maxsslrate")) {
|
||||
else if (strcmp(args[0], "maxsslrate") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.ssl_lim != 0) {
|
||||
@ -646,7 +646,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.ssl_lim = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "maxcomprate")) {
|
||||
else if (strcmp(args[0], "maxcomprate") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -656,7 +656,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.comp_rate_lim = atoi(args[1]) * 1024;
|
||||
}
|
||||
else if (!strcmp(args[0], "maxpipes")) {
|
||||
else if (strcmp(args[0], "maxpipes") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.maxpipes != 0) {
|
||||
@ -671,7 +671,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.maxpipes = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "maxzlibmem")) {
|
||||
else if (strcmp(args[0], "maxzlibmem") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -681,7 +681,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.maxzlibmem = atol(args[1]) * 1024L * 1024L;
|
||||
}
|
||||
else if (!strcmp(args[0], "maxcompcpuusage")) {
|
||||
else if (strcmp(args[0], "maxcompcpuusage") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -697,7 +697,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
}
|
||||
|
||||
else if (!strcmp(args[0], "ulimit-n")) {
|
||||
else if (strcmp(args[0], "ulimit-n") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.rlimit_nofile != 0) {
|
||||
@ -712,7 +712,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.rlimit_nofile = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "chroot")) {
|
||||
else if (strcmp(args[0], "chroot") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.chroot != NULL) {
|
||||
@ -727,7 +727,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.chroot = strdup(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "description")) {
|
||||
else if (strcmp(args[0], "description") == 0) {
|
||||
int i, len=0;
|
||||
char *d;
|
||||
|
||||
@ -750,7 +750,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
for (i = 2; *args[i]; i++)
|
||||
d += snprintf(d, global.desc + len - d, " %s", args[i]);
|
||||
}
|
||||
else if (!strcmp(args[0], "node")) {
|
||||
else if (strcmp(args[0], "node") == 0) {
|
||||
int i;
|
||||
char c;
|
||||
|
||||
@ -777,7 +777,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
global.node = strdup(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "pidfile")) {
|
||||
else if (strcmp(args[0], "pidfile") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.pidfile != NULL) {
|
||||
@ -792,10 +792,10 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
global.pidfile = strdup(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "unix-bind")) {
|
||||
else if (strcmp(args[0], "unix-bind") == 0) {
|
||||
int cur_arg = 1;
|
||||
while (*(args[cur_arg])) {
|
||||
if (!strcmp(args[cur_arg], "prefix")) {
|
||||
if (strcmp(args[cur_arg], "prefix") == 0) {
|
||||
if (global.unix_bind.prefix != NULL) {
|
||||
ha_alert("parsing [%s:%d] : unix-bind '%s' already specified. Continuing.\n", file, linenum, args[cur_arg]);
|
||||
err_code |= ERR_ALERT;
|
||||
@ -813,28 +813,28 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(args[cur_arg], "mode")) {
|
||||
if (strcmp(args[cur_arg], "mode") == 0) {
|
||||
|
||||
global.unix_bind.ux.mode = strtol(args[cur_arg + 1], NULL, 8);
|
||||
cur_arg += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(args[cur_arg], "uid")) {
|
||||
if (strcmp(args[cur_arg], "uid") == 0) {
|
||||
|
||||
global.unix_bind.ux.uid = atol(args[cur_arg + 1 ]);
|
||||
cur_arg += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(args[cur_arg], "gid")) {
|
||||
if (strcmp(args[cur_arg], "gid") == 0) {
|
||||
|
||||
global.unix_bind.ux.gid = atol(args[cur_arg + 1 ]);
|
||||
cur_arg += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(args[cur_arg], "user")) {
|
||||
if (strcmp(args[cur_arg], "user") == 0) {
|
||||
struct passwd *user;
|
||||
|
||||
user = getpwnam(args[cur_arg + 1]);
|
||||
@ -850,7 +850,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!strcmp(args[cur_arg], "group")) {
|
||||
if (strcmp(args[cur_arg], "group") == 0) {
|
||||
struct group *group;
|
||||
|
||||
group = getgrnam(args[cur_arg + 1]);
|
||||
@ -872,14 +872,14 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "log")) { /* "no log" or "log ..." */
|
||||
else if (strcmp(args[0], "log") == 0) { /* "no log" or "log ..." */
|
||||
if (!parse_logsrv(args, &global.logsrvs, (kwm == KWM_NO), &errmsg)) {
|
||||
ha_alert("parsing [%s:%d] : %s : %s\n", file, linenum, args[0], errmsg);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "log-send-hostname")) { /* set the hostname in syslog header */
|
||||
else if (strcmp(args[0], "log-send-hostname") == 0) { /* set the hostname in syslog header */
|
||||
char *name;
|
||||
|
||||
if (global.log_send_hostname != NULL) {
|
||||
@ -896,7 +896,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
free(global.log_send_hostname);
|
||||
global.log_send_hostname = strdup(name);
|
||||
}
|
||||
else if (!strcmp(args[0], "server-state-base")) { /* path base where HAProxy can find server state files */
|
||||
else if (strcmp(args[0], "server-state-base") == 0) { /* path base where HAProxy can find server state files */
|
||||
if (global.server_state_base != NULL) {
|
||||
ha_alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
|
||||
err_code |= ERR_ALERT;
|
||||
@ -911,7 +911,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
global.server_state_base = strdup(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "server-state-file")) { /* path to the file where HAProxy can load the server states */
|
||||
else if (strcmp(args[0], "server-state-file") == 0) { /* path to the file where HAProxy can load the server states */
|
||||
if (global.server_state_file != NULL) {
|
||||
ha_alert("parsing [%s:%d] : '%s' already specified. Continuing.\n", file, linenum, args[0]);
|
||||
err_code |= ERR_ALERT;
|
||||
@ -926,7 +926,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
global.server_state_file = strdup(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "log-tag")) { /* tag to report to syslog */
|
||||
else if (strcmp(args[0], "log-tag") == 0) { /* tag to report to syslog */
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (*(args[1]) == 0) {
|
||||
@ -943,7 +943,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "spread-checks")) { /* random time between checks (0-50) */
|
||||
else if (strcmp(args[0], "spread-checks") == 0) { /* random time between checks (0-50) */
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (global.spread_checks != 0) {
|
||||
@ -962,7 +962,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "max-spread-checks")) { /* maximum time between first and last check */
|
||||
else if (strcmp(args[0], "max-spread-checks") == 0) { /* maximum time between first and last check */
|
||||
const char *err;
|
||||
unsigned int val;
|
||||
|
||||
@ -1138,7 +1138,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "unsetenv")) {
|
||||
else if (strcmp(args[0], "unsetenv") == 0) {
|
||||
int arg;
|
||||
|
||||
if (*(args[1]) == 0) {
|
||||
@ -1155,7 +1155,7 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "resetenv")) {
|
||||
else if (strcmp(args[0], "resetenv") == 0) {
|
||||
extern char **environ;
|
||||
char **env = environ;
|
||||
|
||||
@ -1193,13 +1193,13 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm)
|
||||
env++;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "strict-limits")) { /* "no strict-limits" or "strict-limits" */
|
||||
else if (strcmp(args[0], "strict-limits") == 0) { /* "no strict-limits" or "strict-limits" */
|
||||
if (alertif_too_many_args(0, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == KWM_NO)
|
||||
global.tune.options &= ~GTUNE_STRICT_LIMITS;
|
||||
}
|
||||
else if (!strcmp(args[0], "localpeer")) {
|
||||
else if (strcmp(args[0], "localpeer") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -468,29 +468,29 @@ static int ssl_parse_global_extra_files(char **args, int section_type, struct pr
|
||||
|
||||
for (i = 1; *args[i]; i++) {
|
||||
|
||||
if (!strcmp("bundle", args[i])) {
|
||||
if (strcmp("bundle", args[i]) == 0) {
|
||||
gf |= SSL_GF_BUNDLE;
|
||||
|
||||
} else if (!strcmp("sctl", args[i])) {
|
||||
} else if (strcmp("sctl", args[i]) == 0) {
|
||||
gf |= SSL_GF_SCTL;
|
||||
|
||||
} else if (!strcmp("ocsp", args[i])){
|
||||
} else if (strcmp("ocsp", args[i]) == 0){
|
||||
gf |= SSL_GF_OCSP;
|
||||
|
||||
} else if (!strcmp("issuer", args[i])){
|
||||
} else if (strcmp("issuer", args[i]) == 0){
|
||||
gf |= SSL_GF_OCSP_ISSUER;
|
||||
|
||||
} else if (!strcmp("key", args[i])) {
|
||||
} else if (strcmp("key", args[i]) == 0) {
|
||||
gf |= SSL_GF_KEY;
|
||||
|
||||
} else if (!strcmp("none", args[i])) {
|
||||
} else if (strcmp("none", args[i]) == 0) {
|
||||
if (gf != SSL_GF_NONE)
|
||||
goto err_alone;
|
||||
gf = SSL_GF_NONE;
|
||||
i++;
|
||||
break;
|
||||
|
||||
} else if (!strcmp("all", args[i])) {
|
||||
} else if (strcmp("all", args[i]) == 0) {
|
||||
if (gf != SSL_GF_NONE)
|
||||
goto err_alone;
|
||||
gf = SSL_GF_ALL;
|
||||
@ -790,15 +790,15 @@ static int parse_tls_method_options(char *arg, struct tls_version_filter *method
|
||||
if (!p)
|
||||
goto fail;
|
||||
p++;
|
||||
if (!strcmp(p, "sslv3"))
|
||||
if (strcmp(p, "sslv3") == 0)
|
||||
v = CONF_SSLV3;
|
||||
else if (!strcmp(p, "tlsv10"))
|
||||
else if (strcmp(p, "tlsv10") == 0)
|
||||
v = CONF_TLSV10;
|
||||
else if (!strcmp(p, "tlsv11"))
|
||||
else if (strcmp(p, "tlsv11") == 0)
|
||||
v = CONF_TLSV11;
|
||||
else if (!strcmp(p, "tlsv12"))
|
||||
else if (strcmp(p, "tlsv12") == 0)
|
||||
v = CONF_TLSV12;
|
||||
else if (!strcmp(p, "tlsv13"))
|
||||
else if (strcmp(p, "tlsv13") == 0)
|
||||
v = CONF_TLSV13;
|
||||
else
|
||||
goto fail;
|
||||
@ -834,15 +834,15 @@ static int parse_tls_method_minmax(char **args, int cur_arg, struct tls_version_
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
for (i = CONF_TLSV_MIN; i <= CONF_TLSV_MAX; i++)
|
||||
if (!strcmp(argv, methodVersions[i].name))
|
||||
if (strcmp(argv, methodVersions[i].name) == 0)
|
||||
v = i;
|
||||
if (!v) {
|
||||
memprintf(err, "'%s' : unknown ssl/tls version", args[cur_arg + 1]);
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
if (!strcmp("ssl-min-ver", args[cur_arg]))
|
||||
if (strcmp("ssl-min-ver", args[cur_arg]) == 0)
|
||||
methods->min = v;
|
||||
else if (!strcmp("ssl-max-ver", args[cur_arg]))
|
||||
else if (strcmp("ssl-max-ver", args[cur_arg]) == 0)
|
||||
methods->max = v;
|
||||
else {
|
||||
memprintf(err, "'%s' : option not implemented", args[cur_arg]);
|
||||
@ -1623,11 +1623,11 @@ static int ssl_parse_default_bind_options(char **args, int section_type, struct
|
||||
return -1;
|
||||
}
|
||||
while (*(args[i])) {
|
||||
if (!strcmp(args[i], "no-tls-tickets"))
|
||||
if (strcmp(args[i], "no-tls-tickets") == 0)
|
||||
global_ssl.listen_default_ssloptions |= BC_SSL_O_NO_TLS_TICKETS;
|
||||
else if (!strcmp(args[i], "prefer-client-ciphers"))
|
||||
else if (strcmp(args[i], "prefer-client-ciphers") == 0)
|
||||
global_ssl.listen_default_ssloptions |= BC_SSL_O_PREF_CLIE_CIPH;
|
||||
else if (!strcmp(args[i], "ssl-min-ver") || !strcmp(args[i], "ssl-max-ver")) {
|
||||
else if (strcmp(args[i], "ssl-min-ver") == 0 || strcmp(args[i], "ssl-max-ver") == 0) {
|
||||
if (!parse_tls_method_minmax(args, i, &global_ssl.listen_default_sslmethods, err))
|
||||
i++;
|
||||
else {
|
||||
@ -1655,9 +1655,9 @@ static int ssl_parse_default_server_options(char **args, int section_type, struc
|
||||
return -1;
|
||||
}
|
||||
while (*(args[i])) {
|
||||
if (!strcmp(args[i], "no-tls-tickets"))
|
||||
if (strcmp(args[i], "no-tls-tickets") == 0)
|
||||
global_ssl.connect_default_ssloptions |= SRV_SSL_O_NO_TLS_TICKETS;
|
||||
else if (!strcmp(args[i], "ssl-min-ver") || !strcmp(args[i], "ssl-max-ver")) {
|
||||
else if (strcmp(args[i], "ssl-min-ver") == 0 || strcmp(args[i], "ssl-max-ver") == 0) {
|
||||
if (!parse_tls_method_minmax(args, i, &global_ssl.connect_default_sslmethods, err))
|
||||
i++;
|
||||
else {
|
||||
|
@ -753,7 +753,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
int local_peer, peer;
|
||||
|
||||
peer = *args[0] == 'p';
|
||||
local_peer = !strcmp(args[1], localpeer);
|
||||
local_peer = strcmp(args[1], localpeer) == 0;
|
||||
/* The local peer may have already partially been parsed on a "bind" line. */
|
||||
if (*args[0] == 'p') {
|
||||
if (bind_line) {
|
||||
@ -854,7 +854,7 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
l->options |= LI_O_UNLIMITED; /* don't make the peers subject to global limits */
|
||||
global.maxsock++; /* for the listening socket */
|
||||
}
|
||||
else if (!strcmp(args[0], "table")) {
|
||||
else if (strcmp(args[0], "table") == 0) {
|
||||
struct stktable *t, *other;
|
||||
char *id;
|
||||
size_t prefix_len;
|
||||
@ -917,10 +917,10 @@ int cfg_parse_peers(const char *file, int linenum, char **args, int kwm)
|
||||
t->next = stktables_list;
|
||||
stktables_list = t;
|
||||
}
|
||||
else if (!strcmp(args[0], "disabled")) { /* disables this peers section */
|
||||
else if (strcmp(args[0], "disabled") == 0) { /* disables this peers section */
|
||||
curpeers->disabled = 1;
|
||||
}
|
||||
else if (!strcmp(args[0], "enabled")) { /* enables this peers section (used to revert a disabled default) */
|
||||
else if (strcmp(args[0], "enabled") == 0) { /* enables this peers section (used to revert a disabled default) */
|
||||
curpeers->disabled = 0;
|
||||
}
|
||||
else if (*args[0] != 0) {
|
||||
@ -1510,10 +1510,10 @@ cfg_parse_netns(const char *file, int linenum, char **args, int kwm)
|
||||
const char *err;
|
||||
const char *item = args[0];
|
||||
|
||||
if (!strcmp(item, "namespace_list")) {
|
||||
if (strcmp(item, "namespace_list") == 0) {
|
||||
return 0;
|
||||
}
|
||||
else if (!strcmp(item, "namespace")) {
|
||||
else if (strcmp(item, "namespace") == 0) {
|
||||
size_t idx = 1;
|
||||
const char *current;
|
||||
while (*(current = args[idx++])) {
|
||||
@ -1552,7 +1552,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
||||
int err_code = 0;
|
||||
const char *err;
|
||||
|
||||
if (!strcmp(args[0], "userlist")) { /* new userlist */
|
||||
if (strcmp(args[0], "userlist") == 0) { /* new userlist */
|
||||
struct userlist *newul;
|
||||
|
||||
if (!*args[1]) {
|
||||
@ -1573,7 +1573,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
|
||||
for (newul = userlist; newul; newul = newul->next)
|
||||
if (!strcmp(newul->name, args[1])) {
|
||||
if (strcmp(newul->name, args[1]) == 0) {
|
||||
ha_warning("parsing [%s:%d]: ignoring duplicated userlist '%s'.\n",
|
||||
file, linenum, args[1]);
|
||||
err_code |= ERR_WARN;
|
||||
@ -1598,7 +1598,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
||||
newul->next = userlist;
|
||||
userlist = newul;
|
||||
|
||||
} else if (!strcmp(args[0], "group")) { /* new group */
|
||||
} else if (strcmp(args[0], "group") == 0) { /* new group */
|
||||
int cur_arg;
|
||||
const char *err;
|
||||
struct auth_groups *ag;
|
||||
@ -1622,7 +1622,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
|
||||
for (ag = userlist->groups; ag; ag = ag->next)
|
||||
if (!strcmp(ag->name, args[1])) {
|
||||
if (strcmp(ag->name, args[1]) == 0) {
|
||||
ha_warning("parsing [%s:%d]: ignoring duplicated group '%s' in userlist '%s'.\n",
|
||||
file, linenum, args[1], userlist->name);
|
||||
err_code |= ERR_ALERT;
|
||||
@ -1647,7 +1647,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
||||
cur_arg = 2;
|
||||
|
||||
while (*args[cur_arg]) {
|
||||
if (!strcmp(args[cur_arg], "users")) {
|
||||
if (strcmp(args[cur_arg], "users") == 0) {
|
||||
ag->groupusers = strdup(args[cur_arg + 1]);
|
||||
cur_arg += 2;
|
||||
continue;
|
||||
@ -1665,7 +1665,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
||||
ag->next = userlist->groups;
|
||||
userlist->groups = ag;
|
||||
|
||||
} else if (!strcmp(args[0], "user")) { /* new user */
|
||||
} else if (strcmp(args[0], "user") == 0) { /* new user */
|
||||
struct auth_users *newuser;
|
||||
int cur_arg;
|
||||
|
||||
@ -1679,7 +1679,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
|
||||
for (newuser = userlist->users; newuser; newuser = newuser->next)
|
||||
if (!strcmp(newuser->user, args[1])) {
|
||||
if (strcmp(newuser->user, args[1]) == 0) {
|
||||
ha_warning("parsing [%s:%d]: ignoring duplicated user '%s' in userlist '%s'.\n",
|
||||
file, linenum, args[1], userlist->name);
|
||||
err_code |= ERR_ALERT;
|
||||
@ -1701,7 +1701,7 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
||||
cur_arg = 2;
|
||||
|
||||
while (*args[cur_arg]) {
|
||||
if (!strcmp(args[cur_arg], "password")) {
|
||||
if (strcmp(args[cur_arg], "password") == 0) {
|
||||
#ifdef USE_LIBCRYPT
|
||||
if (!crypt("", args[cur_arg + 1])) {
|
||||
ha_alert("parsing [%s:%d]: the encrypted password used for user '%s' is not supported by crypt(3).\n",
|
||||
@ -1717,12 +1717,12 @@ cfg_parse_users(const char *file, int linenum, char **args, int kwm)
|
||||
newuser->pass = strdup(args[cur_arg + 1]);
|
||||
cur_arg += 2;
|
||||
continue;
|
||||
} else if (!strcmp(args[cur_arg], "insecure-password")) {
|
||||
} else if (strcmp(args[cur_arg], "insecure-password") == 0) {
|
||||
newuser->pass = strdup(args[cur_arg + 1]);
|
||||
newuser->flags |= AU_O_INSECURE;
|
||||
cur_arg += 2;
|
||||
continue;
|
||||
} else if (!strcmp(args[cur_arg], "groups")) {
|
||||
} else if (strcmp(args[cur_arg], "groups") == 0) {
|
||||
newuser->u.groups_names = strdup(args[cur_arg + 1]);
|
||||
cur_arg += 2;
|
||||
continue;
|
||||
@ -2013,7 +2013,7 @@ next_line:
|
||||
continue;
|
||||
|
||||
/* check for keyword modifiers "no" and "default" */
|
||||
if (!strcmp(args[0], "no")) {
|
||||
if (strcmp(args[0], "no") == 0) {
|
||||
char *tmp;
|
||||
|
||||
kwm = KWM_NO;
|
||||
@ -2023,7 +2023,7 @@ next_line:
|
||||
*tmp = '\0'; // fix the next arg to \0
|
||||
args[arg] = tmp;
|
||||
}
|
||||
else if (!strcmp(args[0], "default")) {
|
||||
else if (strcmp(args[0], "default") == 0) {
|
||||
kwm = KWM_DEF;
|
||||
for (arg=0; *args[arg+1]; arg++)
|
||||
args[arg] = args[arg+1]; // shift args after inversion
|
||||
@ -2823,7 +2823,7 @@ int check_config_validity()
|
||||
struct mailers *curmailers = mailers;
|
||||
|
||||
for (curmailers = mailers; curmailers; curmailers = curmailers->next) {
|
||||
if (!strcmp(curmailers->id, curproxy->email_alert.mailers.name))
|
||||
if (strcmp(curmailers->id, curproxy->email_alert.mailers.name) == 0)
|
||||
break;
|
||||
}
|
||||
if (!curmailers) {
|
||||
|
38
src/cli.c
38
src/cli.c
@ -264,7 +264,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
|
||||
struct bind_conf *bind_conf;
|
||||
struct listener *l;
|
||||
|
||||
if (!strcmp(args[1], "socket")) {
|
||||
if (strcmp(args[1], "socket") == 0) {
|
||||
int cur_arg;
|
||||
|
||||
if (*args[2] == 0) {
|
||||
@ -335,7 +335,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
|
||||
global.maxsock++; /* for the listening socket */
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[1], "timeout")) {
|
||||
else if (strcmp(args[1], "timeout") == 0) {
|
||||
unsigned timeout;
|
||||
const char *res = parse_time_err(args[2], &timeout, TIME_UNIT_MS);
|
||||
|
||||
@ -366,7 +366,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
|
||||
}
|
||||
global.stats_fe->timeout.client = MS_TO_TICKS(timeout);
|
||||
}
|
||||
else if (!strcmp(args[1], "maxconn")) {
|
||||
else if (strcmp(args[1], "maxconn") == 0) {
|
||||
int maxconn = atol(args[2]);
|
||||
|
||||
if (maxconn <= 0) {
|
||||
@ -382,7 +382,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
|
||||
}
|
||||
global.stats_fe->maxconn = maxconn;
|
||||
}
|
||||
else if (!strcmp(args[1], "bind-process")) { /* enable the socket only on some processes */
|
||||
else if (strcmp(args[1], "bind-process") == 0) { /* enable the socket only on some processes */
|
||||
int cur_arg = 2;
|
||||
unsigned long set = 0;
|
||||
|
||||
@ -803,7 +803,7 @@ static void cli_io_handler(struct appctx *appctx)
|
||||
* Its location is not remembered here, this is just to switch
|
||||
* to a gathering mode.
|
||||
*/
|
||||
if (!strcmp(appctx->chunk->area + appctx->chunk->data - strlen(PAYLOAD_PATTERN), PAYLOAD_PATTERN))
|
||||
if (strcmp(appctx->chunk->area + appctx->chunk->data - strlen(PAYLOAD_PATTERN), PAYLOAD_PATTERN) == 0)
|
||||
appctx->st1 |= APPCTX_CLI_ST1_PAYLOAD;
|
||||
else {
|
||||
/* no payload, the command is complete: parse the request */
|
||||
@ -1438,15 +1438,15 @@ static int cli_parse_set_maxconn_global(char **args, char *payload, struct appct
|
||||
|
||||
static int set_severity_output(int *target, char *argument)
|
||||
{
|
||||
if (!strcmp(argument, "none")) {
|
||||
if (strcmp(argument, "none") == 0) {
|
||||
*target = CLI_SEVERITY_NONE;
|
||||
return 1;
|
||||
}
|
||||
else if (!strcmp(argument, "number")) {
|
||||
else if (strcmp(argument, "number") == 0) {
|
||||
*target = CLI_SEVERITY_NUMBER;
|
||||
return 1;
|
||||
}
|
||||
else if (!strcmp(argument, "string")) {
|
||||
else if (strcmp(argument, "string") == 0) {
|
||||
*target = CLI_SEVERITY_STRING;
|
||||
return 1;
|
||||
}
|
||||
@ -1480,17 +1480,17 @@ static int cli_parse_show_lvl(char **args, char *payload, struct appctx *appctx,
|
||||
static int cli_parse_set_lvl(char **args, char *payload, struct appctx *appctx, void *private)
|
||||
{
|
||||
/* this will ask the applet to not output a \n after the command */
|
||||
if (!strcmp(args[1], "-"))
|
||||
if (strcmp(args[1], "-") == 0)
|
||||
appctx->st1 |= APPCTX_CLI_ST1_NOLF;
|
||||
|
||||
if (!strcmp(args[0], "operator")) {
|
||||
if (strcmp(args[0], "operator") == 0) {
|
||||
if (!cli_has_level(appctx, ACCESS_LVL_OPER)) {
|
||||
return 1;
|
||||
}
|
||||
appctx->cli_level &= ~ACCESS_LVL_MASK;
|
||||
appctx->cli_level |= ACCESS_LVL_OPER;
|
||||
|
||||
} else if (!strcmp(args[0], "user")) {
|
||||
} else if (strcmp(args[0], "user") == 0) {
|
||||
if (!cli_has_level(appctx, ACCESS_LVL_USER)) {
|
||||
return 1;
|
||||
}
|
||||
@ -1580,7 +1580,7 @@ static int bind_parse_expose_fd(char **args, int cur_arg, struct proxy *px, stru
|
||||
memprintf(err, "'%s' : missing fd type", args[cur_arg]);
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
if (!strcmp(args[cur_arg+1], "listeners")) {
|
||||
if (strcmp(args[cur_arg + 1], "listeners") == 0) {
|
||||
conf->level |= ACCESS_FD_LISTENERS;
|
||||
} else {
|
||||
memprintf(err, "'%s' only supports 'listeners' (got '%s')",
|
||||
@ -1599,13 +1599,13 @@ static int bind_parse_level(char **args, int cur_arg, struct proxy *px, struct b
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
|
||||
if (!strcmp(args[cur_arg+1], "user")) {
|
||||
if (strcmp(args[cur_arg + 1], "user") == 0) {
|
||||
conf->level &= ~ACCESS_LVL_MASK;
|
||||
conf->level |= ACCESS_LVL_USER;
|
||||
} else if (!strcmp(args[cur_arg+1], "operator")) {
|
||||
} else if (strcmp(args[cur_arg + 1], "operator") == 0) {
|
||||
conf->level &= ~ACCESS_LVL_MASK;
|
||||
conf->level |= ACCESS_LVL_OPER;
|
||||
} else if (!strcmp(args[cur_arg+1], "admin")) {
|
||||
} else if (strcmp(args[cur_arg + 1], "admin") == 0) {
|
||||
conf->level &= ~ACCESS_LVL_MASK;
|
||||
conf->level |= ACCESS_LVL_ADMIN;
|
||||
} else {
|
||||
@ -1973,15 +1973,15 @@ int pcli_find_and_exec_kw(struct stream *s, char **args, int argl, char **errmsg
|
||||
else
|
||||
*next_pid = target_pid;
|
||||
return 1;
|
||||
} else if (!strcmp("prompt", args[0])) {
|
||||
} else if (strcmp("prompt", args[0]) == 0) {
|
||||
s->pcli_flags ^= PCLI_F_PROMPT;
|
||||
return argl; /* return the number of elements in the array */
|
||||
|
||||
} else if (!strcmp("quit", args[0])) {
|
||||
} else if (strcmp("quit", args[0]) == 0) {
|
||||
channel_shutr_now(&s->req);
|
||||
channel_shutw_now(&s->res);
|
||||
return argl; /* return the number of elements in the array */
|
||||
} else if (!strcmp(args[0], "operator")) {
|
||||
} else if (strcmp(args[0], "operator") == 0) {
|
||||
if (!pcli_has_level(s, ACCESS_LVL_OPER)) {
|
||||
memprintf(errmsg, "Permission denied!\n");
|
||||
return -1;
|
||||
@ -1990,7 +1990,7 @@ int pcli_find_and_exec_kw(struct stream *s, char **args, int argl, char **errmsg
|
||||
s->pcli_flags |= ACCESS_LVL_OPER;
|
||||
return argl;
|
||||
|
||||
} else if (!strcmp(args[0], "user")) {
|
||||
} else if (strcmp(args[0], "user") == 0) {
|
||||
if (!pcli_has_level(s, ACCESS_LVL_USER)) {
|
||||
memprintf(errmsg, "Permission denied!\n");
|
||||
return -1;
|
||||
|
@ -131,7 +131,7 @@ int comp_append_algo(struct comp *comp, const char *algo)
|
||||
int i;
|
||||
|
||||
for (i = 0; comp_algos[i].cfg_name; i++) {
|
||||
if (!strcmp(algo, comp_algos[i].cfg_name)) {
|
||||
if (strcmp(algo, comp_algos[i].cfg_name) == 0) {
|
||||
comp_algo = calloc(1, sizeof(*comp_algo));
|
||||
memmove(comp_algo, &comp_algos[i], sizeof(struct comp_algo));
|
||||
comp_algo->next = comp->algos;
|
||||
|
@ -137,7 +137,7 @@ struct dns_resolvers *find_resolvers_by_id(const char *id)
|
||||
struct dns_resolvers *res;
|
||||
|
||||
list_for_each_entry(res, &dns_resolvers, list) {
|
||||
if (!strcmp(res->id, id))
|
||||
if (strcmp(res->id, id) == 0)
|
||||
return res;
|
||||
}
|
||||
return NULL;
|
||||
@ -164,7 +164,7 @@ struct dns_srvrq *find_srvrq_by_name(const char *name, struct proxy *px)
|
||||
struct dns_srvrq *srvrq;
|
||||
|
||||
list_for_each_entry(srvrq, &dns_srvrq_list, list) {
|
||||
if (srvrq->proxy == px && !strcmp(srvrq->name, name))
|
||||
if (srvrq->proxy == px && strcmp(srvrq->name, name) == 0)
|
||||
return srvrq;
|
||||
}
|
||||
return NULL;
|
||||
@ -2499,7 +2499,7 @@ int dns_allocate_counters(struct list *stat_modules)
|
||||
mod->counters, mod->counters_size);
|
||||
|
||||
/* Store the ns counters pointer */
|
||||
if (!strcmp(mod->name, "dns")) {
|
||||
if (strcmp(mod->name, "dns") == 0) {
|
||||
ns->counters = (struct dns_counters *)ns->extra_counters->data + mod->counters_off[COUNTERS_DNS];
|
||||
ns->counters->id = ns->id;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ struct fcgi_app *fcgi_app_find_by_name(const char *name)
|
||||
struct fcgi_app *app;
|
||||
|
||||
for (app = fcgi_apps; app != NULL; app = app->next) {
|
||||
if (!strcmp(app->name, name))
|
||||
if (strcmp(app->name, name) == 0)
|
||||
return app;
|
||||
}
|
||||
|
||||
@ -544,7 +544,7 @@ parse_fcgi_flt(char **args, int *cur_arg, struct proxy *px,
|
||||
if (f->id != fcgi_flt_id)
|
||||
continue;
|
||||
fcgi_conf = f->conf;
|
||||
if (strcmp(name, fcgi_conf->name)) {
|
||||
if (strcmp(name, fcgi_conf->name) != 0) {
|
||||
fcgi_conf = NULL;
|
||||
continue;
|
||||
}
|
||||
@ -606,7 +606,7 @@ static int proxy_parse_use_fcgi_app(char **args, int section, struct proxy *curp
|
||||
list_for_each_entry(fconf, &curpx->filter_configs, list) {
|
||||
if (fconf->id == fcgi_flt_id) {
|
||||
fcgi_conf = fconf->conf;
|
||||
if (fcgi_conf && !strcmp((char *)fcgi_conf->name, args[1]))
|
||||
if (fcgi_conf && strcmp((char *)fcgi_conf->name, args[1]) == 0)
|
||||
goto end;
|
||||
memprintf(err, "'%s' : only one fcgi-app supported per backend", args[0]);
|
||||
retval = -1;
|
||||
@ -773,7 +773,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
const char *err;
|
||||
char *errmsg = NULL;
|
||||
|
||||
if (!strcmp(args[0], "fcgi-app")) { /* new fcgi-app */
|
||||
if (strcmp(args[0], "fcgi-app") == 0) { /* new fcgi-app */
|
||||
if (!*(args[1])) {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects <name> as argument.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -792,7 +792,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
}
|
||||
|
||||
for (curapp = fcgi_apps; curapp != NULL; curapp = curapp->next) {
|
||||
if (!strcmp(curapp->name, args[1])) {
|
||||
if (strcmp(curapp->name, args[1]) == 0) {
|
||||
ha_alert("Parsing [%s:%d]: fcgi-app section '%s' has the same name as another one declared at %s:%d.\n",
|
||||
file, linenum, args[1], curapp->conf.file, curapp->conf.line);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
@ -845,7 +845,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "docroot")) {
|
||||
else if (strcmp(args[0], "docroot") == 0) {
|
||||
if (!*(args[1])) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expects <path> as argument.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -861,7 +861,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "path-info")) {
|
||||
else if (strcmp(args[0], "path-info") == 0) {
|
||||
if (!*(args[1])) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expects <regex> as argument.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -878,7 +878,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "index")) {
|
||||
else if (strcmp(args[0], "index") == 0) {
|
||||
if (!*(args[1])) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expects <filename> as argument.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -894,7 +894,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "acl")) {
|
||||
else if (strcmp(args[0], "acl") == 0) {
|
||||
const char *err;
|
||||
err = invalid_char(args[1]);
|
||||
if (err) {
|
||||
@ -917,7 +917,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "set-param")) {
|
||||
else if (strcmp(args[0], "set-param") == 0) {
|
||||
if (!*(args[1]) || !*(args[2])) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expects <name> and <value> as arguments.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -968,7 +968,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
goto parse_cond_rule;
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp(args[0], "pass-header")) {
|
||||
else if (strcmp(args[0], "pass-header") == 0) {
|
||||
if (!*(args[1])) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expects <name> as arguments.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -998,13 +998,13 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
goto parse_cond_rule;
|
||||
}
|
||||
#endif
|
||||
else if (!strcmp(args[0], "option")) {
|
||||
else if (strcmp(args[0], "option") == 0) {
|
||||
if (!*(args[1])) {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects an option name.\n",
|
||||
file, linenum, args[0]);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
else if (!strcmp(args[1], "keep-conn")) {
|
||||
else if (strcmp(args[1], "keep-conn") == 0) {
|
||||
if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == KWM_STD)
|
||||
@ -1012,7 +1012,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
else if (kwm == KWM_NO)
|
||||
curapp->flags &= ~FCGI_APP_FL_KEEP_CONN;
|
||||
}
|
||||
else if (!strcmp(args[1], "get-values")) {
|
||||
else if (strcmp(args[1], "get-values") == 0) {
|
||||
if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == KWM_STD)
|
||||
@ -1020,7 +1020,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
else if (kwm == KWM_NO)
|
||||
curapp->flags &= ~FCGI_APP_FL_GET_VALUES;
|
||||
}
|
||||
else if (!strcmp(args[1], "mpxs-conns")) {
|
||||
else if (strcmp(args[1], "mpxs-conns") == 0) {
|
||||
if (alertif_too_many_args_idx(0, 1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == KWM_STD)
|
||||
@ -1028,7 +1028,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
else if (kwm == KWM_NO)
|
||||
curapp->flags &= ~FCGI_APP_FL_MPXS_CONNS;
|
||||
}
|
||||
else if (!strcmp(args[1], "max-reqs")) {
|
||||
else if (strcmp(args[1], "max-reqs") == 0) {
|
||||
if (kwm != KWM_STD) {
|
||||
ha_alert("parsing [%s:%d]: negation/default is not supported for option '%s'.\n",
|
||||
file, linenum, args[1]);
|
||||
@ -1057,7 +1057,7 @@ static int cfg_parse_fcgi_app(const char *file, int linenum, char **args, int kw
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "log-stderr")) {
|
||||
else if (strcmp(args[0], "log-stderr") == 0) {
|
||||
if (!parse_logsrv(args, &curapp->logsrvs, (kwm == KWM_NO), &errmsg)) {
|
||||
ha_alert("parsing [%s:%d] : %s : %s\n", file, linenum, args[0], errmsg);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
|
@ -184,7 +184,7 @@ parse_filter(char **args, int section_type, struct proxy *curpx,
|
||||
file, line, args[0]);
|
||||
return -1;
|
||||
}
|
||||
if (!strcmp(args[0], "filter")) {
|
||||
if (strcmp(args[0], "filter") == 0) {
|
||||
struct flt_kw *kw;
|
||||
int cur_arg;
|
||||
|
||||
|
@ -629,7 +629,7 @@ parse_compression_options(char **args, int section, struct proxy *proxy,
|
||||
else
|
||||
comp = proxy->comp;
|
||||
|
||||
if (!strcmp(args[1], "algo")) {
|
||||
if (strcmp(args[1], "algo") == 0) {
|
||||
struct comp_ctx *ctx;
|
||||
int cur_arg = 2;
|
||||
|
||||
@ -655,9 +655,9 @@ parse_compression_options(char **args, int section, struct proxy *proxy,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[1], "offload"))
|
||||
else if (strcmp(args[1], "offload") == 0)
|
||||
comp->offload = 1;
|
||||
else if (!strcmp(args[1], "type")) {
|
||||
else if (strcmp(args[1], "type") == 0) {
|
||||
int cur_arg = 2;
|
||||
|
||||
if (!*args[cur_arg]) {
|
||||
|
110
src/flt_spoe.c
110
src/flt_spoe.c
@ -3036,7 +3036,7 @@ spoe_check(struct proxy *px, struct flt_conf *fconf)
|
||||
continue;
|
||||
|
||||
/* Check engine Id. It should be uniq */
|
||||
if (!strcmp(conf->id, c->id)) {
|
||||
if (strcmp(conf->id, c->id) == 0) {
|
||||
ha_alert("Proxy %s : duplicated name for SPOE engine '%s'.\n",
|
||||
px->id, conf->id);
|
||||
return 1;
|
||||
@ -3322,10 +3322,10 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
if ((cfg_scope == NULL && curengine != NULL) ||
|
||||
(cfg_scope != NULL && curengine == NULL) ||
|
||||
(curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope)))
|
||||
(curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope) != 0))
|
||||
goto out;
|
||||
|
||||
if (!strcmp(args[0], "spoe-agent")) { /* new spoe-agent section */
|
||||
if (strcmp(args[0], "spoe-agent") == 0) { /* new spoe-agent section */
|
||||
if (!*args[1]) {
|
||||
ha_alert("parsing [%s:%d] : missing name for spoe-agent section.\n",
|
||||
file, linenum);
|
||||
@ -3381,7 +3381,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
LIST_INIT(&curagent->groups);
|
||||
LIST_INIT(&curagent->messages);
|
||||
}
|
||||
else if (!strcmp(args[0], "use-backend")) {
|
||||
else if (strcmp(args[0], "use-backend") == 0) {
|
||||
if (!*args[1]) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expects a backend name.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -3393,13 +3393,13 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
free(curagent->b.name);
|
||||
curagent->b.name = strdup(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "messages")) {
|
||||
else if (strcmp(args[0], "messages") == 0) {
|
||||
int cur_arg = 1;
|
||||
while (*args[cur_arg]) {
|
||||
struct spoe_placeholder *ph = NULL;
|
||||
|
||||
list_for_each_entry(ph, &curmphs, list) {
|
||||
if (!strcmp(ph->id, args[cur_arg])) {
|
||||
if (strcmp(ph->id, args[cur_arg]) == 0) {
|
||||
ha_alert("parsing [%s:%d]: spoe-message '%s' already used.\n",
|
||||
file, linenum, args[cur_arg]);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
@ -3417,13 +3417,13 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
cur_arg++;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "groups")) {
|
||||
else if (strcmp(args[0], "groups") == 0) {
|
||||
int cur_arg = 1;
|
||||
while (*args[cur_arg]) {
|
||||
struct spoe_placeholder *ph = NULL;
|
||||
|
||||
list_for_each_entry(ph, &curgphs, list) {
|
||||
if (!strcmp(ph->id, args[cur_arg])) {
|
||||
if (strcmp(ph->id, args[cur_arg]) == 0) {
|
||||
ha_alert("parsing [%s:%d]: spoe-group '%s' already used.\n",
|
||||
file, linenum, args[cur_arg]);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
@ -3441,7 +3441,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
cur_arg++;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "timeout")) {
|
||||
else if (strcmp(args[0], "timeout") == 0) {
|
||||
unsigned int *tv = NULL;
|
||||
const char *res;
|
||||
unsigned timeout;
|
||||
@ -3454,11 +3454,11 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
if (alertif_too_many_args(2, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (!strcmp(args[1], "hello"))
|
||||
if (strcmp(args[1], "hello") == 0)
|
||||
tv = &curagent->timeout.hello;
|
||||
else if (!strcmp(args[1], "idle"))
|
||||
else if (strcmp(args[1], "idle") == 0)
|
||||
tv = &curagent->timeout.idle;
|
||||
else if (!strcmp(args[1], "processing"))
|
||||
else if (strcmp(args[1], "processing") == 0)
|
||||
tv = &curagent->timeout.processing;
|
||||
else {
|
||||
ha_alert("parsing [%s:%d] : 'timeout' supports 'hello', 'idle' or 'processing' (got %s).\n",
|
||||
@ -3493,7 +3493,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
*tv = MS_TO_TICKS(timeout);
|
||||
}
|
||||
else if (!strcmp(args[0], "option")) {
|
||||
else if (strcmp(args[0], "option") == 0) {
|
||||
if (!*args[1]) {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects an option name.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -3501,7 +3501,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!strcmp(args[1], "pipelining")) {
|
||||
if (strcmp(args[1], "pipelining") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == 1)
|
||||
@ -3510,7 +3510,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
curagent->flags |= SPOE_FL_PIPELINING;
|
||||
goto out;
|
||||
}
|
||||
else if (!strcmp(args[1], "async")) {
|
||||
else if (strcmp(args[1], "async") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == 1)
|
||||
@ -3519,7 +3519,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
curagent->flags |= SPOE_FL_ASYNC;
|
||||
goto out;
|
||||
}
|
||||
else if (!strcmp(args[1], "send-frag-payload")) {
|
||||
else if (strcmp(args[1], "send-frag-payload") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == 1)
|
||||
@ -3528,7 +3528,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
curagent->flags |= SPOE_FL_SND_FRAGMENTATION;
|
||||
goto out;
|
||||
}
|
||||
else if (!strcmp(args[1], "dontlog-normal")) {
|
||||
else if (strcmp(args[1], "dontlog-normal") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
if (kwm == 1)
|
||||
@ -3546,7 +3546,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!strcmp(args[1], "var-prefix")) {
|
||||
if (strcmp(args[1], "var-prefix") == 0) {
|
||||
char *tmp;
|
||||
|
||||
if (!*args[2]) {
|
||||
@ -3570,17 +3570,17 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
curagent->var_pfx = strdup(args[2]);
|
||||
}
|
||||
else if (!strcmp(args[1], "force-set-var")) {
|
||||
else if (strcmp(args[1], "force-set-var") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
curagent->flags |= SPOE_FL_FORCE_SET_VAR;
|
||||
}
|
||||
else if (!strcmp(args[1], "continue-on-error")) {
|
||||
else if (strcmp(args[1], "continue-on-error") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
curagent->flags |= SPOE_FL_CONT_ON_ERR;
|
||||
}
|
||||
else if (!strcmp(args[1], "set-on-error")) {
|
||||
else if (strcmp(args[1], "set-on-error") == 0) {
|
||||
char *tmp;
|
||||
|
||||
if (!*args[2]) {
|
||||
@ -3604,7 +3604,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
curagent->var_on_error = strdup(args[2]);
|
||||
}
|
||||
else if (!strcmp(args[1], "set-process-time")) {
|
||||
else if (strcmp(args[1], "set-process-time") == 0) {
|
||||
char *tmp;
|
||||
|
||||
if (!*args[2]) {
|
||||
@ -3628,7 +3628,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
curagent->var_t_process = strdup(args[2]);
|
||||
}
|
||||
else if (!strcmp(args[1], "set-total-time")) {
|
||||
else if (strcmp(args[1], "set-total-time") == 0) {
|
||||
char *tmp;
|
||||
|
||||
if (!*args[2]) {
|
||||
@ -3659,7 +3659,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "maxconnrate")) {
|
||||
else if (strcmp(args[0], "maxconnrate") == 0) {
|
||||
if (!*args[1]) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -3670,7 +3670,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
curagent->cps_max = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "maxerrrate")) {
|
||||
else if (strcmp(args[0], "maxerrrate") == 0) {
|
||||
if (!*args[1]) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -3681,7 +3681,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
curagent->eps_max = atol(args[1]);
|
||||
}
|
||||
else if (!strcmp(args[0], "max-frame-size")) {
|
||||
else if (strcmp(args[0], "max-frame-size") == 0) {
|
||||
if (!*args[1]) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -3699,7 +3699,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "max-waiting-frames")) {
|
||||
else if (strcmp(args[0], "max-waiting-frames") == 0) {
|
||||
if (!*args[1]) {
|
||||
ha_alert("parsing [%s:%d] : '%s' expects an integer argument.\n",
|
||||
file, linenum, args[0]);
|
||||
@ -3716,7 +3716,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "register-var-names")) {
|
||||
else if (strcmp(args[0], "register-var-names") == 0) {
|
||||
int cur_arg;
|
||||
|
||||
if (!*args[1]) {
|
||||
@ -3744,7 +3744,7 @@ cfg_parse_spoe_agent(const char *file, int linenum, char **args, int kwm)
|
||||
cur_arg++;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "log")) {
|
||||
else if (strcmp(args[0], "log") == 0) {
|
||||
char *errmsg = NULL;
|
||||
|
||||
if (!parse_logsrv(args, &curlogsrvs, (kwm == 1), &errmsg)) {
|
||||
@ -3771,10 +3771,10 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
if ((cfg_scope == NULL && curengine != NULL) ||
|
||||
(cfg_scope != NULL && curengine == NULL) ||
|
||||
(curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope)))
|
||||
(curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope) != 0))
|
||||
goto out;
|
||||
|
||||
if (!strcmp(args[0], "spoe-group")) { /* new spoe-group section */
|
||||
if (strcmp(args[0], "spoe-group") == 0) { /* new spoe-group section */
|
||||
if (!*args[1]) {
|
||||
ha_alert("parsing [%s:%d] : missing name for spoe-group section.\n",
|
||||
file, linenum);
|
||||
@ -3795,7 +3795,7 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
|
||||
list_for_each_entry(grp, &curgrps, list) {
|
||||
if (!strcmp(grp->id, args[1])) {
|
||||
if (strcmp(grp->id, args[1]) == 0) {
|
||||
ha_alert("parsing [%s:%d]: spoe-group section '%s' has the same"
|
||||
" name as another one declared at %s:%d.\n",
|
||||
file, linenum, args[1], grp->conf.file, grp->conf.line);
|
||||
@ -3817,13 +3817,13 @@ cfg_parse_spoe_group(const char *file, int linenum, char **args, int kwm)
|
||||
LIST_INIT(&curgrp->messages);
|
||||
LIST_ADDQ(&curgrps, &curgrp->list);
|
||||
}
|
||||
else if (!strcmp(args[0], "messages")) {
|
||||
else if (strcmp(args[0], "messages") == 0) {
|
||||
int cur_arg = 1;
|
||||
while (*args[cur_arg]) {
|
||||
struct spoe_placeholder *ph = NULL;
|
||||
|
||||
list_for_each_entry(ph, &curgrp->phs, list) {
|
||||
if (!strcmp(ph->id, args[cur_arg])) {
|
||||
if (strcmp(ph->id, args[cur_arg]) == 0) {
|
||||
ha_alert("parsing [%s:%d]: spoe-message '%s' already used.\n",
|
||||
file, linenum, args[cur_arg]);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
@ -3862,10 +3862,10 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
if ((cfg_scope == NULL && curengine != NULL) ||
|
||||
(cfg_scope != NULL && curengine == NULL) ||
|
||||
(curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope)))
|
||||
(curengine != NULL && cfg_scope != NULL && strcmp(curengine, cfg_scope) != 0))
|
||||
goto out;
|
||||
|
||||
if (!strcmp(args[0], "spoe-message")) { /* new spoe-message section */
|
||||
if (strcmp(args[0], "spoe-message") == 0) { /* new spoe-message section */
|
||||
if (!*args[1]) {
|
||||
ha_alert("parsing [%s:%d] : missing name for spoe-message section.\n",
|
||||
file, linenum);
|
||||
@ -3886,7 +3886,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
|
||||
list_for_each_entry(msg, &curmsgs, list) {
|
||||
if (!strcmp(msg->id, args[1])) {
|
||||
if (strcmp(msg->id, args[1]) == 0) {
|
||||
ha_alert("parsing [%s:%d]: spoe-message section '%s' has the same"
|
||||
" name as another one declared at %s:%d.\n",
|
||||
file, linenum, args[1], msg->conf.file, msg->conf.line);
|
||||
@ -3913,7 +3913,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
|
||||
LIST_INIT(&curmsg->by_grp);
|
||||
LIST_ADDQ(&curmsgs, &curmsg->list);
|
||||
}
|
||||
else if (!strcmp(args[0], "args")) {
|
||||
else if (strcmp(args[0], "args") == 0) {
|
||||
int cur_arg = 1;
|
||||
|
||||
curproxy->conf.args.ctx = ARGC_SPOE;
|
||||
@ -3956,7 +3956,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
|
||||
curproxy->conf.args.file = NULL;
|
||||
curproxy->conf.args.line = 0;
|
||||
}
|
||||
else if (!strcmp(args[0], "acl")) {
|
||||
else if (strcmp(args[0], "acl") == 0) {
|
||||
err = invalid_char(args[1]);
|
||||
if (err) {
|
||||
ha_alert("parsing [%s:%d] : character '%c' is not permitted in acl name '%s'.\n",
|
||||
@ -3978,7 +3978,7 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[0], "event")) {
|
||||
else if (strcmp(args[0], "event") == 0) {
|
||||
if (!*args[1]) {
|
||||
ha_alert("parsing [%s:%d] : missing event name.\n", file, linenum);
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
@ -3987,23 +3987,23 @@ cfg_parse_spoe_message(const char *file, int linenum, char **args, int kwm)
|
||||
/* if (alertif_too_many_args(1, file, linenum, args, &err_code)) */
|
||||
/* goto out; */
|
||||
|
||||
if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_CLIENT_SESS]))
|
||||
if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_CLIENT_SESS]) == 0)
|
||||
curmsg->event = SPOE_EV_ON_CLIENT_SESS;
|
||||
else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_SERVER_SESS]))
|
||||
else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_SERVER_SESS]) == 0)
|
||||
curmsg->event = SPOE_EV_ON_SERVER_SESS;
|
||||
|
||||
else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_REQ_FE]))
|
||||
else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_REQ_FE]) == 0)
|
||||
curmsg->event = SPOE_EV_ON_TCP_REQ_FE;
|
||||
else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_REQ_BE]))
|
||||
else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_REQ_BE]) == 0)
|
||||
curmsg->event = SPOE_EV_ON_TCP_REQ_BE;
|
||||
else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_RSP]))
|
||||
else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_TCP_RSP]) == 0)
|
||||
curmsg->event = SPOE_EV_ON_TCP_RSP;
|
||||
|
||||
else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_REQ_FE]))
|
||||
else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_REQ_FE]) == 0)
|
||||
curmsg->event = SPOE_EV_ON_HTTP_REQ_FE;
|
||||
else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_REQ_BE]))
|
||||
else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_REQ_BE]) == 0)
|
||||
curmsg->event = SPOE_EV_ON_HTTP_REQ_BE;
|
||||
else if (!strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_RSP]))
|
||||
else if (strcmp(args[1], spoe_event_str[SPOE_EV_ON_HTTP_RSP]) == 0)
|
||||
curmsg->event = SPOE_EV_ON_HTTP_RSP;
|
||||
else {
|
||||
ha_alert("parsing [%s:%d] : unknown event '%s'.\n",
|
||||
@ -4078,7 +4078,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
|
||||
conf->proxy = px;
|
||||
|
||||
while (*args[pos]) {
|
||||
if (!strcmp(args[pos], "config")) {
|
||||
if (strcmp(args[pos], "config") == 0) {
|
||||
if (!*args[pos+1]) {
|
||||
memprintf(err, "'%s' : '%s' option without value",
|
||||
args[*cur_arg], args[pos]);
|
||||
@ -4087,7 +4087,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
|
||||
file = args[pos+1];
|
||||
pos += 2;
|
||||
}
|
||||
else if (!strcmp(args[pos], "engine")) {
|
||||
else if (strcmp(args[pos], "engine") == 0) {
|
||||
if (!*args[pos+1]) {
|
||||
memprintf(err, "'%s' : '%s' option without value",
|
||||
args[*cur_arg], args[pos]);
|
||||
@ -4233,7 +4233,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
|
||||
struct spoe_arg *arg;
|
||||
unsigned int where;
|
||||
|
||||
if (!strcmp(msg->id, ph->id)) {
|
||||
if (strcmp(msg->id, ph->id) == 0) {
|
||||
if ((px->cap & (PR_CAP_FE|PR_CAP_BE)) == (PR_CAP_FE|PR_CAP_BE)) {
|
||||
if (msg->event == SPOE_EV_ON_TCP_REQ_BE)
|
||||
msg->event = SPOE_EV_ON_TCP_REQ_FE;
|
||||
@ -4331,7 +4331,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
|
||||
* agent */
|
||||
list_for_each_entry(ph, &curgphs, list) {
|
||||
list_for_each_entry_safe(grp, grpback, &curgrps, list) {
|
||||
if (!strcmp(grp->id, ph->id)) {
|
||||
if (strcmp(grp->id, ph->id) == 0) {
|
||||
grp->agent = curagent;
|
||||
LIST_DEL(&grp->list);
|
||||
LIST_ADDQ(&curagent->groups, &grp->list);
|
||||
@ -4350,7 +4350,7 @@ parse_spoe_flt(char **args, int *cur_arg, struct proxy *px,
|
||||
list_for_each_entry(grp, &curagent->groups, list) {
|
||||
list_for_each_entry_safe(ph, phback, &grp->phs, list) {
|
||||
list_for_each_entry(msg, &curmsgs, list) {
|
||||
if (!strcmp(msg->id, ph->id)) {
|
||||
if (strcmp(msg->id, ph->id) == 0) {
|
||||
if (msg->group != NULL) {
|
||||
memprintf(err, "SPOE message '%s' already belongs to "
|
||||
"the SPOE group '%s' declare at %s:%d",
|
||||
@ -4583,7 +4583,7 @@ check_send_spoe_group(struct act_rule *rule, struct proxy *px, char **err)
|
||||
continue;
|
||||
|
||||
/* This is the good engine */
|
||||
if (!strcmp(conf->id, engine_id)) {
|
||||
if (strcmp(conf->id, engine_id) == 0) {
|
||||
agent = conf->agent;
|
||||
break;
|
||||
}
|
||||
@ -4597,7 +4597,7 @@ check_send_spoe_group(struct act_rule *rule, struct proxy *px, char **err)
|
||||
/* Try to find the right group */
|
||||
list_for_each_entry(group, &agent->groups, list) {
|
||||
/* This is the good group */
|
||||
if (!strcmp(group->id, group_id))
|
||||
if (strcmp(group->id, group_id) == 0)
|
||||
break;
|
||||
}
|
||||
if (&group->list == &agent->groups) {
|
||||
|
@ -623,11 +623,11 @@ parse_trace_flt(char **args, int *cur_arg, struct proxy *px,
|
||||
}
|
||||
conf->proxy = px;
|
||||
conf->flags = 0;
|
||||
if (!strcmp(args[pos], "trace")) {
|
||||
if (strcmp(args[pos], "trace") == 0) {
|
||||
pos++;
|
||||
|
||||
while (*args[pos]) {
|
||||
if (!strcmp(args[pos], "name")) {
|
||||
if (strcmp(args[pos], "name") == 0) {
|
||||
if (!*args[pos + 1]) {
|
||||
memprintf(err, "'%s' : '%s' option without value",
|
||||
args[*cur_arg], args[pos]);
|
||||
@ -640,13 +640,13 @@ parse_trace_flt(char **args, int *cur_arg, struct proxy *px,
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
else if (!strcmp(args[pos], "quiet"))
|
||||
else if (strcmp(args[pos], "quiet") == 0)
|
||||
conf->flags |= TRACE_F_QUIET;
|
||||
else if (!strcmp(args[pos], "random-parsing"))
|
||||
else if (strcmp(args[pos], "random-parsing") == 0)
|
||||
continue; // ignore
|
||||
else if (!strcmp(args[pos], "random-forwarding"))
|
||||
else if (strcmp(args[pos], "random-forwarding") == 0)
|
||||
conf->flags |= TRACE_F_RAND_FWD;
|
||||
else if (!strcmp(args[pos], "hexdump"))
|
||||
else if (strcmp(args[pos], "hexdump") == 0)
|
||||
conf->flags |= TRACE_F_HEXDUMP;
|
||||
else
|
||||
break;
|
||||
|
@ -731,7 +731,7 @@ static void get_cur_unixsocket()
|
||||
if (!cur_unixsocket) {
|
||||
cur_unixsocket = strdup(un->sun_path);
|
||||
} else {
|
||||
if (old_unixsocket && !strcmp(un->sun_path, old_unixsocket)) {
|
||||
if (old_unixsocket && strcmp(un->sun_path, old_unixsocket) == 0) {
|
||||
free(cur_unixsocket);
|
||||
cur_unixsocket = strdup(old_unixsocket);
|
||||
return;
|
||||
|
@ -913,7 +913,7 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp,
|
||||
goto error;
|
||||
}
|
||||
if (p->uri_auth && p->uri_auth->userlist &&
|
||||
!strcmp(p->uri_auth->userlist->name, argp[idx].data.str.area))
|
||||
strcmp(p->uri_auth->userlist->name, argp[idx].data.str.area) == 0)
|
||||
ul = p->uri_auth->userlist;
|
||||
else
|
||||
ul = auth_find_userlist(argp[idx].data.str.area);
|
||||
|
@ -853,7 +853,7 @@ static enum act_parse_ret parse_http_deny(const char **args, int *orig_arg, stru
|
||||
|
||||
cur_arg = *orig_arg;
|
||||
if (rule->from == ACT_F_HTTP_REQ) {
|
||||
if (!strcmp(args[cur_arg-1], "tarpit")) {
|
||||
if (strcmp(args[cur_arg - 1], "tarpit") == 0) {
|
||||
rule->action = ACT_HTTP_REQ_TARPIT;
|
||||
default_status = 500;
|
||||
}
|
||||
@ -995,7 +995,7 @@ static enum act_parse_ret parse_http_auth(const char **args, int *orig_arg, stru
|
||||
rule->release_ptr = release_http_action;
|
||||
|
||||
cur_arg = *orig_arg;
|
||||
if (!strcmp(args[cur_arg], "realm")) {
|
||||
if (strcmp(args[cur_arg], "realm") == 0) {
|
||||
cur_arg++;
|
||||
if (!*args[cur_arg]) {
|
||||
memprintf(err, "missing realm value.\n");
|
||||
|
@ -1751,7 +1751,7 @@ static int proxy_parse_errorloc(char **args, int section, struct proxy *curpx,
|
||||
}
|
||||
|
||||
status = atol(args[1]);
|
||||
errloc = (!strcmp(args[0], "errorloc303") ? 303 : 302);
|
||||
errloc = (strcmp(args[0], "errorloc303") == 0 ? 303 : 302);
|
||||
msg = http_parse_errorloc(errloc, status, args[2], errmsg);
|
||||
if (!msg) {
|
||||
memprintf(errmsg, "%s : %s", args[0], *errmsg);
|
||||
@ -2184,7 +2184,7 @@ static int cfg_parse_http_errors(const char *file, int linenum, char **args, int
|
||||
curr_errs->conf.file = strdup(file);
|
||||
curr_errs->conf.line = linenum;
|
||||
}
|
||||
else if (!strcmp(args[0], "errorfile")) { /* error message from a file */
|
||||
else if (strcmp(args[0], "errorfile") == 0) { /* error message from a file */
|
||||
struct http_reply *reply;
|
||||
struct buffer *msg;
|
||||
int status, rc;
|
||||
|
@ -337,10 +337,10 @@ struct redirect_rule *http_parse_redirect_rule(const char *file, int linenum, st
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(args[cur_arg],"drop-query")) {
|
||||
else if (strcmp(args[cur_arg], "drop-query") == 0) {
|
||||
flags |= REDIRECT_FLAG_DROP_QS;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg],"append-slash")) {
|
||||
else if (strcmp(args[cur_arg], "append-slash") == 0) {
|
||||
flags |= REDIRECT_FLAG_APPEND_SLASH;
|
||||
}
|
||||
else if (strcmp(args[cur_arg], "if") == 0 ||
|
||||
|
12
src/log.c
12
src/log.c
@ -835,7 +835,7 @@ int parse_logsrv(char **args, struct list *logsrvs, int do_del, char **err)
|
||||
* "log global": copy global.logrsvs linked list to the end of logsrvs
|
||||
* list. But first, we check (logsrvs != global.logsrvs).
|
||||
*/
|
||||
if (*(args[1]) && *(args[2]) == 0 && !strcmp(args[1], "global")) {
|
||||
if (*(args[1]) && *(args[2]) == 0 && strcmp(args[1], "global") == 0) {
|
||||
if (logsrvs == &global.logsrvs) {
|
||||
memprintf(err, "'global' is not supported for a global syslog server");
|
||||
goto error;
|
||||
@ -1166,7 +1166,7 @@ enum log_fmt get_log_format(const char *fmt)
|
||||
|
||||
format = LOG_FORMATS - 1;
|
||||
while (format > 0 && log_formats[format].name
|
||||
&& strcmp(log_formats[format].name, fmt))
|
||||
&& strcmp(log_formats[format].name, fmt) != 0)
|
||||
format--;
|
||||
|
||||
/* Note: 0 is LOG_FORMAT_UNSPEC */
|
||||
@ -1181,7 +1181,7 @@ int get_log_level(const char *lev)
|
||||
int level;
|
||||
|
||||
level = NB_LOG_LEVELS - 1;
|
||||
while (level >= 0 && strcmp(log_levels[level], lev))
|
||||
while (level >= 0 && strcmp(log_levels[level], lev) != 0)
|
||||
level--;
|
||||
|
||||
return level;
|
||||
@ -1195,7 +1195,7 @@ int get_log_facility(const char *fac)
|
||||
int facility;
|
||||
|
||||
facility = NB_LOG_FACILITIES - 1;
|
||||
while (facility >= 0 && strcmp(log_facilities[facility], fac))
|
||||
while (facility >= 0 && strcmp(log_facilities[facility], fac) != 0)
|
||||
facility--;
|
||||
|
||||
return facility;
|
||||
@ -3863,7 +3863,7 @@ int cfg_parse_log_forward(const char *file, int linenum, char **args, int kwm)
|
||||
px->id = strdup(args[1]);
|
||||
|
||||
}
|
||||
else if (!strcmp(args[0], "maxconn")) { /* maxconn */
|
||||
else if (strcmp(args[0], "maxconn") == 0) { /* maxconn */
|
||||
if (warnifnotcap(cfg_log_forward, PR_CAP_FE, file, linenum, args[0], " Maybe you want 'fullconn' instead ?"))
|
||||
err_code |= ERR_WARN;
|
||||
|
||||
@ -3876,7 +3876,7 @@ int cfg_parse_log_forward(const char *file, int linenum, char **args, int kwm)
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code))
|
||||
goto out;
|
||||
}
|
||||
else if (!strcmp(args[0], "backlog")) { /* backlog */
|
||||
else if (strcmp(args[0], "backlog") == 0) { /* backlog */
|
||||
if (warnifnotcap(cfg_log_forward, PR_CAP_FE, file, linenum, args[0], NULL))
|
||||
err_code |= ERR_WARN;
|
||||
|
||||
|
@ -3183,7 +3183,7 @@ static int add_hdr_case_adjust(const char *from, const char *to, char **err)
|
||||
}
|
||||
|
||||
/* Be sure only the case differs between <from> and <to> */
|
||||
if (strcasecmp(from, to)) {
|
||||
if (strcasecmp(from, to) != 0) {
|
||||
memprintf(err, "<from> and <to> must not differ execpt the case");
|
||||
return -1;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ int mworker_ext_launch_all()
|
||||
if (!(old_child->options & PROC_O_TYPE_PROG) || (!(old_child->options & PROC_O_LEAVING)))
|
||||
continue;
|
||||
|
||||
if (!strcmp(old_child->id, child->id))
|
||||
if (strcmp(old_child->id, child->id) == 0)
|
||||
old_child->options &= ~PROC_O_LEAVING;
|
||||
}
|
||||
|
||||
@ -131,7 +131,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm)
|
||||
struct mworker_proc *child;
|
||||
int err_code = 0;
|
||||
|
||||
if (!strcmp(args[0], "program")) {
|
||||
if (strcmp(args[0], "program") == 0) {
|
||||
if (alertif_too_many_args(1, file, linenum, args, &err_code)) {
|
||||
err_code |= ERR_ABORT;
|
||||
goto error;
|
||||
@ -168,7 +168,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
list_for_each_entry(child, &proc_list, list) {
|
||||
if (child->reloads == 0 && (child->options & PROC_O_TYPE_PROG)) {
|
||||
if (!strcmp(args[1], child->id)) {
|
||||
if (strcmp(args[1], child->id) == 0) {
|
||||
ha_alert("parsing [%s:%d]: '%s' program section already exists in the configuration.\n", file, linenum, args[1]);
|
||||
err_code |= ERR_ALERT | ERR_ABORT;
|
||||
goto error;
|
||||
@ -185,7 +185,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm)
|
||||
|
||||
LIST_ADDQ(&proc_list, &ext_child->list);
|
||||
|
||||
} else if (!strcmp(args[0], "command")) {
|
||||
} else if (strcmp(args[0], "command") == 0) {
|
||||
int arg_nb = 0;
|
||||
int i = 0;
|
||||
|
||||
@ -217,7 +217,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm)
|
||||
}
|
||||
ext_child->command[i] = NULL;
|
||||
|
||||
} else if (!strcmp(args[0], "option")) {
|
||||
} else if (strcmp(args[0], "option") == 0) {
|
||||
|
||||
if (*(args[1]) == '\0') {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects an option name.\n",
|
||||
@ -240,7 +240,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm)
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
goto error;
|
||||
}
|
||||
} else if (!strcmp(args[0], "user")) {
|
||||
} else if (strcmp(args[0], "user") == 0) {
|
||||
struct passwd *ext_child_user;
|
||||
if (*(args[1]) == '\0') {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects a user name.\n",
|
||||
@ -265,7 +265,7 @@ int cfg_parse_program(const char *file, int linenum, char **args, int kwm)
|
||||
ha_alert("parsing [%s:%d] : cannot find user id for '%s' (%d:%s)\n", file, linenum, args[1], errno, strerror(errno));
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
} else if (!strcmp(args[0], "group")) {
|
||||
} else if (strcmp(args[0], "group") == 0) {
|
||||
struct group *ext_child_group;
|
||||
if (*(args[1]) == '\0') {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects a group name.\n",
|
||||
|
@ -3168,7 +3168,7 @@ static int cli_parse_show_peers(char **args, char *payload, struct appctx *appct
|
||||
struct peers *p;
|
||||
|
||||
for (p = cfg_peers; p; p = p->next) {
|
||||
if (!strcmp(p->id, args[2])) {
|
||||
if (strcmp(p->id, args[2]) == 0) {
|
||||
appctx->ctx.cfgpeers.target = p;
|
||||
break;
|
||||
}
|
||||
|
76
src/proxy.c
76
src/proxy.c
@ -206,60 +206,60 @@ static int proxy_parse_timeout(char **args, int section, struct proxy *proxy,
|
||||
args++;
|
||||
|
||||
name = args[0];
|
||||
if (!strcmp(args[0], "client")) {
|
||||
if (strcmp(args[0], "client") == 0) {
|
||||
name = "client";
|
||||
tv = &proxy->timeout.client;
|
||||
td = &defpx->timeout.client;
|
||||
cap = PR_CAP_FE;
|
||||
} else if (!strcmp(args[0], "tarpit")) {
|
||||
} else if (strcmp(args[0], "tarpit") == 0) {
|
||||
tv = &proxy->timeout.tarpit;
|
||||
td = &defpx->timeout.tarpit;
|
||||
cap = PR_CAP_FE | PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "http-keep-alive")) {
|
||||
} else if (strcmp(args[0], "http-keep-alive") == 0) {
|
||||
tv = &proxy->timeout.httpka;
|
||||
td = &defpx->timeout.httpka;
|
||||
cap = PR_CAP_FE | PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "http-request")) {
|
||||
} else if (strcmp(args[0], "http-request") == 0) {
|
||||
tv = &proxy->timeout.httpreq;
|
||||
td = &defpx->timeout.httpreq;
|
||||
cap = PR_CAP_FE | PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "server")) {
|
||||
} else if (strcmp(args[0], "server") == 0) {
|
||||
name = "server";
|
||||
tv = &proxy->timeout.server;
|
||||
td = &defpx->timeout.server;
|
||||
cap = PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "connect")) {
|
||||
} else if (strcmp(args[0], "connect") == 0) {
|
||||
name = "connect";
|
||||
tv = &proxy->timeout.connect;
|
||||
td = &defpx->timeout.connect;
|
||||
cap = PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "check")) {
|
||||
} else if (strcmp(args[0], "check") == 0) {
|
||||
tv = &proxy->timeout.check;
|
||||
td = &defpx->timeout.check;
|
||||
cap = PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "queue")) {
|
||||
} else if (strcmp(args[0], "queue") == 0) {
|
||||
tv = &proxy->timeout.queue;
|
||||
td = &defpx->timeout.queue;
|
||||
cap = PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "tunnel")) {
|
||||
} else if (strcmp(args[0], "tunnel") == 0) {
|
||||
tv = &proxy->timeout.tunnel;
|
||||
td = &defpx->timeout.tunnel;
|
||||
cap = PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "client-fin")) {
|
||||
} else if (strcmp(args[0], "client-fin") == 0) {
|
||||
tv = &proxy->timeout.clientfin;
|
||||
td = &defpx->timeout.clientfin;
|
||||
cap = PR_CAP_FE;
|
||||
} else if (!strcmp(args[0], "server-fin")) {
|
||||
} else if (strcmp(args[0], "server-fin") == 0) {
|
||||
tv = &proxy->timeout.serverfin;
|
||||
td = &defpx->timeout.serverfin;
|
||||
cap = PR_CAP_BE;
|
||||
} else if (!strcmp(args[0], "clitimeout")) {
|
||||
} else if (strcmp(args[0], "clitimeout") == 0) {
|
||||
memprintf(err, "the '%s' directive is not supported anymore since HAProxy 2.1. Use 'timeout client'.", args[0]);
|
||||
return -1;
|
||||
} else if (!strcmp(args[0], "srvtimeout")) {
|
||||
} else if (strcmp(args[0], "srvtimeout") == 0) {
|
||||
memprintf(err, "the '%s' directive is not supported anymore since HAProxy 2.1. Use 'timeout server'.", args[0]);
|
||||
return -1;
|
||||
} else if (!strcmp(args[0], "contimeout")) {
|
||||
} else if (strcmp(args[0], "contimeout") == 0) {
|
||||
memprintf(err, "the '%s' directive is not supported anymore since HAProxy 2.1. Use 'timeout connect'.", args[0]);
|
||||
return -1;
|
||||
} else {
|
||||
@ -522,42 +522,42 @@ proxy_parse_retry_on(char **args, int section, struct proxy *curpx,
|
||||
}
|
||||
curpx->retry_type = 0;
|
||||
for (i = 1; *(args[i]); i++) {
|
||||
if (!strcmp(args[i], "conn-failure"))
|
||||
if (strcmp(args[i], "conn-failure") == 0)
|
||||
curpx->retry_type |= PR_RE_CONN_FAILED;
|
||||
else if (!strcmp(args[i], "empty-response"))
|
||||
else if (strcmp(args[i], "empty-response") == 0)
|
||||
curpx->retry_type |= PR_RE_DISCONNECTED;
|
||||
else if (!strcmp(args[i], "response-timeout"))
|
||||
else if (strcmp(args[i], "response-timeout") == 0)
|
||||
curpx->retry_type |= PR_RE_TIMEOUT;
|
||||
else if (!strcmp(args[i], "401"))
|
||||
else if (strcmp(args[i], "401") == 0)
|
||||
curpx->retry_type |= PR_RE_401;
|
||||
else if (!strcmp(args[i], "403"))
|
||||
else if (strcmp(args[i], "403") == 0)
|
||||
curpx->retry_type |= PR_RE_403;
|
||||
else if (!strcmp(args[i], "404"))
|
||||
else if (strcmp(args[i], "404") == 0)
|
||||
curpx->retry_type |= PR_RE_404;
|
||||
else if (!strcmp(args[i], "408"))
|
||||
else if (strcmp(args[i], "408") == 0)
|
||||
curpx->retry_type |= PR_RE_408;
|
||||
else if (!strcmp(args[i], "425"))
|
||||
else if (strcmp(args[i], "425") == 0)
|
||||
curpx->retry_type |= PR_RE_425;
|
||||
else if (!strcmp(args[i], "500"))
|
||||
else if (strcmp(args[i], "500") == 0)
|
||||
curpx->retry_type |= PR_RE_500;
|
||||
else if (!strcmp(args[i], "501"))
|
||||
else if (strcmp(args[i], "501") == 0)
|
||||
curpx->retry_type |= PR_RE_501;
|
||||
else if (!strcmp(args[i], "502"))
|
||||
else if (strcmp(args[i], "502") == 0)
|
||||
curpx->retry_type |= PR_RE_502;
|
||||
else if (!strcmp(args[i], "503"))
|
||||
else if (strcmp(args[i], "503") == 0)
|
||||
curpx->retry_type |= PR_RE_503;
|
||||
else if (!strcmp(args[i], "504"))
|
||||
else if (strcmp(args[i], "504") == 0)
|
||||
curpx->retry_type |= PR_RE_504;
|
||||
else if (!strcmp(args[i], "0rtt-rejected"))
|
||||
else if (strcmp(args[i], "0rtt-rejected") == 0)
|
||||
curpx->retry_type |= PR_RE_EARLY_ERROR;
|
||||
else if (!strcmp(args[i], "junk-response"))
|
||||
else if (strcmp(args[i], "junk-response") == 0)
|
||||
curpx->retry_type |= PR_RE_JUNK_REQUEST;
|
||||
else if (!(strcmp(args[i], "all-retryable-errors")))
|
||||
curpx->retry_type |= PR_RE_CONN_FAILED | PR_RE_DISCONNECTED |
|
||||
PR_RE_TIMEOUT | PR_RE_500 | PR_RE_502 |
|
||||
PR_RE_503 | PR_RE_504 | PR_RE_EARLY_ERROR |
|
||||
PR_RE_JUNK_REQUEST;
|
||||
else if (!strcmp(args[i], "none")) {
|
||||
else if (strcmp(args[i], "none") == 0) {
|
||||
if (i != 1 || *args[i + 1]) {
|
||||
memprintf(err, "'%s' 'none' keyworld only usable alone", args[0]);
|
||||
return -1;
|
||||
@ -596,14 +596,14 @@ static int proxy_parse_tcpka_cnt(char **args, int section, struct proxy *proxy,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!strcmp(args[0], "clitcpka-cnt")) {
|
||||
if (strcmp(args[0], "clitcpka-cnt") == 0) {
|
||||
if (!(proxy->cap & PR_CAP_FE)) {
|
||||
memprintf(err, "%s will be ignored because %s '%s' has no frontend capability",
|
||||
args[0], proxy_type_str(proxy), proxy->id);
|
||||
retval = 1;
|
||||
}
|
||||
proxy->clitcpka_cnt = tcpka_cnt;
|
||||
} else if (!strcmp(args[0], "srvtcpka-cnt")) {
|
||||
} else if (strcmp(args[0], "srvtcpka-cnt") == 0) {
|
||||
if (!(proxy->cap & PR_CAP_BE)) {
|
||||
memprintf(err, "%s will be ignored because %s '%s' has no backend capability",
|
||||
args[0], proxy_type_str(proxy), proxy->id);
|
||||
@ -652,14 +652,14 @@ static int proxy_parse_tcpka_idle(char **args, int section, struct proxy *proxy,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!strcmp(args[0], "clitcpka-idle")) {
|
||||
if (strcmp(args[0], "clitcpka-idle") == 0) {
|
||||
if (!(proxy->cap & PR_CAP_FE)) {
|
||||
memprintf(err, "%s will be ignored because %s '%s' has no frontend capability",
|
||||
args[0], proxy_type_str(proxy), proxy->id);
|
||||
retval = 1;
|
||||
}
|
||||
proxy->clitcpka_idle = tcpka_idle;
|
||||
} else if (!strcmp(args[0], "srvtcpka-idle")) {
|
||||
} else if (strcmp(args[0], "srvtcpka-idle") == 0) {
|
||||
if (!(proxy->cap & PR_CAP_BE)) {
|
||||
memprintf(err, "%s will be ignored because %s '%s' has no backend capability",
|
||||
args[0], proxy_type_str(proxy), proxy->id);
|
||||
@ -708,14 +708,14 @@ static int proxy_parse_tcpka_intvl(char **args, int section, struct proxy *proxy
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!strcmp(args[0], "clitcpka-intvl")) {
|
||||
if (strcmp(args[0], "clitcpka-intvl") == 0) {
|
||||
if (!(proxy->cap & PR_CAP_FE)) {
|
||||
memprintf(err, "%s will be ignored because %s '%s' has no frontend capability",
|
||||
args[0], proxy_type_str(proxy), proxy->id);
|
||||
retval = 1;
|
||||
}
|
||||
proxy->clitcpka_intvl = tcpka_intvl;
|
||||
} else if (!strcmp(args[0], "srvtcpka-intvl")) {
|
||||
} else if (strcmp(args[0], "srvtcpka-intvl") == 0) {
|
||||
if (!(proxy->cap & PR_CAP_BE)) {
|
||||
memprintf(err, "%s will be ignored because %s '%s' has no backend capability",
|
||||
args[0], proxy_type_str(proxy), proxy->id);
|
||||
@ -942,7 +942,7 @@ struct server *findserver(const struct proxy *px, const char *name) {
|
||||
return NULL;
|
||||
|
||||
for (cursrv = px->srv; cursrv; cursrv = cursrv->next) {
|
||||
if (strcmp(cursrv->id, name))
|
||||
if (strcmp(cursrv->id, name) != 0)
|
||||
continue;
|
||||
|
||||
if (!target) {
|
||||
@ -1443,7 +1443,7 @@ int stream_set_backend(struct stream *s, struct proxy *be)
|
||||
&s->si[0].wait_event);
|
||||
if (conn_upgrade_mux_fe(conn, cs, &s->req.buf, ist(""), PROTO_MODE_HTTP) == -1)
|
||||
return 0;
|
||||
if (!strcmp(conn->mux->name, "H2")) {
|
||||
if (strcmp(conn->mux->name, "H2") == 0) {
|
||||
/* For HTTP/2, destroy the conn_stream,
|
||||
* disable logging, and pretend that we
|
||||
* failed, to that the stream is
|
||||
|
@ -1290,7 +1290,7 @@ int smp_resolve_args(struct proxy *p)
|
||||
}
|
||||
|
||||
if (p->uri_auth && p->uri_auth->userlist &&
|
||||
!strcmp(p->uri_auth->userlist->name, arg->data.str.area))
|
||||
strcmp(p->uri_auth->userlist->name, arg->data.str.area) == 0)
|
||||
ul = p->uri_auth->userlist;
|
||||
else
|
||||
ul = auth_find_userlist(arg->data.str.area);
|
||||
|
114
src/server.c
114
src/server.c
@ -466,7 +466,7 @@ static int srv_parse_namespace(char **args, int *cur_arg,
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
|
||||
if (!strcmp(arg, "*")) {
|
||||
if (strcmp(arg, "*") == 0) {
|
||||
/* Use the namespace associated with the connection (if present). */
|
||||
newsrv->flags |= SRV_F_USE_NS_FROM_PP;
|
||||
return 0;
|
||||
@ -575,25 +575,25 @@ static int srv_parse_proxy_v2_options(char **args, int *cur_arg,
|
||||
n = strchr(p, ',');
|
||||
if (n)
|
||||
*n++ = '\0';
|
||||
if (!strcmp(p, "ssl")) {
|
||||
if (strcmp(p, "ssl") == 0) {
|
||||
newsrv->pp_opts |= SRV_PP_V2_SSL;
|
||||
} else if (!strcmp(p, "cert-cn")) {
|
||||
} else if (strcmp(p, "cert-cn") == 0) {
|
||||
newsrv->pp_opts |= SRV_PP_V2_SSL;
|
||||
newsrv->pp_opts |= SRV_PP_V2_SSL_CN;
|
||||
} else if (!strcmp(p, "cert-key")) {
|
||||
} else if (strcmp(p, "cert-key") == 0) {
|
||||
newsrv->pp_opts |= SRV_PP_V2_SSL;
|
||||
newsrv->pp_opts |= SRV_PP_V2_SSL_KEY_ALG;
|
||||
} else if (!strcmp(p, "cert-sig")) {
|
||||
} else if (strcmp(p, "cert-sig") == 0) {
|
||||
newsrv->pp_opts |= SRV_PP_V2_SSL;
|
||||
newsrv->pp_opts |= SRV_PP_V2_SSL_SIG_ALG;
|
||||
} else if (!strcmp(p, "ssl-cipher")) {
|
||||
} else if (strcmp(p, "ssl-cipher") == 0) {
|
||||
newsrv->pp_opts |= SRV_PP_V2_SSL;
|
||||
newsrv->pp_opts |= SRV_PP_V2_SSL_CIPHER;
|
||||
} else if (!strcmp(p, "authority")) {
|
||||
} else if (strcmp(p, "authority") == 0) {
|
||||
newsrv->pp_opts |= SRV_PP_V2_AUTHORITY;
|
||||
} else if (!strcmp(p, "crc32c")) {
|
||||
} else if (strcmp(p, "crc32c") == 0) {
|
||||
newsrv->pp_opts |= SRV_PP_V2_CRC32C;
|
||||
} else if (!strcmp(p, "unique-id")) {
|
||||
} else if (strcmp(p, "unique-id") == 0) {
|
||||
newsrv->pp_opts |= SRV_PP_V2_UNIQUE_ID;
|
||||
} else
|
||||
goto fail;
|
||||
@ -617,13 +617,13 @@ static int srv_parse_observe(char **args, int *cur_arg,
|
||||
return ERR_ALERT | ERR_FATAL;
|
||||
}
|
||||
|
||||
if (!strcmp(arg, "none")) {
|
||||
if (strcmp(arg, "none") == 0) {
|
||||
newsrv->observe = HANA_OBS_NONE;
|
||||
}
|
||||
else if (!strcmp(arg, "layer4")) {
|
||||
else if (strcmp(arg, "layer4") == 0) {
|
||||
newsrv->observe = HANA_OBS_LAYER4;
|
||||
}
|
||||
else if (!strcmp(arg, "layer7")) {
|
||||
else if (strcmp(arg, "layer7") == 0) {
|
||||
if (curproxy->mode != PR_MODE_HTTP) {
|
||||
memprintf(err, "'%s' can only be used in http proxies.\n", arg);
|
||||
return ERR_ALERT;
|
||||
@ -711,18 +711,18 @@ static int srv_parse_source(char **args, int *cur_arg,
|
||||
|
||||
*cur_arg += 2;
|
||||
while (*(args[*cur_arg])) {
|
||||
if (!strcmp(args[*cur_arg], "usesrc")) { /* address to use outside */
|
||||
if (strcmp(args[*cur_arg], "usesrc") == 0) { /* address to use outside */
|
||||
#if defined(CONFIG_HAP_TRANSPARENT)
|
||||
if (!*args[*cur_arg + 1]) {
|
||||
ha_alert("'usesrc' expects <addr>[:<port>], 'client', 'clientip', "
|
||||
"or 'hdr_ip(name,#)' as argument.\n");
|
||||
goto err;
|
||||
}
|
||||
if (!strcmp(args[*cur_arg + 1], "client")) {
|
||||
if (strcmp(args[*cur_arg + 1], "client") == 0) {
|
||||
newsrv->conn_src.opts &= ~CO_SRC_TPROXY_MASK;
|
||||
newsrv->conn_src.opts |= CO_SRC_TPROXY_CLI;
|
||||
}
|
||||
else if (!strcmp(args[*cur_arg + 1], "clientip")) {
|
||||
else if (strcmp(args[*cur_arg + 1], "clientip") == 0) {
|
||||
newsrv->conn_src.opts &= ~CO_SRC_TPROXY_MASK;
|
||||
newsrv->conn_src.opts |= CO_SRC_TPROXY_CIP;
|
||||
}
|
||||
@ -790,7 +790,7 @@ static int srv_parse_source(char **args, int *cur_arg,
|
||||
#endif /* defined(CONFIG_HAP_TRANSPARENT) */
|
||||
} /* "usesrc" */
|
||||
|
||||
if (!strcmp(args[*cur_arg], "interface")) { /* specifically bind to this interface */
|
||||
if (strcmp(args[*cur_arg], "interface") == 0) { /* specifically bind to this interface */
|
||||
#ifdef SO_BINDTODEVICE
|
||||
if (!*args[*cur_arg + 1]) {
|
||||
ha_alert("'%s' : missing interface name.\n", args[0]);
|
||||
@ -1944,13 +1944,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
unsigned val;
|
||||
char *fqdn = NULL;
|
||||
|
||||
if (!strcmp(args[0], "server") ||
|
||||
!strcmp(args[0], "peer") ||
|
||||
!strcmp(args[0], "default-server") ||
|
||||
!strcmp(args[0], "server-template")) {
|
||||
if (strcmp(args[0], "server") == 0 ||
|
||||
strcmp(args[0], "peer") == 0 ||
|
||||
strcmp(args[0], "default-server") == 0 ||
|
||||
strcmp(args[0], "server-template") == 0) {
|
||||
int cur_arg;
|
||||
int defsrv = (*args[0] == 'd');
|
||||
int srv = !defsrv && (*args[0] == 'p' || !strcmp(args[0], "server"));
|
||||
int srv = !defsrv && (*args[0] == 'p' || strcmp(args[0], "server") == 0);
|
||||
int srv_tmpl = !defsrv && !srv;
|
||||
int tmpl_range_low = 0, tmpl_range_high = 0;
|
||||
|
||||
@ -2109,7 +2109,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
}
|
||||
|
||||
while (*args[cur_arg]) {
|
||||
if (!strcmp(args[cur_arg], "init-addr")) {
|
||||
if (strcmp(args[cur_arg], "init-addr") == 0) {
|
||||
char *p, *end;
|
||||
int done;
|
||||
struct sockaddr_storage sa;
|
||||
@ -2124,13 +2124,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
*(end++) = 0;
|
||||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
if (!strcmp(p, "libc")) {
|
||||
if (strcmp(p, "libc") == 0) {
|
||||
done = srv_append_initaddr(&newsrv->init_addr_methods, SRV_IADDR_LIBC);
|
||||
}
|
||||
else if (!strcmp(p, "last")) {
|
||||
else if (strcmp(p, "last") == 0) {
|
||||
done = srv_append_initaddr(&newsrv->init_addr_methods, SRV_IADDR_LAST);
|
||||
}
|
||||
else if (!strcmp(p, "none")) {
|
||||
else if (strcmp(p, "none") == 0) {
|
||||
done = srv_append_initaddr(&newsrv->init_addr_methods, SRV_IADDR_NONE);
|
||||
}
|
||||
else if (str2ip2(p, &sa, 0)) {
|
||||
@ -2158,12 +2158,12 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
}
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "resolvers")) {
|
||||
else if (strcmp(args[cur_arg], "resolvers") == 0) {
|
||||
free(newsrv->resolvers_id);
|
||||
newsrv->resolvers_id = strdup(args[cur_arg + 1]);
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "resolve-opts")) {
|
||||
else if (strcmp(args[cur_arg], "resolve-opts") == 0) {
|
||||
char *p, *end;
|
||||
|
||||
for (p = args[cur_arg + 1]; *p; p = end) {
|
||||
@ -2172,13 +2172,13 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
if (*end)
|
||||
*(end++) = 0;
|
||||
|
||||
if (!strcmp(p, "allow-dup-ip")) {
|
||||
if (strcmp(p, "allow-dup-ip") == 0) {
|
||||
newsrv->dns_opts.accept_duplicate_ip = 1;
|
||||
}
|
||||
else if (!strcmp(p, "ignore-weight")) {
|
||||
else if (strcmp(p, "ignore-weight") == 0) {
|
||||
newsrv->dns_opts.ignore_weight = 1;
|
||||
}
|
||||
else if (!strcmp(p, "prevent-dup-ip")) {
|
||||
else if (strcmp(p, "prevent-dup-ip") == 0) {
|
||||
newsrv->dns_opts.accept_duplicate_ip = 0;
|
||||
}
|
||||
else {
|
||||
@ -2191,10 +2191,10 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "resolve-prefer")) {
|
||||
if (!strcmp(args[cur_arg + 1], "ipv4"))
|
||||
else if (strcmp(args[cur_arg], "resolve-prefer") == 0) {
|
||||
if (strcmp(args[cur_arg + 1], "ipv4") == 0)
|
||||
newsrv->dns_opts.family_prio = AF_INET;
|
||||
else if (!strcmp(args[cur_arg + 1], "ipv6"))
|
||||
else if (strcmp(args[cur_arg + 1], "ipv6") == 0)
|
||||
newsrv->dns_opts.family_prio = AF_INET6;
|
||||
else {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects either ipv4 or ipv6 as argument.\n",
|
||||
@ -2204,7 +2204,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
}
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "resolve-net")) {
|
||||
else if (strcmp(args[cur_arg], "resolve-net") == 0) {
|
||||
char *p, *e;
|
||||
unsigned char mask;
|
||||
struct dns_options *opt;
|
||||
@ -2260,7 +2260,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "weight")) {
|
||||
else if (strcmp(args[cur_arg], "weight") == 0) {
|
||||
int w;
|
||||
w = atol(args[cur_arg + 1]);
|
||||
if (w < 0 || w > SRV_UWGHT_MAX) {
|
||||
@ -2272,10 +2272,10 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
newsrv->uweight = newsrv->iweight = w;
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "log-proto")) {
|
||||
if (!strcmp(args[cur_arg + 1], "legacy"))
|
||||
else if (strcmp(args[cur_arg], "log-proto") == 0) {
|
||||
if (strcmp(args[cur_arg + 1], "legacy") == 0)
|
||||
newsrv->log_proto = SRV_LOG_PROTO_LEGACY;
|
||||
else if (!strcmp(args[cur_arg + 1], "octet-count"))
|
||||
else if (strcmp(args[cur_arg + 1], "octet-count") == 0)
|
||||
newsrv->log_proto = SRV_LOG_PROTO_OCTET_COUNTING;
|
||||
else {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects one of 'legacy' or "
|
||||
@ -2286,19 +2286,19 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
}
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "minconn")) {
|
||||
else if (strcmp(args[cur_arg], "minconn") == 0) {
|
||||
newsrv->minconn = atol(args[cur_arg + 1]);
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "maxconn")) {
|
||||
else if (strcmp(args[cur_arg], "maxconn") == 0) {
|
||||
newsrv->maxconn = atol(args[cur_arg + 1]);
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "maxqueue")) {
|
||||
else if (strcmp(args[cur_arg], "maxqueue") == 0) {
|
||||
newsrv->maxqueue = atol(args[cur_arg + 1]);
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "slowstart")) {
|
||||
else if (strcmp(args[cur_arg], "slowstart") == 0) {
|
||||
/* slowstart is stored in seconds */
|
||||
const char *err = parse_time_err(args[cur_arg + 1], &val, TIME_UNIT_MS);
|
||||
|
||||
@ -2323,14 +2323,14 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
newsrv->slowstart = (val + 999) / 1000;
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "on-error")) {
|
||||
if (!strcmp(args[cur_arg + 1], "fastinter"))
|
||||
else if (strcmp(args[cur_arg], "on-error") == 0) {
|
||||
if (strcmp(args[cur_arg + 1], "fastinter") == 0)
|
||||
newsrv->onerror = HANA_ONERR_FASTINTER;
|
||||
else if (!strcmp(args[cur_arg + 1], "fail-check"))
|
||||
else if (strcmp(args[cur_arg + 1], "fail-check") == 0)
|
||||
newsrv->onerror = HANA_ONERR_FAILCHK;
|
||||
else if (!strcmp(args[cur_arg + 1], "sudden-death"))
|
||||
else if (strcmp(args[cur_arg + 1], "sudden-death") == 0)
|
||||
newsrv->onerror = HANA_ONERR_SUDDTH;
|
||||
else if (!strcmp(args[cur_arg + 1], "mark-down"))
|
||||
else if (strcmp(args[cur_arg + 1], "mark-down") == 0)
|
||||
newsrv->onerror = HANA_ONERR_MARKDWN;
|
||||
else {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects one of 'fastinter', "
|
||||
@ -2342,8 +2342,8 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "on-marked-down")) {
|
||||
if (!strcmp(args[cur_arg + 1], "shutdown-sessions"))
|
||||
else if (strcmp(args[cur_arg], "on-marked-down") == 0) {
|
||||
if (strcmp(args[cur_arg + 1], "shutdown-sessions") == 0)
|
||||
newsrv->onmarkeddown = HANA_ONMARKEDDOWN_SHUTDOWNSESSIONS;
|
||||
else {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects 'shutdown-sessions' but got '%s'\n",
|
||||
@ -2354,8 +2354,8 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "on-marked-up")) {
|
||||
if (!strcmp(args[cur_arg + 1], "shutdown-backup-sessions"))
|
||||
else if (strcmp(args[cur_arg], "on-marked-up") == 0) {
|
||||
if (strcmp(args[cur_arg + 1], "shutdown-backup-sessions") == 0)
|
||||
newsrv->onmarkedup = HANA_ONMARKEDUP_SHUTDOWNBACKUPSESSIONS;
|
||||
else {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects 'shutdown-backup-sessions' but got '%s'\n",
|
||||
@ -2366,7 +2366,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "error-limit")) {
|
||||
else if (strcmp(args[cur_arg], "error-limit") == 0) {
|
||||
if (!*args[cur_arg + 1]) {
|
||||
ha_alert("parsing [%s:%d]: '%s' expects an integer argument.\n",
|
||||
file, linenum, args[cur_arg]);
|
||||
@ -2384,7 +2384,7 @@ int parse_server(const char *file, int linenum, char **args, struct proxy *curpr
|
||||
}
|
||||
cur_arg += 2;
|
||||
}
|
||||
else if (!strcmp(args[cur_arg], "usesrc")) { /* address to use outside: needs "source" first */
|
||||
else if (strcmp(args[cur_arg], "usesrc") == 0) { /* address to use outside: needs "source" first */
|
||||
ha_alert("parsing [%s:%d] : '%s' only allowed after a '%s' statement.\n",
|
||||
file, linenum, "usesrc", "source");
|
||||
err_code |= ERR_ALERT | ERR_FATAL;
|
||||
@ -2910,11 +2910,11 @@ static void srv_update_state(struct server *srv, int version, char **params)
|
||||
server_recalc_eweight(srv, 1);
|
||||
|
||||
/* load server IP address */
|
||||
if (strcmp(params[0], "-"))
|
||||
if (strcmp(params[0], "-") != 0)
|
||||
srv->lastaddr = strdup(params[0]);
|
||||
|
||||
if (fqdn && srv->hostname) {
|
||||
if (!strcmp(srv->hostname, fqdn)) {
|
||||
if (strcmp(srv->hostname, fqdn) == 0) {
|
||||
/* Here we reset the 'set from stats socket FQDN' flag
|
||||
* to support such transitions:
|
||||
* Let's say initial FQDN value is foo1 (in configuration file).
|
||||
@ -4081,7 +4081,7 @@ int srv_set_fqdn(struct server *srv, const char *hostname, int dns_locked)
|
||||
resolution = srv->dns_requester->resolution;
|
||||
if (resolution &&
|
||||
resolution->hostname_dn &&
|
||||
!strcmp(resolution->hostname_dn, hostname_dn))
|
||||
strcmp(resolution->hostname_dn, hostname_dn) == 0)
|
||||
goto end;
|
||||
|
||||
dns_unlink_resolution(srv->dns_requester);
|
||||
@ -4256,7 +4256,7 @@ const char *update_server_fqdn(struct server *server, const char *fqdn, const ch
|
||||
msg = get_trash_chunk();
|
||||
chunk_reset(msg);
|
||||
|
||||
if (server->hostname && !strcmp(fqdn, server->hostname)) {
|
||||
if (server->hostname && strcmp(fqdn, server->hostname) == 0) {
|
||||
chunk_appendf(msg, "no need to change the FDQN");
|
||||
goto out;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ int ssl_sock_load_files_into_ckch(const char *path, struct cert_key_and_chain *c
|
||||
/* look for the extension */
|
||||
if ((ext = strrchr(fp->area, '.'))) {
|
||||
|
||||
if (!strcmp(ext, ".crt")) {
|
||||
if (strcmp(ext, ".crt") == 0) {
|
||||
*ext = '\0';
|
||||
fp->data = strlen(fp->area);
|
||||
}
|
||||
@ -1220,7 +1220,7 @@ static int cli_parse_show_cert(char **args, char *payload, struct appctx *appctx
|
||||
|
||||
ckchs = ckchs_transaction.new_ckchs;
|
||||
|
||||
if (strcmp(args[3] + 1, ckchs->path))
|
||||
if (strcmp(args[3] + 1, ckchs->path) != 0)
|
||||
goto error;
|
||||
|
||||
} else {
|
||||
@ -1541,7 +1541,7 @@ static int cli_parse_set_cert(char **args, char *payload, struct appctx *appctx,
|
||||
/* check which type of file we want to update */
|
||||
for (i = 0; cert_exts[i].type < CERT_TYPE_MAX; i++) {
|
||||
end = strrchr(buf->area, '.');
|
||||
if (end && *cert_exts[i].ext && (!strcmp(end + 1, cert_exts[i].ext))) {
|
||||
if (end && *cert_exts[i].ext && (strcmp(end + 1, cert_exts[i].ext) == 0)) {
|
||||
*end = '\0';
|
||||
buf->data = strlen(buf->area);
|
||||
type = cert_exts[i].type;
|
||||
|
@ -684,7 +684,7 @@ int crtlist_load_cert_dir(char *path, struct bind_conf *bind_conf, struct crtlis
|
||||
struct dirent *de = de_list[i];
|
||||
|
||||
end = strrchr(de->d_name, '.');
|
||||
if (end && (!strcmp(end, ".issuer") || !strcmp(end, ".ocsp") || !strcmp(end, ".sctl") || !strcmp(end, ".key")))
|
||||
if (end && (strcmp(end, ".issuer") == 0 || strcmp(end, ".ocsp") == 0 || strcmp(end, ".sctl") == 0 || strcmp(end, ".key") == 0))
|
||||
goto ignore_entry;
|
||||
|
||||
snprintf(fp, sizeof(fp), "%s/%s", path, de->d_name);
|
||||
@ -985,7 +985,7 @@ static int cli_parse_dump_crtlist(char **args, char *payload, struct appctx *app
|
||||
appctx->ctx.cli.p0 = NULL;
|
||||
appctx->ctx.cli.p1 = NULL;
|
||||
|
||||
if (*args[3] && !strcmp(args[3], "-n")) {
|
||||
if (*args[3] && strcmp(args[3], "-n") == 0) {
|
||||
mode = 's';
|
||||
filename = args[4];
|
||||
} else {
|
||||
|
@ -2490,7 +2490,7 @@ int ssl_sock_switchctx_cbk(SSL *ssl, int *al, void *arg)
|
||||
/* If this is a wildcard, look for an exclusion on the same crt-list line */
|
||||
sni = container_of(n, struct sni_ctx, name);
|
||||
list_for_each_entry(sni_tmp, &sni->ckch_inst->sni_ctx, by_ckch_inst) {
|
||||
if (sni_tmp->neg && (!strcmp((const char *)sni_tmp->name.key, trash.area))) {
|
||||
if (sni_tmp->neg && (strcmp((const char *)sni_tmp->name.key, trash.area) == 0)) {
|
||||
skip = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -2501,7 +2501,7 @@ int stats_dump_proxy_to_buffer(struct stream_interface *si, struct htx *htx,
|
||||
break;
|
||||
|
||||
/* match '.' which means 'self' proxy */
|
||||
if (!strcmp(scope->px_id, ".") && px == s->be)
|
||||
if (strcmp(scope->px_id, ".") == 0 && px == s->be)
|
||||
break;
|
||||
scope = scope->next;
|
||||
}
|
||||
@ -4319,12 +4319,12 @@ static int cli_parse_show_stat(char **args, char *payload, struct appctx *appctx
|
||||
|
||||
/* proxy is the default domain */
|
||||
appctx->ctx.stats.domain = STATS_DOMAIN_PROXY;
|
||||
if (!strcmp(args[arg], "domain")) {
|
||||
if (strcmp(args[arg], "domain") == 0) {
|
||||
++args;
|
||||
|
||||
if (!strcmp(args[arg], "proxy")) {
|
||||
if (strcmp(args[arg], "proxy") == 0) {
|
||||
++args;
|
||||
} else if (!strcmp(args[arg], "dns")) {
|
||||
} else if (strcmp(args[arg], "dns") == 0) {
|
||||
appctx->ctx.stats.domain = STATS_DOMAIN_DNS;
|
||||
++args;
|
||||
} else {
|
||||
|
@ -71,7 +71,7 @@ struct stktable *stktable_find_by_name(const char *name)
|
||||
node = ebis_lookup(&stktable_by_name, name);
|
||||
if (node) {
|
||||
t = container_of(node, struct stktable, name);
|
||||
if (!strcmp(t->id, name))
|
||||
if (strcmp(t->id, name) == 0)
|
||||
return t;
|
||||
}
|
||||
|
||||
|
@ -259,13 +259,13 @@ static enum act_parse_ret tcp_parse_set_src_dst(const char **args, int *orig_arg
|
||||
rule->arg.expr = expr;
|
||||
rule->action = ACT_CUSTOM;
|
||||
|
||||
if (!strcmp(args[*orig_arg-1], "set-src")) {
|
||||
if (strcmp(args[*orig_arg - 1], "set-src") == 0) {
|
||||
rule->action_ptr = tcp_action_req_set_src;
|
||||
} else if (!strcmp(args[*orig_arg-1], "set-src-port")) {
|
||||
} else if (strcmp(args[*orig_arg - 1], "set-src-port") == 0) {
|
||||
rule->action_ptr = tcp_action_req_set_src_port;
|
||||
} else if (!strcmp(args[*orig_arg-1], "set-dst")) {
|
||||
} else if (strcmp(args[*orig_arg - 1], "set-dst") == 0) {
|
||||
rule->action_ptr = tcp_action_req_set_dst;
|
||||
} else if (!strcmp(args[*orig_arg-1], "set-dst-port")) {
|
||||
} else if (strcmp(args[*orig_arg - 1], "set-dst-port") == 0) {
|
||||
rule->action_ptr = tcp_action_req_set_dst_port;
|
||||
} else {
|
||||
return ACT_RET_PRS_ERR;
|
||||
|
@ -741,12 +741,12 @@ static int tcp_parse_request_rule(char **args, int arg, int section_type,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!strcmp(args[arg], "accept")) {
|
||||
if (strcmp(args[arg], "accept") == 0) {
|
||||
arg++;
|
||||
rule->action = ACT_ACTION_ALLOW;
|
||||
rule->flags |= ACT_FLAG_FINAL;
|
||||
}
|
||||
else if (!strcmp(args[arg], "reject")) {
|
||||
else if (strcmp(args[arg], "reject") == 0) {
|
||||
arg++;
|
||||
rule->action = ACT_ACTION_DENY;
|
||||
rule->flags |= ACT_FLAG_FINAL;
|
||||
@ -1118,7 +1118,7 @@ static int tcp_parse_tcp_req(char **args, int section_type, struct proxy *curpx,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!strcmp(args[1], "inspect-delay")) {
|
||||
if (strcmp(args[1], "inspect-delay") == 0) {
|
||||
if (curpx == defpx) {
|
||||
memprintf(err, "%s %s is not allowed in 'defaults' sections",
|
||||
args[0], args[1]);
|
||||
|
@ -238,7 +238,7 @@ struct uri_auth *stats_add_auth(struct uri_auth **root, char *user)
|
||||
return NULL;
|
||||
|
||||
for (newuser = u->userlist->users; newuser; newuser = newuser->next)
|
||||
if (!strcmp(newuser->user, user)) {
|
||||
if (strcmp(newuser->user, user) == 0) {
|
||||
ha_warning("uri auth: ignoring duplicated user '%s'.\n",
|
||||
user);
|
||||
return u;
|
||||
@ -284,7 +284,7 @@ struct uri_auth *stats_add_scope(struct uri_auth **root, char *scope)
|
||||
|
||||
scope_list = &u->scope;
|
||||
while ((old_scope = *scope_list)) {
|
||||
if (!strcmp(old_scope->px_id, scope))
|
||||
if (strcmp(old_scope->px_id, scope) == 0)
|
||||
break;
|
||||
scope_list = &old_scope->next;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user