Lines Matching refs:conf
57 #include <openssl/conf.h>
99 CONF *NCONF_new(void *method) {
100 CONF *conf;
106 conf = OPENSSL_malloc(sizeof(CONF));
107 if (conf == NULL) {
111 conf->data = lh_CONF_VALUE_new(conf_value_hash, conf_value_cmp);
112 if (conf->data == NULL) {
113 OPENSSL_free(conf);
117 return conf;
123 OPENSSL_PUT_ERROR(CONF, ERR_R_MALLOC_FAILURE);
151 void NCONF_free(CONF *conf) {
152 if (conf == NULL || conf->data == NULL) {
156 lh_CONF_VALUE_doall(conf->data, value_free);
157 lh_CONF_VALUE_free(conf->data);
158 OPENSSL_free(conf);
161 static CONF_VALUE *NCONF_new_section(const CONF *conf, const char *section) {
179 if (!lh_CONF_VALUE_insert(conf->data, &old_value, v)) {
200 static int str_copy(CONF *conf, char *section, char **pto, char *from) {
217 if (IS_QUOTE(conf, *from)) {
220 while (!IS_EOF(conf, *from) && (*from != q)) {
221 if (IS_ESC(conf, *from)) {
223 if (IS_EOF(conf, *from)) {
232 } else if (IS_DQUOTE(conf, *from)) {
235 while (!IS_EOF(conf, *from)) {
248 } else if (IS_ESC(conf, *from)) {
251 if (IS_EOF(conf, v)) {
263 } else if (IS_EOF(conf, *from)) {
282 while (IS_ALPHA_NUMERIC(conf, *e)) {
292 while (IS_ALPHA_NUMERIC(conf, *e)) {
301 OPENSSL_PUT_ERROR(CONF, CONF_R_NO_CLOSE_BRACE);
314 p = NCONF_get_string(conf, cp, np);
320 OPENSSL_PUT_ERROR(CONF, CONF_R_VARIABLE_HAS_NO_VALUE);
325 OPENSSL_PUT_ERROR(CONF, CONF_R_VARIABLE_EXPANSION_TOO_LONG);
329 OPENSSL_PUT_ERROR(CONF, ERR_R_MALLOC_FAILURE);
366 static CONF_VALUE *get_section(const CONF *conf, const char *section) {
371 return lh_CONF_VALUE_retrieve(conf->data, &template);
374 STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section) {
375 CONF_VALUE *section_value = get_section(conf, section);
382 const char *NCONF_get_string(const CONF *conf, const char *section,
389 value = lh_CONF_VALUE_retrieve(conf->data, &template);
396 static int add_string(const CONF *conf, CONF_VALUE *section,
406 if (!lh_CONF_VALUE_insert(conf->data, &old_value, value)) {
417 static char *eat_ws(CONF *conf, char *p) {
418 while (IS_WS(conf, *p) && !IS_EOF(conf, *p)) {
424 #define scan_esc(conf, p) (((IS_EOF((conf), (p)[1])) ? ((p) + 1) : ((p) + 2)))
426 static char *eat_alpha_numeric(CONF *conf, char *p) {
428 if (IS_ESC(conf, *p)) {
429 p = scan_esc(conf, p);
432 if (!IS_ALPHA_NUMERIC_PUNCT(conf, *p)) {
439 static char *scan_quote(CONF *conf, char *p) {
443 while (!IS_EOF(conf, *p) && *p != q) {
444 if (IS_ESC(conf, *p)) {
446 if (IS_EOF(conf, *p)) {
459 static char *scan_dquote(CONF *conf, char *p) {
463 while (!(IS_EOF(conf, *p))) {
479 static void clear_comments(CONF *conf, char *p) {
481 if (IS_FCOMMENT(conf, *p)) {
485 if (!IS_WS(conf, *p)) {
492 if (IS_COMMENT(conf, *p)) {
496 if (IS_DQUOTE(conf, *p)) {
497 p = scan_dquote(conf, p);
500 if (IS_QUOTE(conf, *p)) {
501 p = scan_quote(conf, p);
504 if (IS_ESC(conf, *p)) {
505 p = scan_esc(conf, p);
508 if (IS_EOF(conf, *p)) {
516 static int def_load_bio(CONF *conf, BIO *in, long *out_error_line) {
530 OPENSSL_PUT_ERROR(CONF, ERR_R_BUF_LIB);
536 OPENSSL_PUT_ERROR(CONF, ERR_R_MALLOC_FAILURE);
540 sv = NCONF_new_section(conf, section);
542 OPENSSL_PUT_ERROR(CONF, CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
550 OPENSSL_PUT_ERROR(CONF, ERR_R_BUF_LIB);
589 if (IS_ESC(conf, p[0]) && ((bufnum <= 1) || !IS_ESC(conf, p[-1]))) {
600 clear_comments(conf, buf);
601 s = eat_ws(conf, buf);
602 if (IS_EOF(conf, *s)) {
609 start = eat_ws(conf, s);
612 end = eat_alpha_numeric(conf, ss);
613 p = eat_ws(conf, end);
619 OPENSSL_PUT_ERROR(CONF, CONF_R_MISSING_CLOSE_SQUARE_BRACKET);
623 if (!str_copy(conf, NULL, §ion, start)) {
626 if ((sv = get_section(conf, section)) == NULL) {
627 sv = NCONF_new_section(conf, section);
630 OPENSSL_PUT_ERROR(CONF, CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
637 end = eat_alpha_numeric(conf, s);
643 end = eat_alpha_numeric(conf, end);
645 p = eat_ws(conf, end);
647 OPENSSL_PUT_ERROR(CONF, CONF_R_MISSING_EQUAL_SIGN);
652 start = eat_ws(conf, p);
653 while (!IS_EOF(conf, *p)) {
657 while ((p != start) && (IS_WS(conf, *p))) {
671 OPENSSL_PUT_ERROR(CONF, ERR_R_MALLOC_FAILURE);
674 if (!str_copy(conf, psection, &(v->value), start)) {
679 if ((tv = get_section(conf, psection)) == NULL) {
680 tv = NCONF_new_section(conf, psection);
683 OPENSSL_PUT_ERROR(CONF, CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
689 if (add_string(conf, tv, v) == 0) {
690 OPENSSL_PUT_ERROR(CONF, ERR_R_MALLOC_FAILURE);
731 int NCONF_load(CONF *conf, const char *filename, long *out_error_line) {
736 OPENSSL_PUT_ERROR(CONF, ERR_R_SYS_LIB);
740 ret = def_load_bio(conf, in, out_error_line);
746 int NCONF_load_bio(CONF *conf, BIO *bio, long *out_error_line) {
747 return def_load_bio(conf, bio, out_error_line);
757 OPENSSL_PUT_ERROR(CONF, CONF_R_LIST_CANNOT_BE_NULL);