diff options
Diffstat (limited to 'src/lib/libcrypto/conf/conf_def.c')
-rw-r--r-- | src/lib/libcrypto/conf/conf_def.c | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/src/lib/libcrypto/conf/conf_def.c b/src/lib/libcrypto/conf/conf_def.c index e11ef95e43..4099ffc66c 100644 --- a/src/lib/libcrypto/conf/conf_def.c +++ b/src/lib/libcrypto/conf/conf_def.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: conf_def.c,v 1.31 2015/07/18 22:42:09 beck Exp $ */ | 1 | /* $OpenBSD: conf_def.c,v 1.32 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -195,9 +195,9 @@ def_load(CONF *conf, const char *name, long *line) | |||
195 | in = BIO_new_file(name, "rb"); | 195 | in = BIO_new_file(name, "rb"); |
196 | if (in == NULL) { | 196 | if (in == NULL) { |
197 | if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE) | 197 | if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE) |
198 | CONFerr(CONF_F_DEF_LOAD, CONF_R_NO_SUCH_FILE); | 198 | CONFerror(CONF_R_NO_SUCH_FILE); |
199 | else | 199 | else |
200 | CONFerr(CONF_F_DEF_LOAD, ERR_R_SYS_LIB); | 200 | CONFerror(ERR_R_SYS_LIB); |
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
203 | 203 | ||
@@ -224,25 +224,24 @@ def_load_bio(CONF *conf, BIO *in, long *line) | |||
224 | void *h = (void *)(conf->data); | 224 | void *h = (void *)(conf->data); |
225 | 225 | ||
226 | if ((buff = BUF_MEM_new()) == NULL) { | 226 | if ((buff = BUF_MEM_new()) == NULL) { |
227 | CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB); | 227 | CONFerror(ERR_R_BUF_LIB); |
228 | goto err; | 228 | goto err; |
229 | } | 229 | } |
230 | 230 | ||
231 | section = strdup("default"); | 231 | section = strdup("default"); |
232 | if (section == NULL) { | 232 | if (section == NULL) { |
233 | CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE); | 233 | CONFerror(ERR_R_MALLOC_FAILURE); |
234 | goto err; | 234 | goto err; |
235 | } | 235 | } |
236 | 236 | ||
237 | if (_CONF_new_data(conf) == 0) { | 237 | if (_CONF_new_data(conf) == 0) { |
238 | CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE); | 238 | CONFerror(ERR_R_MALLOC_FAILURE); |
239 | goto err; | 239 | goto err; |
240 | } | 240 | } |
241 | 241 | ||
242 | sv = _CONF_new_section(conf, section); | 242 | sv = _CONF_new_section(conf, section); |
243 | if (sv == NULL) { | 243 | if (sv == NULL) { |
244 | CONFerr(CONF_F_DEF_LOAD_BIO, | 244 | CONFerror(CONF_R_UNABLE_TO_CREATE_NEW_SECTION); |
245 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
246 | goto err; | 245 | goto err; |
247 | } | 246 | } |
248 | 247 | ||
@@ -250,7 +249,7 @@ def_load_bio(CONF *conf, BIO *in, long *line) | |||
250 | again = 0; | 249 | again = 0; |
251 | for (;;) { | 250 | for (;;) { |
252 | if (!BUF_MEM_grow(buff, bufnum + CONFBUFSIZE)) { | 251 | if (!BUF_MEM_grow(buff, bufnum + CONFBUFSIZE)) { |
253 | CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB); | 252 | CONFerror(ERR_R_BUF_LIB); |
254 | goto err; | 253 | goto err; |
255 | } | 254 | } |
256 | p = &(buff->data[bufnum]); | 255 | p = &(buff->data[bufnum]); |
@@ -316,8 +315,7 @@ again: | |||
316 | ss = p; | 315 | ss = p; |
317 | goto again; | 316 | goto again; |
318 | } | 317 | } |
319 | CONFerr(CONF_F_DEF_LOAD_BIO, | 318 | CONFerror(CONF_R_MISSING_CLOSE_SQUARE_BRACKET); |
320 | CONF_R_MISSING_CLOSE_SQUARE_BRACKET); | ||
321 | goto err; | 319 | goto err; |
322 | } | 320 | } |
323 | *end = '\0'; | 321 | *end = '\0'; |
@@ -326,8 +324,7 @@ again: | |||
326 | if ((sv = _CONF_get_section(conf, section)) == NULL) | 324 | if ((sv = _CONF_get_section(conf, section)) == NULL) |
327 | sv = _CONF_new_section(conf, section); | 325 | sv = _CONF_new_section(conf, section); |
328 | if (sv == NULL) { | 326 | if (sv == NULL) { |
329 | CONFerr(CONF_F_DEF_LOAD_BIO, | 327 | CONFerror(CONF_R_UNABLE_TO_CREATE_NEW_SECTION); |
330 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
331 | goto err; | 328 | goto err; |
332 | } | 329 | } |
333 | continue; | 330 | continue; |
@@ -344,8 +341,7 @@ again: | |||
344 | } | 341 | } |
345 | p = eat_ws(conf, end); | 342 | p = eat_ws(conf, end); |
346 | if (*p != '=') { | 343 | if (*p != '=') { |
347 | CONFerr(CONF_F_DEF_LOAD_BIO, | 344 | CONFerror(CONF_R_MISSING_EQUAL_SIGN); |
348 | CONF_R_MISSING_EQUAL_SIGN); | ||
349 | goto err; | 345 | goto err; |
350 | } | 346 | } |
351 | *end = '\0'; | 347 | *end = '\0'; |
@@ -360,8 +356,7 @@ again: | |||
360 | *p = '\0'; | 356 | *p = '\0'; |
361 | 357 | ||
362 | if (!(v = malloc(sizeof(CONF_VALUE)))) { | 358 | if (!(v = malloc(sizeof(CONF_VALUE)))) { |
363 | CONFerr(CONF_F_DEF_LOAD_BIO, | 359 | CONFerror(ERR_R_MALLOC_FAILURE); |
364 | ERR_R_MALLOC_FAILURE); | ||
365 | goto err; | 360 | goto err; |
366 | } | 361 | } |
367 | if (psection == NULL) | 362 | if (psection == NULL) |
@@ -369,8 +364,7 @@ again: | |||
369 | v->name = strdup(pname); | 364 | v->name = strdup(pname); |
370 | v->value = NULL; | 365 | v->value = NULL; |
371 | if (v->name == NULL) { | 366 | if (v->name == NULL) { |
372 | CONFerr(CONF_F_DEF_LOAD_BIO, | 367 | CONFerror(ERR_R_MALLOC_FAILURE); |
373 | ERR_R_MALLOC_FAILURE); | ||
374 | goto err; | 368 | goto err; |
375 | } | 369 | } |
376 | if (!str_copy(conf, psection, &(v->value), start)) | 370 | if (!str_copy(conf, psection, &(v->value), start)) |
@@ -381,16 +375,14 @@ again: | |||
381 | == NULL) | 375 | == NULL) |
382 | tv = _CONF_new_section(conf, psection); | 376 | tv = _CONF_new_section(conf, psection); |
383 | if (tv == NULL) { | 377 | if (tv == NULL) { |
384 | CONFerr(CONF_F_DEF_LOAD_BIO, | 378 | CONFerror(CONF_R_UNABLE_TO_CREATE_NEW_SECTION); |
385 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | ||
386 | goto err; | 379 | goto err; |
387 | } | 380 | } |
388 | } else | 381 | } else |
389 | tv = sv; | 382 | tv = sv; |
390 | 383 | ||
391 | if (_CONF_add_string(conf, tv, v) == 0) { | 384 | if (_CONF_add_string(conf, tv, v) == 0) { |
392 | CONFerr(CONF_F_DEF_LOAD_BIO, | 385 | CONFerror(ERR_R_MALLOC_FAILURE); |
393 | ERR_R_MALLOC_FAILURE); | ||
394 | goto err; | 386 | goto err; |
395 | } | 387 | } |
396 | v = NULL; | 388 | v = NULL; |
@@ -549,8 +541,7 @@ str_copy(CONF *conf, char *section, char **pto, char *from) | |||
549 | rp = e; | 541 | rp = e; |
550 | if (q) { | 542 | if (q) { |
551 | if (r != q) { | 543 | if (r != q) { |
552 | CONFerr(CONF_F_STR_COPY, | 544 | CONFerror(CONF_R_NO_CLOSE_BRACE); |
553 | CONF_R_NO_CLOSE_BRACE); | ||
554 | goto err; | 545 | goto err; |
555 | } | 546 | } |
556 | e++; | 547 | e++; |
@@ -569,14 +560,12 @@ str_copy(CONF *conf, char *section, char **pto, char *from) | |||
569 | *rrp = rr; | 560 | *rrp = rr; |
570 | *rp = r; | 561 | *rp = r; |
571 | if (p == NULL) { | 562 | if (p == NULL) { |
572 | CONFerr(CONF_F_STR_COPY, | 563 | CONFerror(CONF_R_VARIABLE_HAS_NO_VALUE); |
573 | CONF_R_VARIABLE_HAS_NO_VALUE); | ||
574 | goto err; | 564 | goto err; |
575 | } | 565 | } |
576 | if (!BUF_MEM_grow_clean(buf, | 566 | if (!BUF_MEM_grow_clean(buf, |
577 | (strlen(p) + buf->length - (e - from)))) { | 567 | (strlen(p) + buf->length - (e - from)))) { |
578 | CONFerr(CONF_F_STR_COPY, | 568 | CONFerror(CONF_R_MODULE_INITIALIZATION_ERROR); |
579 | CONF_R_MODULE_INITIALIZATION_ERROR); | ||
580 | goto err; | 569 | goto err; |
581 | } | 570 | } |
582 | while (*p) | 571 | while (*p) |