diff options
author | Richard Levitte <levitte@openssl.org> | 2000-10-19 10:26:32 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2000-10-19 10:26:32 +0200 |
commit | befb3e7a4de7af6039ae2d37e995675e8f5fddc5 (patch) | |
tree | a1c6b5be70bcc2bc810f6164ad35ca93afc5b641 /crypto/conf/conf_def.c | |
parent | NCONF_get_number() has no error checking at all. As a replacement, (diff) | |
download | openssl-befb3e7a4de7af6039ae2d37e995675e8f5fddc5.tar.xz openssl-befb3e7a4de7af6039ae2d37e995675e8f5fddc5.zip |
Make it possible for methods to load from something other than a BIO,
by providing a function pointer that is given a name instead of a BIO.
For example, this could be used to load configuration data from an
LDAP server.
Diffstat (limited to 'crypto/conf/conf_def.c')
-rw-r--r-- | crypto/conf/conf_def.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c index 773df32c68..7cf14316d5 100644 --- a/crypto/conf/conf_def.c +++ b/crypto/conf/conf_def.c @@ -81,7 +81,8 @@ static int def_init_default(CONF *conf); static int def_init_WIN32(CONF *conf); static int def_destroy(CONF *conf); static int def_destroy_data(CONF *conf); -static int def_load(CONF *conf, BIO *bp, long *eline); +static int def_load(CONF *conf, const char *name, long *eline); +static int def_load_bio(CONF *conf, BIO *bp, long *eline); static int def_dump(CONF *conf, BIO *bp); static int def_is_number(CONF *conf, char c); static int def_to_int(CONF *conf, char c); @@ -95,6 +96,7 @@ static CONF_METHOD default_method = { def_destroy, def_destroy_data, def_load, + def_load_bio, def_dump, def_is_number, def_to_int @@ -107,6 +109,7 @@ static CONF_METHOD WIN32_method = { def_destroy, def_destroy_data, def_load, + def_load_bio, def_dump, def_is_number, def_to_int @@ -177,7 +180,29 @@ static int def_destroy_data(CONF *conf) return 1; } -static int def_load(CONF *conf, BIO *in, long *line) +static int def_load(CONF *conf, const char *name, long *line) + { + int ret; + BIO *in=NULL; + +#ifdef VMS + in=BIO_new_file(name, "r"); +#else + in=BIO_new_file(name, "rb"); +#endif + if (in == NULL) + { + CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); + return 0; + } + + ret = def_load_bio(conf, in, line); + BIO_free(in); + + return ret; + } + +static int def_load_bio(CONF *conf, BIO *in, long *line) { #define BUFSIZE 512 char btmp[16]; |