diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp_config.c | 15 | ||||
| -rw-r--r-- | src/sp_config.h | 1 | ||||
| -rw-r--r-- | src/sp_config_keywords.c | 4 |
3 files changed, 18 insertions, 2 deletions
diff --git a/src/sp_config.c b/src/sp_config.c index ed41a6a..46742c4 100644 --- a/src/sp_config.c +++ b/src/sp_config.c | |||
| @@ -213,6 +213,21 @@ SP_PARSEKW_FN(parse_uint) { | |||
| 213 | return ret; | 213 | return ret; |
| 214 | } | 214 | } |
| 215 | 215 | ||
| 216 | SP_PARSEKW_FN(parse_ulong) { | ||
| 217 | int ret = SP_PARSER_SUCCESS; | ||
| 218 | SP_PARSE_ARG(value); | ||
| 219 | |||
| 220 | char *endptr; | ||
| 221 | errno = 0; | ||
| 222 | *(u_long*)retval = (u_long)strtoul(ZSTR_VAL(value), &endptr, 10); | ||
| 223 | if (errno != 0 || !endptr || endptr == ZSTR_VAL(value)) { | ||
| 224 | sp_log_err("config", "Failed to parse arg '%s' of `%s` on line %zu", ZSTR_VAL(value), token, kw->lineno); | ||
| 225 | ret = SP_PARSER_ERROR; | ||
| 226 | } | ||
| 227 | zend_string_release(value); | ||
| 228 | return ret; | ||
| 229 | } | ||
| 230 | |||
| 216 | SP_PARSEKW_FN(parse_cidr) { | 231 | SP_PARSEKW_FN(parse_cidr) { |
| 217 | CHECK_DUPLICATE_KEYWORD(retval); | 232 | CHECK_DUPLICATE_KEYWORD(retval); |
| 218 | SP_PARSE_ARG(value); | 233 | SP_PARSE_ARG(value); |
diff --git a/src/sp_config.h b/src/sp_config.h index 8886bc6..edaa686 100644 --- a/src/sp_config.h +++ b/src/sp_config.h | |||
| @@ -302,6 +302,7 @@ SP_PARSEKW_FN(parse_regexp); | |||
| 302 | SP_PARSEKW_FN(parse_empty); | 302 | SP_PARSEKW_FN(parse_empty); |
| 303 | SP_PARSEKW_FN(parse_int); | 303 | SP_PARSEKW_FN(parse_int); |
| 304 | SP_PARSEKW_FN(parse_uint); | 304 | SP_PARSEKW_FN(parse_uint); |
| 305 | SP_PARSEKW_FN(parse_ulong); | ||
| 305 | SP_PARSEKW_FN(parse_php_type); | 306 | SP_PARSEKW_FN(parse_php_type); |
| 306 | SP_PARSEKW_FN(parse_cidr); | 307 | SP_PARSEKW_FN(parse_cidr); |
| 307 | SP_PARSEKW_FN(parse_list); | 308 | SP_PARSEKW_FN(parse_list); |
diff --git a/src/sp_config_keywords.c b/src/sp_config_keywords.c index 7f41e38..1a23658 100644 --- a/src/sp_config_keywords.c +++ b/src/sp_config_keywords.c | |||
| @@ -33,8 +33,8 @@ SP_PARSE_FN(parse_session) { | |||
| 33 | {parse_empty, SP_TOKEN_ENCRYPT, &(cfg->encrypt)}, | 33 | {parse_empty, SP_TOKEN_ENCRYPT, &(cfg->encrypt)}, |
| 34 | {parse_empty, SP_TOKEN_SIMULATION, &(cfg->simulation)}, | 34 | {parse_empty, SP_TOKEN_SIMULATION, &(cfg->simulation)}, |
| 35 | {parse_empty, SP_TOKEN_SIM, &(cfg->simulation)}, | 35 | {parse_empty, SP_TOKEN_SIM, &(cfg->simulation)}, |
| 36 | {parse_uint, SP_TOKEN_SID_MIN_LENGTH, &(cfg->sid_min_length)}, | 36 | {parse_ulong, SP_TOKEN_SID_MIN_LENGTH, &(cfg->sid_min_length)}, |
| 37 | {parse_uint, SP_TOKEN_SID_MAX_LENGTH, &(cfg->sid_max_length)}, | 37 | {parse_ulong, SP_TOKEN_SID_MAX_LENGTH, &(cfg->sid_max_length)}, |
| 38 | {0, 0, 0}}; | 38 | {0, 0, 0}}; |
| 39 | 39 | ||
| 40 | SP_PROCESS_CONFIG_KEYWORDS_ERR(); | 40 | SP_PROCESS_CONFIG_KEYWORDS_ERR(); |
