]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/conf/conf_def.c
There have been a number of complaints from a number of sources that names
[thirdparty/openssl.git] / crypto / conf / conf_def.c
CommitLineData
d02b48c6 1/* crypto/conf/conf.c */
58964a49 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
d02b48c6
RE
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
d86b6915
RL
59/* Part of the code in here was originally in conf.c, which is now removed */
60
d02b48c6 61#include <stdio.h>
ec577822
BM
62#include <openssl/stack.h>
63#include <openssl/lhash.h>
64#include <openssl/conf.h>
d86b6915
RL
65#include <openssl/conf_api.h>
66#include "conf_def.h"
ec577822
BM
67#include <openssl/buffer.h>
68#include <openssl/err.h>
d02b48c6 69
d86b6915
RL
70static char *eat_ws(CONF *conf, char *p);
71static char *eat_alpha_numeric(CONF *conf, char *p);
72static void clear_comments(CONF *conf, char *p);
73static int str_copy(CONF *conf,char *section,char **to, char *from);
74static char *scan_quote(CONF *conf, char *p);
75static char *scan_dquote(CONF *conf, char *p);
76#define scan_esc(p) (((IS_EOF((conf),(p)[1]))?(p+=1):(p+=2)))
77
78static CONF *def_create(CONF_METHOD *meth);
79static int def_init_default(CONF *conf);
80static int def_init_WIN32(CONF *conf);
81static int def_destroy(CONF *conf);
82static int def_destroy_data(CONF *conf);
83static int def_load(CONF *conf, BIO *bp, long *eline);
84static int def_dump(CONF *conf, BIO *bp);
85static int def_is_number(CONF *conf, char c);
86static int def_to_int(CONF *conf, char c);
87
88const char *CONF_def_version="CONF_def" OPENSSL_VERSION_PTEXT;
89
90static CONF_METHOD default_method = {
91 "OpenSSL default",
92 def_create,
93 def_init_default,
94 def_destroy,
95 def_destroy_data,
96 def_load,
97 def_dump,
98 def_is_number,
99 def_to_int
100 };
101
102static CONF_METHOD WIN32_method = {
103 "WIN32",
104 def_create,
105 def_init_WIN32,
106 def_destroy,
107 def_destroy_data,
108 def_load,
109 def_dump,
110 def_is_number,
111 def_to_int
112 };
113
114CONF_METHOD *NCONF_default()
115 {
116 return &default_method;
117 }
118CONF_METHOD *NCONF_WIN32()
119 {
120 return &WIN32_method;
121 }
d02b48c6 122
d86b6915
RL
123static CONF *def_create(CONF_METHOD *meth)
124 {
125 CONF *ret;
d02b48c6 126
26a3a48d 127 ret = (CONF *)OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *));
d86b6915
RL
128 if (ret)
129 if (meth->init(ret) == 0)
130 {
26a3a48d 131 OPENSSL_free(ret);
d86b6915
RL
132 ret = NULL;
133 }
134 return ret;
135 }
136
137static int def_init_default(CONF *conf)
138 {
139 if (conf == NULL)
140 return 0;
141
142 conf->meth = &default_method;
143 conf->meth_data = (void *)CONF_type_default;
144 conf->data = NULL;
d02b48c6 145
d86b6915
RL
146 return 1;
147 }
8623f693 148
d86b6915 149static int def_init_WIN32(CONF *conf)
d02b48c6 150 {
d86b6915
RL
151 if (conf == NULL)
152 return 0;
8623f693 153
d86b6915
RL
154 conf->meth = &WIN32_method;
155 conf->meth_data = (void *)CONF_type_win32;
156 conf->data = NULL;
157
158 return 1;
159 }
160
161static int def_destroy(CONF *conf)
162 {
163 if (def_destroy_data(conf))
8623f693 164 {
26a3a48d 165 OPENSSL_free(conf);
d86b6915 166 return 1;
8623f693 167 }
d86b6915
RL
168 return 0;
169 }
8623f693 170
d86b6915
RL
171static int def_destroy_data(CONF *conf)
172 {
173 if (conf == NULL)
174 return 0;
175 _CONF_free_data(conf);
176 return 1;
8623f693 177 }
8623f693 178
d86b6915 179static int def_load(CONF *conf, BIO *in, long *line)
8623f693 180 {
d02b48c6 181#define BUFSIZE 512
dfeab068 182 char btmp[16];
d02b48c6
RE
183 int bufnum=0,i,ii;
184 BUF_MEM *buff=NULL;
185 char *s,*p,*end;
dfeab068
RE
186 int again,n;
187 long eline=0;
d86b6915 188 CONF_VALUE *v=NULL,*tv;
d02b48c6
RE
189 CONF_VALUE *sv=NULL;
190 char *section=NULL,*buf;
ba404b5e 191 STACK_OF(CONF_VALUE) *section_sk=NULL,*ts;
d02b48c6 192 char *start,*psection,*pname;
d86b6915 193 void *h = (void *)(conf->data);
d02b48c6
RE
194
195 if ((buff=BUF_MEM_new()) == NULL)
196 {
8623f693 197 CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB);
d02b48c6
RE
198 goto err;
199 }
200
26a3a48d 201 section=(char *)OPENSSL_malloc(10);
d02b48c6
RE
202 if (section == NULL)
203 {
8623f693 204 CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
d02b48c6
RE
205 goto err;
206 }
207 strcpy(section,"default");
208
d86b6915 209 if (_CONF_new_data(conf) == 0)
d02b48c6 210 {
d86b6915
RL
211 CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
212 goto err;
d02b48c6 213 }
d02b48c6 214
d86b6915 215 sv=_CONF_new_section(conf,section);
d02b48c6
RE
216 if (sv == NULL)
217 {
8623f693
DSH
218 CONFerr(CONF_F_CONF_LOAD_BIO,
219 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
d02b48c6
RE
220 goto err;
221 }
ba404b5e 222 section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
d02b48c6
RE
223
224 bufnum=0;
225 for (;;)
226 {
227 again=0;
228 if (!BUF_MEM_grow(buff,bufnum+BUFSIZE))
229 {
8623f693 230 CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB);
d02b48c6
RE
231 goto err;
232 }
233 p= &(buff->data[bufnum]);
234 *p='\0';
8623f693 235 BIO_gets(in, p, BUFSIZE-1);
d02b48c6
RE
236 p[BUFSIZE-1]='\0';
237 ii=i=strlen(p);
238 if (i == 0) break;
239 while (i > 0)
240 {
241 if ((p[i-1] != '\r') && (p[i-1] != '\n'))
242 break;
243 else
244 i--;
245 }
246 /* we removed some trailing stuff so there is a new
247 * line on the end. */
248 if (i == ii)
249 again=1; /* long line */
250 else
251 {
252 p[i]='\0';
253 eline++; /* another input line */
254 }
255
256 /* we now have a line with trailing \r\n removed */
257
258 /* i is the number of bytes */
259 bufnum+=i;
260
261 v=NULL;
262 /* check for line continuation */
263 if (bufnum >= 1)
264 {
265 /* If we have bytes and the last char '\\' and
266 * second last char is not '\\' */
267 p= &(buff->data[bufnum-1]);
d86b6915
RL
268 if (IS_ESC(conf,p[0]) &&
269 ((bufnum <= 1) || !IS_ESC(conf,p[-1])))
d02b48c6
RE
270 {
271 bufnum--;
272 again=1;
273 }
274 }
275 if (again) continue;
276 bufnum=0;
277 buf=buff->data;
278
d86b6915 279 clear_comments(conf, buf);
d02b48c6 280 n=strlen(buf);
d86b6915
RL
281 s=eat_ws(conf, buf);
282 if (IS_EOF(conf,*s)) continue; /* blank line */
d02b48c6
RE
283 if (*s == '[')
284 {
dfeab068
RE
285 char *ss;
286
d02b48c6 287 s++;
d86b6915 288 start=eat_ws(conf, s);
dfeab068
RE
289 ss=start;
290again:
d86b6915
RL
291 end=eat_alpha_numeric(conf, ss);
292 p=eat_ws(conf, end);
d02b48c6
RE
293 if (*p != ']')
294 {
dfeab068
RE
295 if (*p != '\0')
296 {
297 ss=p;
298 goto again;
299 }
8623f693
DSH
300 CONFerr(CONF_F_CONF_LOAD_BIO,
301 CONF_R_MISSING_CLOSE_SQUARE_BRACKET);
d02b48c6
RE
302 goto err;
303 }
304 *end='\0';
d86b6915
RL
305 if (!str_copy(conf,NULL,&section,start)) goto err;
306 if ((sv=_CONF_get_section(conf,section)) == NULL)
307 sv=_CONF_new_section(conf,section);
d02b48c6
RE
308 if (sv == NULL)
309 {
8623f693
DSH
310 CONFerr(CONF_F_CONF_LOAD_BIO,
311 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
d02b48c6
RE
312 goto err;
313 }
ba404b5e 314 section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
d02b48c6
RE
315 continue;
316 }
317 else
318 {
319 pname=s;
320 psection=NULL;
d86b6915 321 end=eat_alpha_numeric(conf, s);
d02b48c6
RE
322 if ((end[0] == ':') && (end[1] == ':'))
323 {
324 *end='\0';
325 end+=2;
326 psection=pname;
327 pname=end;
d86b6915 328 end=eat_alpha_numeric(conf, end);
d02b48c6 329 }
d86b6915 330 p=eat_ws(conf, end);
d02b48c6
RE
331 if (*p != '=')
332 {
8623f693
DSH
333 CONFerr(CONF_F_CONF_LOAD_BIO,
334 CONF_R_MISSING_EQUAL_SIGN);
d02b48c6
RE
335 goto err;
336 }
337 *end='\0';
338 p++;
d86b6915
RL
339 start=eat_ws(conf, p);
340 while (!IS_EOF(conf,*p))
d02b48c6
RE
341 p++;
342 p--;
d86b6915 343 while ((p != start) && (IS_WS(conf,*p)))
d02b48c6
RE
344 p--;
345 p++;
346 *p='\0';
347
26a3a48d 348 if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))))
d02b48c6 349 {
8623f693
DSH
350 CONFerr(CONF_F_CONF_LOAD_BIO,
351 ERR_R_MALLOC_FAILURE);
d02b48c6
RE
352 goto err;
353 }
354 if (psection == NULL) psection=section;
26a3a48d 355 v->name=(char *)OPENSSL_malloc(strlen(pname)+1);
d02b48c6
RE
356 v->value=NULL;
357 if (v->name == NULL)
358 {
8623f693
DSH
359 CONFerr(CONF_F_CONF_LOAD_BIO,
360 ERR_R_MALLOC_FAILURE);
d02b48c6
RE
361 goto err;
362 }
363 strcpy(v->name,pname);
d86b6915 364 if (!str_copy(conf,psection,&(v->value),start)) goto err;
d02b48c6
RE
365
366 if (strcmp(psection,section) != 0)
367 {
d86b6915 368 if ((tv=_CONF_get_section(conf,psection))
d02b48c6 369 == NULL)
d86b6915 370 tv=_CONF_new_section(conf,psection);
d02b48c6
RE
371 if (tv == NULL)
372 {
8623f693 373 CONFerr(CONF_F_CONF_LOAD_BIO,
ba404b5e 374 CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
d02b48c6
RE
375 goto err;
376 }
ba404b5e 377 ts=(STACK_OF(CONF_VALUE) *)tv->value;
d02b48c6
RE
378 }
379 else
380 {
381 tv=sv;
382 ts=section_sk;
383 }
d86b6915
RL
384#if 1
385 if (_CONF_add_string(conf, tv, v) == 0)
386 {
387 CONFerr(CONF_F_CONF_LOAD_BIO,
388 ERR_R_MALLOC_FAILURE);
389 goto err;
390 }
391#else
d02b48c6 392 v->section=tv->section;
ba404b5e 393 if (!sk_CONF_VALUE_push(ts,v))
d02b48c6 394 {
8623f693
DSH
395 CONFerr(CONF_F_CONF_LOAD_BIO,
396 ERR_R_MALLOC_FAILURE);
d02b48c6
RE
397 goto err;
398 }
d86b6915 399 vv=(CONF_VALUE *)lh_insert(conf->data,v);
d02b48c6
RE
400 if (vv != NULL)
401 {
ba404b5e 402 sk_CONF_VALUE_delete_ptr(ts,vv);
26a3a48d
RL
403 OPENSSL_free(vv->name);
404 OPENSSL_free(vv->value);
405 OPENSSL_free(vv);
d02b48c6 406 }
d86b6915 407#endif
d02b48c6
RE
408 v=NULL;
409 }
410 }
411 if (buff != NULL) BUF_MEM_free(buff);
26a3a48d 412 if (section != NULL) OPENSSL_free(section);
d86b6915 413 return(1);
d02b48c6
RE
414err:
415 if (buff != NULL) BUF_MEM_free(buff);
26a3a48d 416 if (section != NULL) OPENSSL_free(section);
d02b48c6 417 if (line != NULL) *line=eline;
dfeab068
RE
418 sprintf(btmp,"%ld",eline);
419 ERR_add_error_data(2,"line ",btmp);
d86b6915 420 if ((h != conf->data) && (conf->data != NULL)) CONF_free(conf->data);
d02b48c6
RE
421 if (v != NULL)
422 {
26a3a48d
RL
423 if (v->name != NULL) OPENSSL_free(v->name);
424 if (v->value != NULL) OPENSSL_free(v->value);
425 if (v != NULL) OPENSSL_free(v);
d02b48c6 426 }
d86b6915 427 return(0);
d02b48c6 428 }
8623f693 429
d86b6915 430static void clear_comments(CONF *conf, char *p)
d02b48c6 431 {
d86b6915 432 char *to;
d02b48c6 433
d86b6915
RL
434 to=p;
435 for (;;)
d02b48c6 436 {
d86b6915 437 if (IS_FCOMMENT(conf,*p))
d02b48c6 438 {
d86b6915
RL
439 *p='\0';
440 return;
d02b48c6 441 }
d86b6915
RL
442 if (!IS_WS(conf,*p))
443 {
444 break;
445 }
446 p++;
d02b48c6 447 }
d02b48c6 448
d02b48c6
RE
449 for (;;)
450 {
d86b6915 451 if (IS_COMMENT(conf,*p))
d02b48c6
RE
452 {
453 *p='\0';
454 return;
455 }
d86b6915 456 if (IS_DQUOTE(conf,*p))
d02b48c6 457 {
d86b6915 458 p=scan_dquote(conf, p);
d02b48c6
RE
459 continue;
460 }
d86b6915
RL
461 if (IS_QUOTE(conf,*p))
462 {
463 p=scan_quote(conf, p);
464 continue;
465 }
466 if (IS_ESC(conf,*p))
d02b48c6
RE
467 {
468 p=scan_esc(p);
469 continue;
470 }
d86b6915 471 if (IS_EOF(conf,*p))
d02b48c6
RE
472 return;
473 else
474 p++;
475 }
476 }
477
d86b6915 478static int str_copy(CONF *conf, char *section, char **pto, char *from)
d02b48c6
RE
479 {
480 int q,r,rr=0,to=0,len=0;
481 char *s,*e,*rp,*p,*rrp,*np,*cp,v;
482 BUF_MEM *buf;
483
484 if ((buf=BUF_MEM_new()) == NULL) return(0);
485
486 len=strlen(from)+1;
487 if (!BUF_MEM_grow(buf,len)) goto err;
488
489 for (;;)
490 {
d86b6915 491 if (IS_QUOTE(conf,*from))
d02b48c6
RE
492 {
493 q= *from;
494 from++;
d86b6915 495 while (!IS_EOF(conf,*from) && (*from != q))
d02b48c6 496 {
d86b6915 497 if (IS_ESC(conf,*from))
d02b48c6
RE
498 {
499 from++;
d86b6915
RL
500 if (IS_EOF(conf,*from)) break;
501 }
502 buf->data[to++]= *(from++);
503 }
504 if (*from == q) from++;
505 }
506 else if (IS_DQUOTE(conf,*from))
507 {
508 q= *from;
509 from++;
510 while (!IS_EOF(conf,*from))
511 {
512 if (*from == q)
513 {
514 if (*(from+1) == q)
515 {
516 from++;
517 }
518 else
519 {
520 break;
521 }
d02b48c6
RE
522 }
523 buf->data[to++]= *(from++);
524 }
d86b6915 525 if (*from == q) from++;
d02b48c6 526 }
d86b6915 527 else if (IS_ESC(conf,*from))
d02b48c6
RE
528 {
529 from++;
530 v= *(from++);
d86b6915 531 if (IS_EOF(conf,v)) break;
d02b48c6
RE
532 else if (v == 'r') v='\r';
533 else if (v == 'n') v='\n';
534 else if (v == 'b') v='\b';
535 else if (v == 't') v='\t';
536 buf->data[to++]= v;
537 }
d86b6915 538 else if (IS_EOF(conf,*from))
d02b48c6
RE
539 break;
540 else if (*from == '$')
541 {
542 /* try to expand it */
543 rrp=NULL;
544 s= &(from[1]);
545 if (*s == '{')
546 q='}';
547 else if (*s == '(')
548 q=')';
549 else q=0;
550
551 if (q) s++;
552 cp=section;
553 e=np=s;
d86b6915 554 while (IS_ALPHA_NUMERIC(conf,*e))
d02b48c6
RE
555 e++;
556 if ((e[0] == ':') && (e[1] == ':'))
557 {
558 cp=np;
559 rrp=e;
560 rr= *e;
561 *rrp='\0';
562 e+=2;
563 np=e;
d86b6915 564 while (IS_ALPHA_NUMERIC(conf,*e))
d02b48c6
RE
565 e++;
566 }
567 r= *e;
568 *e='\0';
569 rp=e;
570 if (q)
571 {
572 if (r != q)
573 {
574 CONFerr(CONF_F_STR_COPY,CONF_R_NO_CLOSE_BRACE);
575 goto err;
576 }
577 e++;
578 }
579 /* So at this point we have
580 * ns which is the start of the name string which is
581 * '\0' terminated.
582 * cs which is the start of the section string which is
583 * '\0' terminated.
584 * e is the 'next point after'.
585 * r and s are the chars replaced by the '\0'
586 * rp and sp is where 'r' and 's' came from.
587 */
d86b6915 588 p=_CONF_get_string(conf,cp,np);
d02b48c6
RE
589 if (rrp != NULL) *rrp=rr;
590 *rp=r;
591 if (p == NULL)
592 {
593 CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE);
594 goto err;
595 }
596 BUF_MEM_grow(buf,(strlen(p)+len-(e-from)));
597 while (*p)
598 buf->data[to++]= *(p++);
599 from=e;
600 }
601 else
602 buf->data[to++]= *(from++);
603 }
604 buf->data[to]='\0';
26a3a48d 605 if (*pto != NULL) OPENSSL_free(*pto);
d02b48c6 606 *pto=buf->data;
26a3a48d 607 OPENSSL_free(buf);
d02b48c6
RE
608 return(1);
609err:
610 if (buf != NULL) BUF_MEM_free(buf);
611 return(0);
612 }
613
d86b6915 614static char *eat_ws(CONF *conf, char *p)
d02b48c6 615 {
d86b6915 616 while (IS_WS(conf,*p) && (!IS_EOF(conf,*p)))
d02b48c6
RE
617 p++;
618 return(p);
619 }
620
d86b6915 621static char *eat_alpha_numeric(CONF *conf, char *p)
d02b48c6
RE
622 {
623 for (;;)
624 {
d86b6915 625 if (IS_ESC(conf,*p))
d02b48c6
RE
626 {
627 p=scan_esc(p);
628 continue;
629 }
d86b6915 630 if (!IS_ALPHA_NUMERIC_PUNCT(conf,*p))
d02b48c6
RE
631 return(p);
632 p++;
633 }
634 }
635
d86b6915 636static char *scan_quote(CONF *conf, char *p)
d02b48c6 637 {
d86b6915 638 int q= *p;
d02b48c6 639
d86b6915
RL
640 p++;
641 while (!(IS_EOF(conf,*p)) && (*p != q))
d02b48c6 642 {
d86b6915
RL
643 if (IS_ESC(conf,*p))
644 {
645 p++;
646 if (IS_EOF(conf,*p)) return(p);
647 }
648 p++;
d02b48c6 649 }
d86b6915
RL
650 if (*p == q) p++;
651 return(p);
d02b48c6
RE
652 }
653
d86b6915
RL
654
655static char *scan_dquote(CONF *conf, char *p)
d02b48c6
RE
656 {
657 int q= *p;
658
659 p++;
d86b6915 660 while (!(IS_EOF(conf,*p)))
d02b48c6 661 {
d86b6915 662 if (*p == q)
d02b48c6 663 {
d86b6915
RL
664 if (*(p+1) == q)
665 {
666 p++;
667 }
668 else
669 {
670 break;
671 }
d02b48c6
RE
672 }
673 p++;
674 }
675 if (*p == q) p++;
676 return(p);
677 }
678
d86b6915
RL
679static void dump_value(CONF_VALUE *a, BIO *out)
680 {
681 if (a->name)
682 BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value);
683 else
684 BIO_printf(out, "[[%s]]\n", a->section);
685 }
686
687static int def_dump(CONF *conf, BIO *out)
d02b48c6 688 {
d86b6915
RL
689 lh_doall_arg(conf->data, (void (*)())dump_value, out);
690 return 1;
691 }
d02b48c6 692
d86b6915
RL
693static int def_is_number(CONF *conf, char c)
694 {
695 return IS_NUMBER(conf,c);
696 }
d02b48c6 697
d86b6915
RL
698static int def_to_int(CONF *conf, char c)
699 {
700 return c - '0';
d02b48c6 701 }
ba404b5e 702