conf_def.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730
  1. /* crypto/conf/conf.c */
  2. /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  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. /* Part of the code in here was originally in conf.c, which is now removed */
  59. #include <stdio.h>
  60. #include <string.h>
  61. #include <openssl/stack.h>
  62. #include <openssl/lhash.h>
  63. #include <openssl/conf.h>
  64. #include <openssl/conf_api.h>
  65. #include "conf_def.h"
  66. #include <openssl/buffer.h>
  67. #include <openssl/err.h>
  68. static char *eat_ws(CONF *conf, char *p);
  69. static char *eat_alpha_numeric(CONF *conf, char *p);
  70. static void clear_comments(CONF *conf, char *p);
  71. static int str_copy(CONF *conf,char *section,char **to, char *from);
  72. static char *scan_quote(CONF *conf, char *p);
  73. static char *scan_dquote(CONF *conf, char *p);
  74. #define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2)))
  75. static CONF *def_create(CONF_METHOD *meth);
  76. static int def_init_default(CONF *conf);
  77. static int def_init_WIN32(CONF *conf);
  78. static int def_destroy(CONF *conf);
  79. static int def_destroy_data(CONF *conf);
  80. static int def_load(CONF *conf, const char *name, long *eline);
  81. static int def_load_bio(CONF *conf, BIO *bp, long *eline);
  82. static int def_dump(CONF *conf, BIO *bp);
  83. static int def_is_number(CONF *conf, char c);
  84. static int def_to_int(CONF *conf, char c);
  85. const char *CONF_def_version="CONF_def" OPENSSL_VERSION_PTEXT;
  86. static CONF_METHOD default_method = {
  87. "OpenSSL default",
  88. def_create,
  89. def_init_default,
  90. def_destroy,
  91. def_destroy_data,
  92. def_load_bio,
  93. def_dump,
  94. def_is_number,
  95. def_to_int,
  96. def_load
  97. };
  98. static CONF_METHOD WIN32_method = {
  99. "WIN32",
  100. def_create,
  101. def_init_WIN32,
  102. def_destroy,
  103. def_destroy_data,
  104. def_load_bio,
  105. def_dump,
  106. def_is_number,
  107. def_to_int,
  108. def_load
  109. };
  110. CONF_METHOD *NCONF_default()
  111. {
  112. return &default_method;
  113. }
  114. CONF_METHOD *NCONF_WIN32()
  115. {
  116. return &WIN32_method;
  117. }
  118. static CONF *def_create(CONF_METHOD *meth)
  119. {
  120. CONF *ret;
  121. ret = (CONF *)OPENSSL_malloc(sizeof(CONF) + sizeof(unsigned short *));
  122. if (ret)
  123. if (meth->init(ret) == 0)
  124. {
  125. OPENSSL_free(ret);
  126. ret = NULL;
  127. }
  128. return ret;
  129. }
  130. static int def_init_default(CONF *conf)
  131. {
  132. if (conf == NULL)
  133. return 0;
  134. conf->meth = &default_method;
  135. conf->meth_data = (void *)CONF_type_default;
  136. conf->data = NULL;
  137. return 1;
  138. }
  139. static int def_init_WIN32(CONF *conf)
  140. {
  141. if (conf == NULL)
  142. return 0;
  143. conf->meth = &WIN32_method;
  144. conf->meth_data = (void *)CONF_type_win32;
  145. conf->data = NULL;
  146. return 1;
  147. }
  148. static int def_destroy(CONF *conf)
  149. {
  150. if (def_destroy_data(conf))
  151. {
  152. OPENSSL_free(conf);
  153. return 1;
  154. }
  155. return 0;
  156. }
  157. static int def_destroy_data(CONF *conf)
  158. {
  159. if (conf == NULL)
  160. return 0;
  161. _CONF_free_data(conf);
  162. return 1;
  163. }
  164. static int def_load(CONF *conf, const char *name, long *line)
  165. {
  166. int ret;
  167. BIO *in=NULL;
  168. #ifdef OPENSSL_SYS_VMS
  169. in=BIO_new_file(name, "r");
  170. #else
  171. in=BIO_new_file(name, "rb");
  172. #endif
  173. if (in == NULL)
  174. {
  175. CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB);
  176. return 0;
  177. }
  178. ret = def_load_bio(conf, in, line);
  179. BIO_free(in);
  180. return ret;
  181. }
  182. static int def_load_bio(CONF *conf, BIO *in, long *line)
  183. {
  184. #define BUFSIZE 512
  185. char btmp[16];
  186. int bufnum=0,i,ii;
  187. BUF_MEM *buff=NULL;
  188. char *s,*p,*end;
  189. int again,n;
  190. long eline=0;
  191. CONF_VALUE *v=NULL,*tv;
  192. CONF_VALUE *sv=NULL;
  193. char *section=NULL,*buf;
  194. STACK_OF(CONF_VALUE) *section_sk=NULL,*ts;
  195. char *start,*psection,*pname;
  196. void *h = (void *)(conf->data);
  197. if ((buff=BUF_MEM_new()) == NULL)
  198. {
  199. CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB);
  200. goto err;
  201. }
  202. section=(char *)OPENSSL_malloc(10);
  203. if (section == NULL)
  204. {
  205. CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
  206. goto err;
  207. }
  208. strcpy(section,"default");
  209. if (_CONF_new_data(conf) == 0)
  210. {
  211. CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_MALLOC_FAILURE);
  212. goto err;
  213. }
  214. sv=_CONF_new_section(conf,section);
  215. if (sv == NULL)
  216. {
  217. CONFerr(CONF_F_CONF_LOAD_BIO,
  218. CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
  219. goto err;
  220. }
  221. section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
  222. bufnum=0;
  223. for (;;)
  224. {
  225. again=0;
  226. if (!BUF_MEM_grow(buff,bufnum+BUFSIZE))
  227. {
  228. CONFerr(CONF_F_CONF_LOAD_BIO,ERR_R_BUF_LIB);
  229. goto err;
  230. }
  231. p= &(buff->data[bufnum]);
  232. *p='\0';
  233. BIO_gets(in, p, BUFSIZE-1);
  234. p[BUFSIZE-1]='\0';
  235. ii=i=strlen(p);
  236. if (i == 0) break;
  237. while (i > 0)
  238. {
  239. if ((p[i-1] != '\r') && (p[i-1] != '\n'))
  240. break;
  241. else
  242. i--;
  243. }
  244. /* we removed some trailing stuff so there is a new
  245. * line on the end. */
  246. if (i == ii)
  247. again=1; /* long line */
  248. else
  249. {
  250. p[i]='\0';
  251. eline++; /* another input line */
  252. }
  253. /* we now have a line with trailing \r\n removed */
  254. /* i is the number of bytes */
  255. bufnum+=i;
  256. v=NULL;
  257. /* check for line continuation */
  258. if (bufnum >= 1)
  259. {
  260. /* If we have bytes and the last char '\\' and
  261. * second last char is not '\\' */
  262. p= &(buff->data[bufnum-1]);
  263. if (IS_ESC(conf,p[0]) &&
  264. ((bufnum <= 1) || !IS_ESC(conf,p[-1])))
  265. {
  266. bufnum--;
  267. again=1;
  268. }
  269. }
  270. if (again) continue;
  271. bufnum=0;
  272. buf=buff->data;
  273. clear_comments(conf, buf);
  274. n=strlen(buf);
  275. s=eat_ws(conf, buf);
  276. if (IS_EOF(conf,*s)) continue; /* blank line */
  277. if (*s == '[')
  278. {
  279. char *ss;
  280. s++;
  281. start=eat_ws(conf, s);
  282. ss=start;
  283. again:
  284. end=eat_alpha_numeric(conf, ss);
  285. p=eat_ws(conf, end);
  286. if (*p != ']')
  287. {
  288. if (*p != '\0')
  289. {
  290. ss=p;
  291. goto again;
  292. }
  293. CONFerr(CONF_F_CONF_LOAD_BIO,
  294. CONF_R_MISSING_CLOSE_SQUARE_BRACKET);
  295. goto err;
  296. }
  297. *end='\0';
  298. if (!str_copy(conf,NULL,&section,start)) goto err;
  299. if ((sv=_CONF_get_section(conf,section)) == NULL)
  300. sv=_CONF_new_section(conf,section);
  301. if (sv == NULL)
  302. {
  303. CONFerr(CONF_F_CONF_LOAD_BIO,
  304. CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
  305. goto err;
  306. }
  307. section_sk=(STACK_OF(CONF_VALUE) *)sv->value;
  308. continue;
  309. }
  310. else
  311. {
  312. pname=s;
  313. psection=NULL;
  314. end=eat_alpha_numeric(conf, s);
  315. if ((end[0] == ':') && (end[1] == ':'))
  316. {
  317. *end='\0';
  318. end+=2;
  319. psection=pname;
  320. pname=end;
  321. end=eat_alpha_numeric(conf, end);
  322. }
  323. p=eat_ws(conf, end);
  324. if (*p != '=')
  325. {
  326. CONFerr(CONF_F_CONF_LOAD_BIO,
  327. CONF_R_MISSING_EQUAL_SIGN);
  328. goto err;
  329. }
  330. *end='\0';
  331. p++;
  332. start=eat_ws(conf, p);
  333. while (!IS_EOF(conf,*p))
  334. p++;
  335. p--;
  336. while ((p != start) && (IS_WS(conf,*p)))
  337. p--;
  338. p++;
  339. *p='\0';
  340. if (!(v=(CONF_VALUE *)OPENSSL_malloc(sizeof(CONF_VALUE))))
  341. {
  342. CONFerr(CONF_F_CONF_LOAD_BIO,
  343. ERR_R_MALLOC_FAILURE);
  344. goto err;
  345. }
  346. if (psection == NULL) psection=section;
  347. v->name=(char *)OPENSSL_malloc(strlen(pname)+1);
  348. v->value=NULL;
  349. if (v->name == NULL)
  350. {
  351. CONFerr(CONF_F_CONF_LOAD_BIO,
  352. ERR_R_MALLOC_FAILURE);
  353. goto err;
  354. }
  355. strcpy(v->name,pname);
  356. if (!str_copy(conf,psection,&(v->value),start)) goto err;
  357. if (strcmp(psection,section) != 0)
  358. {
  359. if ((tv=_CONF_get_section(conf,psection))
  360. == NULL)
  361. tv=_CONF_new_section(conf,psection);
  362. if (tv == NULL)
  363. {
  364. CONFerr(CONF_F_CONF_LOAD_BIO,
  365. CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
  366. goto err;
  367. }
  368. ts=(STACK_OF(CONF_VALUE) *)tv->value;
  369. }
  370. else
  371. {
  372. tv=sv;
  373. ts=section_sk;
  374. }
  375. #if 1
  376. if (_CONF_add_string(conf, tv, v) == 0)
  377. {
  378. CONFerr(CONF_F_CONF_LOAD_BIO,
  379. ERR_R_MALLOC_FAILURE);
  380. goto err;
  381. }
  382. #else
  383. v->section=tv->section;
  384. if (!sk_CONF_VALUE_push(ts,v))
  385. {
  386. CONFerr(CONF_F_CONF_LOAD_BIO,
  387. ERR_R_MALLOC_FAILURE);
  388. goto err;
  389. }
  390. vv=(CONF_VALUE *)lh_insert(conf->data,v);
  391. if (vv != NULL)
  392. {
  393. sk_CONF_VALUE_delete_ptr(ts,vv);
  394. OPENSSL_free(vv->name);
  395. OPENSSL_free(vv->value);
  396. OPENSSL_free(vv);
  397. }
  398. #endif
  399. v=NULL;
  400. }
  401. }
  402. if (buff != NULL) BUF_MEM_free(buff);
  403. if (section != NULL) OPENSSL_free(section);
  404. return(1);
  405. err:
  406. if (buff != NULL) BUF_MEM_free(buff);
  407. if (section != NULL) OPENSSL_free(section);
  408. if (line != NULL) *line=eline;
  409. sprintf(btmp,"%ld",eline);
  410. ERR_add_error_data(2,"line ",btmp);
  411. if ((h != conf->data) && (conf->data != NULL)) CONF_free(conf->data);
  412. if (v != NULL)
  413. {
  414. if (v->name != NULL) OPENSSL_free(v->name);
  415. if (v->value != NULL) OPENSSL_free(v->value);
  416. if (v != NULL) OPENSSL_free(v);
  417. }
  418. return(0);
  419. }
  420. static void clear_comments(CONF *conf, char *p)
  421. {
  422. char *to;
  423. to=p;
  424. for (;;)
  425. {
  426. if (IS_FCOMMENT(conf,*p))
  427. {
  428. *p='\0';
  429. return;
  430. }
  431. if (!IS_WS(conf,*p))
  432. {
  433. break;
  434. }
  435. p++;
  436. }
  437. for (;;)
  438. {
  439. if (IS_COMMENT(conf,*p))
  440. {
  441. *p='\0';
  442. return;
  443. }
  444. if (IS_DQUOTE(conf,*p))
  445. {
  446. p=scan_dquote(conf, p);
  447. continue;
  448. }
  449. if (IS_QUOTE(conf,*p))
  450. {
  451. p=scan_quote(conf, p);
  452. continue;
  453. }
  454. if (IS_ESC(conf,*p))
  455. {
  456. p=scan_esc(conf,p);
  457. continue;
  458. }
  459. if (IS_EOF(conf,*p))
  460. return;
  461. else
  462. p++;
  463. }
  464. }
  465. static int str_copy(CONF *conf, char *section, char **pto, char *from)
  466. {
  467. int q,r,rr=0,to=0,len=0;
  468. char *s,*e,*rp,*p,*rrp,*np,*cp,v;
  469. BUF_MEM *buf;
  470. if ((buf=BUF_MEM_new()) == NULL) return(0);
  471. len=strlen(from)+1;
  472. if (!BUF_MEM_grow(buf,len)) goto err;
  473. for (;;)
  474. {
  475. if (IS_QUOTE(conf,*from))
  476. {
  477. q= *from;
  478. from++;
  479. while (!IS_EOF(conf,*from) && (*from != q))
  480. {
  481. if (IS_ESC(conf,*from))
  482. {
  483. from++;
  484. if (IS_EOF(conf,*from)) break;
  485. }
  486. buf->data[to++]= *(from++);
  487. }
  488. if (*from == q) from++;
  489. }
  490. else if (IS_DQUOTE(conf,*from))
  491. {
  492. q= *from;
  493. from++;
  494. while (!IS_EOF(conf,*from))
  495. {
  496. if (*from == q)
  497. {
  498. if (*(from+1) == q)
  499. {
  500. from++;
  501. }
  502. else
  503. {
  504. break;
  505. }
  506. }
  507. buf->data[to++]= *(from++);
  508. }
  509. if (*from == q) from++;
  510. }
  511. else if (IS_ESC(conf,*from))
  512. {
  513. from++;
  514. v= *(from++);
  515. if (IS_EOF(conf,v)) break;
  516. else if (v == 'r') v='\r';
  517. else if (v == 'n') v='\n';
  518. else if (v == 'b') v='\b';
  519. else if (v == 't') v='\t';
  520. buf->data[to++]= v;
  521. }
  522. else if (IS_EOF(conf,*from))
  523. break;
  524. else if (*from == '$')
  525. {
  526. /* try to expand it */
  527. rrp=NULL;
  528. s= &(from[1]);
  529. if (*s == '{')
  530. q='}';
  531. else if (*s == '(')
  532. q=')';
  533. else q=0;
  534. if (q) s++;
  535. cp=section;
  536. e=np=s;
  537. while (IS_ALPHA_NUMERIC(conf,*e))
  538. e++;
  539. if ((e[0] == ':') && (e[1] == ':'))
  540. {
  541. cp=np;
  542. rrp=e;
  543. rr= *e;
  544. *rrp='\0';
  545. e+=2;
  546. np=e;
  547. while (IS_ALPHA_NUMERIC(conf,*e))
  548. e++;
  549. }
  550. r= *e;
  551. *e='\0';
  552. rp=e;
  553. if (q)
  554. {
  555. if (r != q)
  556. {
  557. CONFerr(CONF_F_STR_COPY,CONF_R_NO_CLOSE_BRACE);
  558. goto err;
  559. }
  560. e++;
  561. }
  562. /* So at this point we have
  563. * ns which is the start of the name string which is
  564. * '\0' terminated.
  565. * cs which is the start of the section string which is
  566. * '\0' terminated.
  567. * e is the 'next point after'.
  568. * r and s are the chars replaced by the '\0'
  569. * rp and sp is where 'r' and 's' came from.
  570. */
  571. p=_CONF_get_string(conf,cp,np);
  572. if (rrp != NULL) *rrp=rr;
  573. *rp=r;
  574. if (p == NULL)
  575. {
  576. CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE);
  577. goto err;
  578. }
  579. BUF_MEM_grow(buf,(strlen(p)+len-(e-from)));
  580. while (*p)
  581. buf->data[to++]= *(p++);
  582. from=e;
  583. }
  584. else
  585. buf->data[to++]= *(from++);
  586. }
  587. buf->data[to]='\0';
  588. if (*pto != NULL) OPENSSL_free(*pto);
  589. *pto=buf->data;
  590. OPENSSL_free(buf);
  591. return(1);
  592. err:
  593. if (buf != NULL) BUF_MEM_free(buf);
  594. return(0);
  595. }
  596. static char *eat_ws(CONF *conf, char *p)
  597. {
  598. while (IS_WS(conf,*p) && (!IS_EOF(conf,*p)))
  599. p++;
  600. return(p);
  601. }
  602. static char *eat_alpha_numeric(CONF *conf, char *p)
  603. {
  604. for (;;)
  605. {
  606. if (IS_ESC(conf,*p))
  607. {
  608. p=scan_esc(conf,p);
  609. continue;
  610. }
  611. if (!IS_ALPHA_NUMERIC_PUNCT(conf,*p))
  612. return(p);
  613. p++;
  614. }
  615. }
  616. static char *scan_quote(CONF *conf, char *p)
  617. {
  618. int q= *p;
  619. p++;
  620. while (!(IS_EOF(conf,*p)) && (*p != q))
  621. {
  622. if (IS_ESC(conf,*p))
  623. {
  624. p++;
  625. if (IS_EOF(conf,*p)) return(p);
  626. }
  627. p++;
  628. }
  629. if (*p == q) p++;
  630. return(p);
  631. }
  632. static char *scan_dquote(CONF *conf, char *p)
  633. {
  634. int q= *p;
  635. p++;
  636. while (!(IS_EOF(conf,*p)))
  637. {
  638. if (*p == q)
  639. {
  640. if (*(p+1) == q)
  641. {
  642. p++;
  643. }
  644. else
  645. {
  646. break;
  647. }
  648. }
  649. p++;
  650. }
  651. if (*p == q) p++;
  652. return(p);
  653. }
  654. static void dump_value(CONF_VALUE *a, BIO *out)
  655. {
  656. if (a->name)
  657. BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value);
  658. else
  659. BIO_printf(out, "[[%s]]\n", a->section);
  660. }
  661. static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE *, BIO *)
  662. static int def_dump(CONF *conf, BIO *out)
  663. {
  664. lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), out);
  665. return 1;
  666. }
  667. static int def_is_number(CONF *conf, char c)
  668. {
  669. return IS_NUMBER(conf,c);
  670. }
  671. static int def_to_int(CONF *conf, char c)
  672. {
  673. return c - '0';
  674. }