static int def_load_bio(CONF *conf, BIO *in, long *line)
{
#define CONFBUFSIZE     512
    int bufnum = 0, i, ii;
    BUF_MEM *buff = NULL;
    char *s, *p, *end;
    int again;
    long eline = 0;
    char btmp[DECIMAL_SIZE(eline) + 1];
    CONF_VALUE *v = NULL, *tv;
    CONF_VALUE *sv = NULL;
    char *section = NULL, *buf;
    char *start, *psection, *pname;
    void *h = (void *)(conf->data);
    STACK_OF(BIO) *biosk = NULL;
#ifndef OPENSSL_NO_POSIX_IO
    char *dirpath = NULL;
    OPENSSL_DIR_CTX *dirctx = NULL;
#endif
    if ((buff = BUF_MEM_new()) == NULL) {
        CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB);
        goto err;
    }
    section = OPENSSL_strdup("default");
    if (section == NULL) {
        CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
        goto err;
    }
    if (_CONF_new_data(conf) == 0) {
        CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
        goto err;
    }
    sv = _CONF_new_section(conf, section);
    if (sv == NULL) {
        CONFerr(CONF_F_DEF_LOAD_BIO, CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
        goto err;
    }
    bufnum = 0;
    again = 0;
    for (;;) {
        if (!BUF_MEM_grow(buff, bufnum + CONFBUFSIZE)) {
            CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB);
            goto err;
        }
        p = &(buff->data[bufnum]);
        *p = '\0';
 read_retry:
        BIO_gets(in, p, CONFBUFSIZE - 1);
        p[CONFBUFSIZE - 1] = '\0';
        ii = i = strlen(p);
        if (i == 0 && !again) {
            BIO *parent;
#ifndef OPENSSL_NO_POSIX_IO
            if (dirctx != NULL) {
                BIO *next;
                if ((next = get_next_file(dirpath, &dirctx)) != NULL) {
                    BIO_vfree(in);
                    in = next;
                    goto read_retry;
                } else {
                    OPENSSL_free(dirpath);
                    dirpath = NULL;
                }
            }
#endif
            if ((parent = sk_BIO_pop(biosk)) == NULL) {
                break;
            } else {
                BIO_vfree(in);
                in = parent;
                goto read_retry;
            }
        }
        again = 0;
        while (i > 0) {
            if ((p[i - 1] != '\r') && (p[i - 1] != '\n'))
                break;
            else
                i--;
        }
        if (ii && i == ii)
            again = 1;
        else {
            p[i] = '\0';
            eline++;
        }
        bufnum += i;
        v = NULL;
        if (bufnum >= 1) {
            p = &(buff->data[bufnum - 1]);
            if (IS_ESC(conf, p[0]) && ((bufnum <= 1) || !IS_ESC(conf, p[-1]))) {
                bufnum--;
                again = 1;
            }
        }
        if (again)
            continue;
        bufnum = 0;
        buf = buff->data;
        clear_comments(conf, buf);
        s = eat_ws(conf, buf);
        if (IS_EOF(conf, *s))
            continue;
        if (*s == '[') {
            char *ss;
            s++;
            start = eat_ws(conf, s);
            ss = start;
 again:
            end = eat_alpha_numeric(conf, ss);
            p = eat_ws(conf, end);
            if (*p != ']') {
                if (*p != '\0' && ss != p) {
                    ss = p;
                    goto again;
                }
                CONFerr(CONF_F_DEF_LOAD_BIO,
                        CONF_R_MISSING_CLOSE_SQUARE_BRACKET);
                goto err;
            }
            *end = '\0';
            if (!str_copy(conf, NULL, &section, start))
                goto err;
            if ((sv = _CONF_get_section(conf, section)) == NULL)
                sv = _CONF_new_section(conf, section);
            if (sv == NULL) {
                CONFerr(CONF_F_DEF_LOAD_BIO,
                        CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
                goto err;
            }
            continue;
        } else {
            pname = s;
            end = eat_alpha_numeric(conf, s);
            if ((end[0] == ':') && (end[1] == ':')) {
                *end = '\0';
                end += 2;
                psection = pname;
                pname = end;
                end = eat_alpha_numeric(conf, end);
            } else {
                psection = section;
            }
            p = eat_ws(conf, end);
            if (strncmp(pname, ".include", 8) == 0 && p != pname + 8) {
                char *include = NULL;
                BIO *next;
                trim_ws(conf, p);
                if (!str_copy(conf, psection, &include, p))
                    goto err;
#ifndef OPENSSL_NO_POSIX_IO
                next = process_include(include, &dirctx, &dirpath);
                if (include != dirpath) {
                    OPENSSL_free(include);
                }
#else
                next = BIO_new_file(include, "r");
                OPENSSL_free(include);
#endif
                if (next != NULL) {
                    if (biosk == NULL) {
                        if ((biosk = sk_BIO_new_null()) == NULL) {
                            CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
                            goto err;
                        }
                    }
                    if (!sk_BIO_push(biosk, in)) {
                        CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
                        goto err;
                    }
                    in = next;
                }
                continue;
            } else if (*p != '=') {
                CONFerr(CONF_F_DEF_LOAD_BIO, CONF_R_MISSING_EQUAL_SIGN);
                goto err;
            }
            *end = '\0';
            p++;
            start = eat_ws(conf, p);
            trim_ws(conf, start);
            if ((v = OPENSSL_malloc(sizeof(*v))) == NULL) {
                CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
                goto err;
            }
            v->name = OPENSSL_strdup(pname);
            v->value = NULL;
            if (v->name == NULL) {
                CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
                goto err;
            }
            if (!str_copy(conf, psection, &(v->value), start))
                goto err;
            if (strcmp(psection, section) != 0) {
                if ((tv = _CONF_get_section(conf, psection))
                    == NULL)
                    tv = _CONF_new_section(conf, psection);
                if (tv == NULL) {
                    CONFerr(CONF_F_DEF_LOAD_BIO,
                            CONF_R_UNABLE_TO_CREATE_NEW_SECTION);
                    goto err;
                }
            } else
                tv = sv;
            if (_CONF_add_string(conf, tv, v) == 0) {
                CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);
                goto err;
            }
            v = NULL;
        }
    }
    BUF_MEM_free(buff);
    OPENSSL_free(section);
    sk_BIO_pop_free(biosk, BIO_vfree);
    return 1;
 err:
    BUF_MEM_free(buff);
    OPENSSL_free(section);
    sk_BIO_pop_free(biosk, BIO_vfree);
#ifndef OPENSSL_NO_POSIX_IO
    OPENSSL_free(dirpath);
    if (dirctx != NULL)
        OPENSSL_DIR_end(&dirctx);
#endif
    if (line != NULL)
        *line = eline;
    BIO_snprintf(btmp, sizeof(btmp), "%ld", eline);
    ERR_add_error_data(2, "line ", btmp);
    if (h != conf->data) {
        CONF_free(conf->data);
        conf->data = NULL;
    }
    if (v != NULL) {
        OPENSSL_free(v->name);
        OPENSSL_free(v->value);
        OPENSSL_free(v);
    }
    return 0;
}
['static int def_load_bio(CONF *conf, BIO *in, long *line)\n{\n#define CONFBUFSIZE     512\n    int bufnum = 0, i, ii;\n    BUF_MEM *buff = NULL;\n    char *s, *p, *end;\n    int again;\n    long eline = 0;\n    char btmp[DECIMAL_SIZE(eline) + 1];\n    CONF_VALUE *v = NULL, *tv;\n    CONF_VALUE *sv = NULL;\n    char *section = NULL, *buf;\n    char *start, *psection, *pname;\n    void *h = (void *)(conf->data);\n    STACK_OF(BIO) *biosk = NULL;\n#ifndef OPENSSL_NO_POSIX_IO\n    char *dirpath = NULL;\n    OPENSSL_DIR_CTX *dirctx = NULL;\n#endif\n    if ((buff = BUF_MEM_new()) == NULL) {\n        CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB);\n        goto err;\n    }\n    section = OPENSSL_strdup("default");\n    if (section == NULL) {\n        CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    if (_CONF_new_data(conf) == 0) {\n        CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    sv = _CONF_new_section(conf, section);\n    if (sv == NULL) {\n        CONFerr(CONF_F_DEF_LOAD_BIO, CONF_R_UNABLE_TO_CREATE_NEW_SECTION);\n        goto err;\n    }\n    bufnum = 0;\n    again = 0;\n    for (;;) {\n        if (!BUF_MEM_grow(buff, bufnum + CONFBUFSIZE)) {\n            CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB);\n            goto err;\n        }\n        p = &(buff->data[bufnum]);\n        *p = \'\\0\';\n read_retry:\n        BIO_gets(in, p, CONFBUFSIZE - 1);\n        p[CONFBUFSIZE - 1] = \'\\0\';\n        ii = i = strlen(p);\n        if (i == 0 && !again) {\n            BIO *parent;\n#ifndef OPENSSL_NO_POSIX_IO\n            if (dirctx != NULL) {\n                BIO *next;\n                if ((next = get_next_file(dirpath, &dirctx)) != NULL) {\n                    BIO_vfree(in);\n                    in = next;\n                    goto read_retry;\n                } else {\n                    OPENSSL_free(dirpath);\n                    dirpath = NULL;\n                }\n            }\n#endif\n            if ((parent = sk_BIO_pop(biosk)) == NULL) {\n                break;\n            } else {\n                BIO_vfree(in);\n                in = parent;\n                goto read_retry;\n            }\n        }\n        again = 0;\n        while (i > 0) {\n            if ((p[i - 1] != \'\\r\') && (p[i - 1] != \'\\n\'))\n                break;\n            else\n                i--;\n        }\n        if (ii && i == ii)\n            again = 1;\n        else {\n            p[i] = \'\\0\';\n            eline++;\n        }\n        bufnum += i;\n        v = NULL;\n        if (bufnum >= 1) {\n            p = &(buff->data[bufnum - 1]);\n            if (IS_ESC(conf, p[0]) && ((bufnum <= 1) || !IS_ESC(conf, p[-1]))) {\n                bufnum--;\n                again = 1;\n            }\n        }\n        if (again)\n            continue;\n        bufnum = 0;\n        buf = buff->data;\n        clear_comments(conf, buf);\n        s = eat_ws(conf, buf);\n        if (IS_EOF(conf, *s))\n            continue;\n        if (*s == \'[\') {\n            char *ss;\n            s++;\n            start = eat_ws(conf, s);\n            ss = start;\n again:\n            end = eat_alpha_numeric(conf, ss);\n            p = eat_ws(conf, end);\n            if (*p != \']\') {\n                if (*p != \'\\0\' && ss != p) {\n                    ss = p;\n                    goto again;\n                }\n                CONFerr(CONF_F_DEF_LOAD_BIO,\n                        CONF_R_MISSING_CLOSE_SQUARE_BRACKET);\n                goto err;\n            }\n            *end = \'\\0\';\n            if (!str_copy(conf, NULL, &section, start))\n                goto err;\n            if ((sv = _CONF_get_section(conf, section)) == NULL)\n                sv = _CONF_new_section(conf, section);\n            if (sv == NULL) {\n                CONFerr(CONF_F_DEF_LOAD_BIO,\n                        CONF_R_UNABLE_TO_CREATE_NEW_SECTION);\n                goto err;\n            }\n            continue;\n        } else {\n            pname = s;\n            end = eat_alpha_numeric(conf, s);\n            if ((end[0] == \':\') && (end[1] == \':\')) {\n                *end = \'\\0\';\n                end += 2;\n                psection = pname;\n                pname = end;\n                end = eat_alpha_numeric(conf, end);\n            } else {\n                psection = section;\n            }\n            p = eat_ws(conf, end);\n            if (strncmp(pname, ".include", 8) == 0 && p != pname + 8) {\n                char *include = NULL;\n                BIO *next;\n                trim_ws(conf, p);\n                if (!str_copy(conf, psection, &include, p))\n                    goto err;\n#ifndef OPENSSL_NO_POSIX_IO\n                next = process_include(include, &dirctx, &dirpath);\n                if (include != dirpath) {\n                    OPENSSL_free(include);\n                }\n#else\n                next = BIO_new_file(include, "r");\n                OPENSSL_free(include);\n#endif\n                if (next != NULL) {\n                    if (biosk == NULL) {\n                        if ((biosk = sk_BIO_new_null()) == NULL) {\n                            CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);\n                            goto err;\n                        }\n                    }\n                    if (!sk_BIO_push(biosk, in)) {\n                        CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);\n                        goto err;\n                    }\n                    in = next;\n                }\n                continue;\n            } else if (*p != \'=\') {\n                CONFerr(CONF_F_DEF_LOAD_BIO, CONF_R_MISSING_EQUAL_SIGN);\n                goto err;\n            }\n            *end = \'\\0\';\n            p++;\n            start = eat_ws(conf, p);\n            trim_ws(conf, start);\n            if ((v = OPENSSL_malloc(sizeof(*v))) == NULL) {\n                CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);\n                goto err;\n            }\n            v->name = OPENSSL_strdup(pname);\n            v->value = NULL;\n            if (v->name == NULL) {\n                CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);\n                goto err;\n            }\n            if (!str_copy(conf, psection, &(v->value), start))\n                goto err;\n            if (strcmp(psection, section) != 0) {\n                if ((tv = _CONF_get_section(conf, psection))\n                    == NULL)\n                    tv = _CONF_new_section(conf, psection);\n                if (tv == NULL) {\n                    CONFerr(CONF_F_DEF_LOAD_BIO,\n                            CONF_R_UNABLE_TO_CREATE_NEW_SECTION);\n                    goto err;\n                }\n            } else\n                tv = sv;\n            if (_CONF_add_string(conf, tv, v) == 0) {\n                CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE);\n                goto err;\n            }\n            v = NULL;\n        }\n    }\n    BUF_MEM_free(buff);\n    OPENSSL_free(section);\n    sk_BIO_pop_free(biosk, BIO_vfree);\n    return 1;\n err:\n    BUF_MEM_free(buff);\n    OPENSSL_free(section);\n    sk_BIO_pop_free(biosk, BIO_vfree);\n#ifndef OPENSSL_NO_POSIX_IO\n    OPENSSL_free(dirpath);\n    if (dirctx != NULL)\n        OPENSSL_DIR_end(&dirctx);\n#endif\n    if (line != NULL)\n        *line = eline;\n    BIO_snprintf(btmp, sizeof(btmp), "%ld", eline);\n    ERR_add_error_data(2, "line ", btmp);\n    if (h != conf->data) {\n        CONF_free(conf->data);\n        conf->data = NULL;\n    }\n    if (v != NULL) {\n        OPENSSL_free(v->name);\n        OPENSSL_free(v->value);\n        OPENSSL_free(v);\n    }\n    return 0;\n}']