diff options
| -rw-r--r-- | src/sp_config_keywords.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index 64b5715..8080eec 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c | |||
| @@ -366,7 +366,7 @@ int parse_disabled_functions(char *line) { | |||
| 366 | ret = parse_keywords(sp_config_funcs_disabled_functions, line); | 366 | ret = parse_keywords(sp_config_funcs_disabled_functions, line); |
| 367 | 367 | ||
| 368 | if (0 != ret) { | 368 | if (0 != ret) { |
| 369 | return ret; | 369 | goto out; |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | #define MUTUALLY_EXCLUSIVE(X, Y, STR1, STR2) \ | 372 | #define MUTUALLY_EXCLUSIVE(X, Y, STR1, STR2) \ |
| @@ -375,7 +375,7 @@ int parse_disabled_functions(char *line) { | |||
| 375 | "Invalid configuration line: 'sp.disabled_functions%s': " \ | 375 | "Invalid configuration line: 'sp.disabled_functions%s': " \ |
| 376 | "'.%s' and '.%s' are mutually exclusive on line %zu", \ | 376 | "'.%s' and '.%s' are mutually exclusive on line %zu", \ |
| 377 | line, STR1, STR2, sp_line_no); \ | 377 | line, STR1, STR2, sp_line_no); \ |
| 378 | return -1; \ | 378 | ret = -1; goto out; \ |
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | MUTUALLY_EXCLUSIVE(df->value, df->r_value, "value", "value_r"); | 381 | MUTUALLY_EXCLUSIVE(df->value, df->r_value, "value", "value_r"); |
| @@ -398,7 +398,7 @@ int parse_disabled_functions(char *line) { | |||
| 398 | "Invalid configuration line: 'sp.disabled_functions%s':" | 398 | "Invalid configuration line: 'sp.disabled_functions%s':" |
| 399 | " must take a function name on line %zu", | 399 | " must take a function name on line %zu", |
| 400 | line, sp_line_no); | 400 | line, sp_line_no); |
| 401 | return -1; | 401 | ret = -1; goto out; |
| 402 | } | 402 | } |
| 403 | if (df->filename && (*ZSTR_VAL(df->filename) != '/') && | 403 | if (df->filename && (*ZSTR_VAL(df->filename) != '/') && |
| 404 | (0 != strncmp(ZSTR_VAL(df->filename), "phar://", strlen("phar://")))) { | 404 | (0 != strncmp(ZSTR_VAL(df->filename), "phar://", strlen("phar://")))) { |
| @@ -407,14 +407,14 @@ int parse_disabled_functions(char *line) { | |||
| 407 | "Invalid configuration line: 'sp.disabled_functions%s':" | 407 | "Invalid configuration line: 'sp.disabled_functions%s':" |
| 408 | "'.filename' must be an absolute path or a phar archive on line %zu", | 408 | "'.filename' must be an absolute path or a phar archive on line %zu", |
| 409 | line, sp_line_no); | 409 | line, sp_line_no); |
| 410 | return -1; | 410 | ret = -1; goto out; |
| 411 | } | 411 | } |
| 412 | if (!(allow ^ drop)) { | 412 | if (!(allow ^ drop)) { |
| 413 | sp_log_err("config", | 413 | sp_log_err("config", |
| 414 | "Invalid configuration line: 'sp.disabled_functions%s': The " | 414 | "Invalid configuration line: 'sp.disabled_functions%s': The " |
| 415 | "rule must either be a `drop` or `allow` one on line %zu", | 415 | "rule must either be a `drop` or `allow` one on line %zu", |
| 416 | line, sp_line_no); | 416 | line, sp_line_no); |
| 417 | return -1; | 417 | ret = -1; goto out; |
| 418 | } | 418 | } |
| 419 | 419 | ||
| 420 | if (pos) { | 420 | if (pos) { |
| @@ -424,7 +424,7 @@ int parse_disabled_functions(char *line) { | |||
| 424 | if (errno != 0 || endptr == ZSTR_VAL(pos)) { | 424 | if (errno != 0 || endptr == ZSTR_VAL(pos)) { |
| 425 | sp_log_err("config", "Failed to parse arg '%s' of `pos` on line %zu", | 425 | sp_log_err("config", "Failed to parse arg '%s' of `pos` on line %zu", |
| 426 | ZSTR_VAL(pos), sp_line_no); | 426 | ZSTR_VAL(pos), sp_line_no); |
| 427 | return -1; | 427 | ret = -1; goto out; |
| 428 | } | 428 | } |
| 429 | } | 429 | } |
| 430 | 430 | ||
| @@ -435,7 +435,7 @@ int parse_disabled_functions(char *line) { | |||
| 435 | if (errno != 0 || endptr == ZSTR_VAL(line_number)) { | 435 | if (errno != 0 || endptr == ZSTR_VAL(line_number)) { |
| 436 | sp_log_err("config", "Failed to parse arg '%s' of `line` on line %zu", | 436 | sp_log_err("config", "Failed to parse arg '%s' of `line` on line %zu", |
| 437 | ZSTR_VAL(line_number), sp_line_no); | 437 | ZSTR_VAL(line_number), sp_line_no); |
| 438 | return -1; | 438 | ret = -1; goto out; |
| 439 | } | 439 | } |
| 440 | } | 440 | } |
| 441 | df->allow = allow; | 441 | df->allow = allow; |
| @@ -454,14 +454,14 @@ int parse_disabled_functions(char *line) { | |||
| 454 | new[0] = '$'; | 454 | new[0] = '$'; |
| 455 | memcpy(new + 1, ZSTR_VAL(param), ZSTR_LEN(param)); | 455 | memcpy(new + 1, ZSTR_VAL(param), ZSTR_LEN(param)); |
| 456 | df->param = sp_parse_var(new); | 456 | df->param = sp_parse_var(new); |
| 457 | free(new); | 457 | pefree(new, 1); |
| 458 | } else { | 458 | } else { |
| 459 | df->param = sp_parse_var(ZSTR_VAL(param)); | 459 | df->param = sp_parse_var(ZSTR_VAL(param)); |
| 460 | } | 460 | } |
| 461 | if (!df->param) { | 461 | if (!df->param) { |
| 462 | sp_log_err("config", "Invalid value '%s' for `param` on line %zu", | 462 | sp_log_err("config", "Invalid value '%s' for `param` on line %zu", |
| 463 | ZSTR_VAL(param), sp_line_no); | 463 | ZSTR_VAL(param), sp_line_no); |
| 464 | return -1; | 464 | ret = -1; goto out; |
| 465 | } | 465 | } |
| 466 | } | 466 | } |
| 467 | 467 | ||
| @@ -471,15 +471,18 @@ int parse_disabled_functions(char *line) { | |||
| 471 | if (!df->var) { | 471 | if (!df->var) { |
| 472 | sp_log_err("config", "Invalid value '%s' for `var` on line %zu", | 472 | sp_log_err("config", "Invalid value '%s' for `var` on line %zu", |
| 473 | ZSTR_VAL(var), sp_line_no); | 473 | ZSTR_VAL(var), sp_line_no); |
| 474 | return -1; | 474 | ret = -1; goto out; |
| 475 | } | 475 | } |
| 476 | } else { | 476 | } else { |
| 477 | sp_log_err("config", "Empty value in `var` on line %zu", sp_line_no); | 477 | sp_log_err("config", "Empty value in `var` on line %zu", sp_line_no); |
| 478 | return -1; | 478 | ret = -1; goto out; |
| 479 | } | 479 | } |
| 480 | } | 480 | } |
| 481 | 481 | ||
| 482 | if (true == disable) { | 482 | if (true == disable || 0 != ret) { |
| 483 | out: | ||
| 484 | sp_free_disabled_function(df); | ||
| 485 | pefree(df, 1); | ||
| 483 | return ret; | 486 | return ret; |
| 484 | } | 487 | } |
| 485 | 488 | ||
