No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

788 líneas
18 KiB

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