diff options
| author | beck <> | 2001-06-22 00:03:44 +0000 |
|---|---|---|
| committer | beck <> | 2001-06-22 00:03:44 +0000 |
| commit | 38b6ff9e5294811c57541ad47940f8f8f41dc114 (patch) | |
| tree | 402699541cee3cf3f2943b0384dbda7de534de70 /src/lib/libcrypto/conf | |
| parent | afae624d63e4e717c5bae8c7842a4712309f728f (diff) | |
| download | openbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.tar.gz openbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.tar.bz2 openbsd-38b6ff9e5294811c57541ad47940f8f8f41dc114.zip | |
openssl-engine-0.9.6a merge
Diffstat (limited to 'src/lib/libcrypto/conf')
| -rw-r--r-- | src/lib/libcrypto/conf/Makefile.ssl | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/conf/conf.h | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/conf/conf_err.c | 2 | ||||
| -rw-r--r-- | src/lib/libcrypto/conf/conf_lib.c | 84 |
4 files changed, 68 insertions, 23 deletions
diff --git a/src/lib/libcrypto/conf/Makefile.ssl b/src/lib/libcrypto/conf/Makefile.ssl index efbb578981..9df4fca877 100644 --- a/src/lib/libcrypto/conf/Makefile.ssl +++ b/src/lib/libcrypto/conf/Makefile.ssl | |||
| @@ -40,7 +40,8 @@ all: lib | |||
| 40 | 40 | ||
| 41 | lib: $(LIBOBJ) | 41 | lib: $(LIBOBJ) |
| 42 | $(AR) $(LIB) $(LIBOBJ) | 42 | $(AR) $(LIB) $(LIBOBJ) |
| 43 | $(RANLIB) $(LIB) | 43 | @echo You may get an error following this line. Please ignore. |
| 44 | - $(RANLIB) $(LIB) | ||
| 44 | @touch lib | 45 | @touch lib |
| 45 | 46 | ||
| 46 | files: | 47 | files: |
diff --git a/src/lib/libcrypto/conf/conf.h b/src/lib/libcrypto/conf/conf.h index 2f70634455..cd40a0db21 100644 --- a/src/lib/libcrypto/conf/conf.h +++ b/src/lib/libcrypto/conf/conf.h | |||
| @@ -167,6 +167,8 @@ int NCONF_dump_bio(CONF *conf, BIO *out); | |||
| 167 | #define CONF_R_MISSING_EQUAL_SIGN 101 | 167 | #define CONF_R_MISSING_EQUAL_SIGN 101 |
| 168 | #define CONF_R_NO_CLOSE_BRACE 102 | 168 | #define CONF_R_NO_CLOSE_BRACE 102 |
| 169 | #define CONF_R_NO_CONF 105 | 169 | #define CONF_R_NO_CONF 105 |
| 170 | #define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106 | ||
| 171 | #define CONF_R_NO_SECTION 107 | ||
| 170 | #define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 | 172 | #define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103 |
| 171 | #define CONF_R_VARIABLE_HAS_NO_VALUE 104 | 173 | #define CONF_R_VARIABLE_HAS_NO_VALUE 104 |
| 172 | 174 | ||
diff --git a/src/lib/libcrypto/conf/conf_err.c b/src/lib/libcrypto/conf/conf_err.c index 06d3163573..8c2bc6f1c4 100644 --- a/src/lib/libcrypto/conf/conf_err.c +++ b/src/lib/libcrypto/conf/conf_err.c | |||
| @@ -87,6 +87,8 @@ static ERR_STRING_DATA CONF_str_reasons[]= | |||
| 87 | {CONF_R_MISSING_EQUAL_SIGN ,"missing equal sign"}, | 87 | {CONF_R_MISSING_EQUAL_SIGN ,"missing equal sign"}, |
| 88 | {CONF_R_NO_CLOSE_BRACE ,"no close brace"}, | 88 | {CONF_R_NO_CLOSE_BRACE ,"no close brace"}, |
| 89 | {CONF_R_NO_CONF ,"no conf"}, | 89 | {CONF_R_NO_CONF ,"no conf"}, |
| 90 | {CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE ,"no conf or environment variable"}, | ||
| 91 | {CONF_R_NO_SECTION ,"no section"}, | ||
| 90 | {CONF_R_UNABLE_TO_CREATE_NEW_SECTION ,"unable to create new section"}, | 92 | {CONF_R_UNABLE_TO_CREATE_NEW_SECTION ,"unable to create new section"}, |
| 91 | {CONF_R_VARIABLE_HAS_NO_VALUE ,"variable has no value"}, | 93 | {CONF_R_VARIABLE_HAS_NO_VALUE ,"variable has no value"}, |
| 92 | {0,NULL} | 94 | {0,NULL} |
diff --git a/src/lib/libcrypto/conf/conf_lib.c b/src/lib/libcrypto/conf/conf_lib.c index 4c8ca9e9ae..11ec639732 100644 --- a/src/lib/libcrypto/conf/conf_lib.c +++ b/src/lib/libcrypto/conf/conf_lib.c | |||
| @@ -131,38 +131,59 @@ LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline) | |||
| 131 | 131 | ||
| 132 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section) | 132 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,char *section) |
| 133 | { | 133 | { |
| 134 | CONF ctmp; | 134 | if (conf == NULL) |
| 135 | { | ||
| 136 | return NULL; | ||
| 137 | } | ||
| 138 | else | ||
| 139 | { | ||
| 140 | CONF ctmp; | ||
| 135 | 141 | ||
| 136 | if (default_CONF_method == NULL) | 142 | if (default_CONF_method == NULL) |
| 137 | default_CONF_method = NCONF_default(); | 143 | default_CONF_method = NCONF_default(); |
| 138 | 144 | ||
| 139 | default_CONF_method->init(&ctmp); | 145 | default_CONF_method->init(&ctmp); |
| 140 | ctmp.data = conf; | 146 | ctmp.data = conf; |
| 141 | return NCONF_get_section(&ctmp, section); | 147 | return NCONF_get_section(&ctmp, section); |
| 148 | } | ||
| 142 | } | 149 | } |
| 143 | 150 | ||
| 144 | char *CONF_get_string(LHASH *conf,char *group,char *name) | 151 | char *CONF_get_string(LHASH *conf,char *group,char *name) |
| 145 | { | 152 | { |
| 146 | CONF ctmp; | 153 | if (conf == NULL) |
| 154 | { | ||
| 155 | return NCONF_get_string(NULL, group, name); | ||
| 156 | } | ||
| 157 | else | ||
| 158 | { | ||
| 159 | CONF ctmp; | ||
| 147 | 160 | ||
| 148 | if (default_CONF_method == NULL) | 161 | if (default_CONF_method == NULL) |
| 149 | default_CONF_method = NCONF_default(); | 162 | default_CONF_method = NCONF_default(); |
| 150 | 163 | ||
| 151 | default_CONF_method->init(&ctmp); | 164 | default_CONF_method->init(&ctmp); |
| 152 | ctmp.data = conf; | 165 | ctmp.data = conf; |
| 153 | return NCONF_get_string(&ctmp, group, name); | 166 | return NCONF_get_string(&ctmp, group, name); |
| 167 | } | ||
| 154 | } | 168 | } |
| 155 | 169 | ||
| 156 | long CONF_get_number(LHASH *conf,char *group,char *name) | 170 | long CONF_get_number(LHASH *conf,char *group,char *name) |
| 157 | { | 171 | { |
| 158 | CONF ctmp; | 172 | if (conf == NULL) |
| 173 | { | ||
| 174 | return NCONF_get_number(NULL, group, name); | ||
| 175 | } | ||
| 176 | else | ||
| 177 | { | ||
| 178 | CONF ctmp; | ||
| 159 | 179 | ||
| 160 | if (default_CONF_method == NULL) | 180 | if (default_CONF_method == NULL) |
| 161 | default_CONF_method = NCONF_default(); | 181 | default_CONF_method = NCONF_default(); |
| 162 | 182 | ||
| 163 | default_CONF_method->init(&ctmp); | 183 | default_CONF_method->init(&ctmp); |
| 164 | ctmp.data = conf; | 184 | ctmp.data = conf; |
| 165 | return NCONF_get_number(&ctmp, group, name); | 185 | return NCONF_get_number(&ctmp, group, name); |
| 186 | } | ||
| 166 | } | 187 | } |
| 167 | 188 | ||
| 168 | void CONF_free(LHASH *conf) | 189 | void CONF_free(LHASH *conf) |
| @@ -299,27 +320,46 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(CONF *conf,char *section) | |||
| 299 | return NULL; | 320 | return NULL; |
| 300 | } | 321 | } |
| 301 | 322 | ||
| 323 | if (section == NULL) | ||
| 324 | { | ||
| 325 | CONFerr(CONF_F_NCONF_GET_SECTION,CONF_R_NO_SECTION); | ||
| 326 | return NULL; | ||
| 327 | } | ||
| 328 | |||
| 302 | return _CONF_get_section_values(conf, section); | 329 | return _CONF_get_section_values(conf, section); |
| 303 | } | 330 | } |
| 304 | 331 | ||
| 305 | char *NCONF_get_string(CONF *conf,char *group,char *name) | 332 | char *NCONF_get_string(CONF *conf,char *group,char *name) |
| 306 | { | 333 | { |
| 334 | char *s = _CONF_get_string(conf, group, name); | ||
| 335 | |||
| 336 | /* Since we may get a value from an environment variable even | ||
| 337 | if conf is NULL, let's check the value first */ | ||
| 338 | if (s) return s; | ||
| 339 | |||
| 307 | if (conf == NULL) | 340 | if (conf == NULL) |
| 308 | { | 341 | { |
| 309 | CONFerr(CONF_F_NCONF_GET_STRING,CONF_R_NO_CONF); | 342 | CONFerr(CONF_F_NCONF_GET_STRING, |
| 343 | CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE); | ||
| 310 | return NULL; | 344 | return NULL; |
| 311 | } | 345 | } |
| 312 | 346 | return NULL; | |
| 313 | return _CONF_get_string(conf, group, name); | ||
| 314 | } | 347 | } |
| 315 | 348 | ||
| 316 | long NCONF_get_number(CONF *conf,char *group,char *name) | 349 | long NCONF_get_number(CONF *conf,char *group,char *name) |
| 317 | { | 350 | { |
| 351 | #if 0 /* As with _CONF_get_string(), we rely on the possibility of finding | ||
| 352 | an environment variable with a suitable name. Unfortunately, there's | ||
| 353 | no way with the current API to see if we found one or not... | ||
| 354 | The meaning of this is that if a number is not found anywhere, it | ||
| 355 | will always default to 0. */ | ||
| 318 | if (conf == NULL) | 356 | if (conf == NULL) |
| 319 | { | 357 | { |
| 320 | CONFerr(CONF_F_NCONF_GET_NUMBER,CONF_R_NO_CONF); | 358 | CONFerr(CONF_F_NCONF_GET_NUMBER, |
| 359 | CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE); | ||
| 321 | return 0; | 360 | return 0; |
| 322 | } | 361 | } |
| 362 | #endif | ||
| 323 | 363 | ||
| 324 | return _CONF_get_number(conf, group, name); | 364 | return _CONF_get_number(conf, group, name); |
| 325 | } | 365 | } |
