diff options
| author | jsing <> | 2014-04-20 09:04:56 +0000 |
|---|---|---|
| committer | jsing <> | 2014-04-20 09:04:56 +0000 |
| commit | 6249bd82c9cf637e8e84cccf990b7315b51a8fa6 (patch) | |
| tree | 3bbbbcfdf498b9882728fadf15db366c75a077ef /src/lib/libssl | |
| parent | df7123d4228a0291f8d00034efe1bdba1778a464 (diff) | |
| download | openbsd-6249bd82c9cf637e8e84cccf990b7315b51a8fa6.tar.gz openbsd-6249bd82c9cf637e8e84cccf990b7315b51a8fa6.tar.bz2 openbsd-6249bd82c9cf637e8e84cccf990b7315b51a8fa6.zip | |
KNF.
Diffstat (limited to 'src/lib/libssl')
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/cnf_save.c | 56 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/conf.h | 73 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/conf_api.c | 306 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/conf_api.h | 17 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/conf_def.c | 812 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/conf_def.h | 149 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/conf_err.c | 109 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/conf_lib.c | 312 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/conf_mall.c | 10 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/conf_mod.c | 370 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/conf_sap.c | 29 | ||||
| -rw-r--r-- | src/lib/libssl/src/crypto/conf/test.c | 45 |
12 files changed, 1134 insertions, 1154 deletions
diff --git a/src/lib/libssl/src/crypto/conf/cnf_save.c b/src/lib/libssl/src/crypto/conf/cnf_save.c index 1439487526..46d71e5e43 100644 --- a/src/lib/libssl/src/crypto/conf/cnf_save.c +++ b/src/lib/libssl/src/crypto/conf/cnf_save.c | |||
| @@ -5,21 +5,21 @@ | |||
| 5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
| 6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
| 7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
| 8 | * | 8 | * |
| 9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
| 10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | 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 | 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 | 13 | * included with this distribution is covered by the same copyright terms |
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 15 | * | 15 | * |
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
| 18 | * If this package is used in a product, Eric Young should be given attribution | 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. | 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 | 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. | 21 | * in documentation (online or textual) provided with the package. |
| 22 | * | 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: | 25 | * are met: |
| @@ -34,10 +34,10 @@ | |||
| 34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
| 36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 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: | 38 | * the apps directory (application code) you must include an acknowledgement: |
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 40 | * | 40 | * |
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -49,7 +49,7 @@ | |||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 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 | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
| 52 | * | 52 | * |
| 53 | * The licence and distribution terms for any publically available version or | 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 | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| @@ -63,23 +63,22 @@ static void print_conf(CONF_VALUE *cv); | |||
| 63 | static IMPLEMENT_LHASH_DOALL_FN(print_conf, CONF_VALUE *); | 63 | static IMPLEMENT_LHASH_DOALL_FN(print_conf, CONF_VALUE *); |
| 64 | 64 | ||
| 65 | main() | 65 | main() |
| 66 | { | 66 | { |
| 67 | LHASH *conf; | 67 | LHASH *conf; |
| 68 | long l; | 68 | long l; |
| 69 | 69 | ||
| 70 | conf=CONF_load(NULL,"../../apps/openssl.cnf",&l); | 70 | conf = CONF_load(NULL, "../../apps/openssl.cnf", &l); |
| 71 | if (conf == NULL) | 71 | if (conf == NULL) { |
| 72 | { | 72 | fprintf(stderr, "error loading config, line %ld\n", l); |
| 73 | fprintf(stderr,"error loading config, line %ld\n",l); | ||
| 74 | exit(1); | 73 | exit(1); |
| 75 | } | ||
| 76 | |||
| 77 | lh_doall(conf,LHASH_DOALL_FN(print_conf)); | ||
| 78 | } | 74 | } |
| 79 | 75 | ||
| 76 | lh_doall(conf, LHASH_DOALL_FN(print_conf)); | ||
| 77 | } | ||
| 80 | 78 | ||
| 81 | static void print_conf(CONF_VALUE *cv) | 79 | static void |
| 82 | { | 80 | print_conf(CONF_VALUE *cv) |
| 81 | { | ||
| 83 | int i; | 82 | int i; |
| 84 | CONF_VALUE *v; | 83 | CONF_VALUE *v; |
| 85 | char *section; | 84 | char *section; |
| @@ -88,19 +87,18 @@ static void print_conf(CONF_VALUE *cv) | |||
| 88 | STACK *s; | 87 | STACK *s; |
| 89 | 88 | ||
| 90 | /* If it is a single entry, return */ | 89 | /* If it is a single entry, return */ |
| 90 | if (cv->name != NULL) | ||
| 91 | return; | ||
| 91 | 92 | ||
| 92 | if (cv->name != NULL) return; | 93 | printf("[ %s ]\n", cv->section); |
| 93 | 94 | s = (STACK *)cv->value; | |
| 94 | printf("[ %s ]\n",cv->section); | ||
| 95 | s=(STACK *)cv->value; | ||
| 96 | 95 | ||
| 97 | for (i=0; i<sk_num(s); i++) | 96 | for (i = 0; i < sk_num(s); i++) { |
| 98 | { | 97 | v = (CONF_VALUE *)sk_value(s, i); |
| 99 | v=(CONF_VALUE *)sk_value(s,i); | 98 | section = (v->section == NULL) ? "None" : v->section; |
| 100 | section=(v->section == NULL)?"None":v->section; | 99 | name = (v->name == NULL) ? "None" : v->name; |
| 101 | name=(v->name == NULL)?"None":v->name; | 100 | value = (v->value == NULL) ? "None" : v->value; |
| 102 | value=(v->value == NULL)?"None":v->value; | 101 | printf("%s=%s\n", name, value); |
| 103 | printf("%s=%s\n",name,value); | ||
| 104 | } | ||
| 105 | printf("\n"); | ||
| 106 | } | 102 | } |
| 103 | printf("\n"); | ||
| 104 | } | ||
diff --git a/src/lib/libssl/src/crypto/conf/conf.h b/src/lib/libssl/src/crypto/conf/conf.h index c2199978a3..9c392a44ce 100644 --- a/src/lib/libssl/src/crypto/conf/conf.h +++ b/src/lib/libssl/src/crypto/conf/conf.h | |||
| @@ -5,21 +5,21 @@ | |||
| 5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
| 6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
| 7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
| 8 | * | 8 | * |
| 9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
| 10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | 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 | 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 | 13 | * included with this distribution is covered by the same copyright terms |
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 15 | * | 15 | * |
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
| 18 | * If this package is used in a product, Eric Young should be given attribution | 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. | 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 | 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. | 21 | * in documentation (online or textual) provided with the package. |
| 22 | * | 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: | 25 | * are met: |
| @@ -34,10 +34,10 @@ | |||
| 34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
| 36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 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: | 38 | * the apps directory (application code) you must include an acknowledgement: |
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 40 | * | 40 | * |
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -49,7 +49,7 @@ | |||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 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 | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
| 52 | * | 52 | * |
| 53 | * The licence and distribution terms for any publically available version or | 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 | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| @@ -71,12 +71,11 @@ | |||
| 71 | extern "C" { | 71 | extern "C" { |
| 72 | #endif | 72 | #endif |
| 73 | 73 | ||
| 74 | typedef struct | 74 | typedef struct { |
| 75 | { | ||
| 76 | char *section; | 75 | char *section; |
| 77 | char *name; | 76 | char *name; |
| 78 | char *value; | 77 | char *value; |
| 79 | } CONF_VALUE; | 78 | } CONF_VALUE; |
| 80 | 79 | ||
| 81 | DECLARE_STACK_OF(CONF_VALUE) | 80 | DECLARE_STACK_OF(CONF_VALUE) |
| 82 | DECLARE_LHASH_OF(CONF_VALUE); | 81 | DECLARE_LHASH_OF(CONF_VALUE); |
| @@ -85,8 +84,7 @@ struct conf_st; | |||
| 85 | struct conf_method_st; | 84 | struct conf_method_st; |
| 86 | typedef struct conf_method_st CONF_METHOD; | 85 | typedef struct conf_method_st CONF_METHOD; |
| 87 | 86 | ||
| 88 | struct conf_method_st | 87 | struct conf_method_st { |
| 89 | { | ||
| 90 | const char *name; | 88 | const char *name; |
| 91 | CONF *(*create)(CONF_METHOD *meth); | 89 | CONF *(*create)(CONF_METHOD *meth); |
| 92 | int (*init)(CONF *conf); | 90 | int (*init)(CONF *conf); |
| @@ -97,7 +95,7 @@ struct conf_method_st | |||
| 97 | int (*is_number)(const CONF *conf, char c); | 95 | int (*is_number)(const CONF *conf, char c); |
| 98 | int (*to_int)(const CONF *conf, char c); | 96 | int (*to_int)(const CONF *conf, char c); |
| 99 | int (*load)(CONF *conf, const char *name, long *eline); | 97 | int (*load)(CONF *conf, const char *name, long *eline); |
| 100 | }; | 98 | }; |
| 101 | 99 | ||
| 102 | /* Module definitions */ | 100 | /* Module definitions */ |
| 103 | 101 | ||
| @@ -119,20 +117,20 @@ typedef void conf_finish_func(CONF_IMODULE *md); | |||
| 119 | #define CONF_MFLAGS_DEFAULT_SECTION 0x20 | 117 | #define CONF_MFLAGS_DEFAULT_SECTION 0x20 |
| 120 | 118 | ||
| 121 | int CONF_set_default_method(CONF_METHOD *meth); | 119 | int CONF_set_default_method(CONF_METHOD *meth); |
| 122 | void CONF_set_nconf(CONF *conf,LHASH_OF(CONF_VALUE) *hash); | 120 | void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); |
| 123 | LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf,const char *file, | 121 | LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, |
| 124 | long *eline); | 122 | long *eline); |
| 125 | #ifndef OPENSSL_NO_FP_API | 123 | #ifndef OPENSSL_NO_FP_API |
| 126 | LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, | 124 | LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, |
| 127 | long *eline); | 125 | long *eline); |
| 128 | #endif | 126 | #endif |
| 129 | LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,long *eline); | 127 | LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, long *eline); |
| 130 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, | 128 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, |
| 131 | const char *section); | 129 | const char *section); |
| 132 | char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group, | 130 | char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, |
| 133 | const char *name); | 131 | const char *name); |
| 134 | long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group, | 132 | long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, |
| 135 | const char *name); | 133 | const char *name); |
| 136 | void CONF_free(LHASH_OF(CONF_VALUE) *conf); | 134 | void CONF_free(LHASH_OF(CONF_VALUE) *conf); |
| 137 | int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); | 135 | int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); |
| 138 | int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); | 136 | int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); |
| @@ -143,12 +141,11 @@ void OPENSSL_no_config(void); | |||
| 143 | /* New conf code. The semantics are different from the functions above. | 141 | /* New conf code. The semantics are different from the functions above. |
| 144 | If that wasn't the case, the above functions would have been replaced */ | 142 | If that wasn't the case, the above functions would have been replaced */ |
| 145 | 143 | ||
| 146 | struct conf_st | 144 | struct conf_st { |
| 147 | { | ||
| 148 | CONF_METHOD *meth; | 145 | CONF_METHOD *meth; |
| 149 | void *meth_data; | 146 | void *meth_data; |
| 150 | LHASH_OF(CONF_VALUE) *data; | 147 | LHASH_OF(CONF_VALUE) *data; |
| 151 | }; | 148 | }; |
| 152 | 149 | ||
| 153 | CONF *NCONF_new(CONF_METHOD *meth); | 150 | CONF *NCONF_new(CONF_METHOD *meth); |
| 154 | CONF_METHOD *NCONF_default(void); | 151 | CONF_METHOD *NCONF_default(void); |
| @@ -159,36 +156,36 @@ CONF_METHOD *NCONF_XML(void); | |||
| 159 | void NCONF_free(CONF *conf); | 156 | void NCONF_free(CONF *conf); |
| 160 | void NCONF_free_data(CONF *conf); | 157 | void NCONF_free_data(CONF *conf); |
| 161 | 158 | ||
| 162 | int NCONF_load(CONF *conf,const char *file,long *eline); | 159 | int NCONF_load(CONF *conf, const char *file, long *eline); |
| 163 | #ifndef OPENSSL_NO_FP_API | 160 | #ifndef OPENSSL_NO_FP_API |
| 164 | int NCONF_load_fp(CONF *conf, FILE *fp,long *eline); | 161 | int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); |
| 165 | #endif | 162 | #endif |
| 166 | int NCONF_load_bio(CONF *conf, BIO *bp,long *eline); | 163 | int NCONF_load_bio(CONF *conf, BIO *bp, long *eline); |
| 167 | STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section); | 164 | STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, const char *section); |
| 168 | char *NCONF_get_string(const CONF *conf,const char *group,const char *name); | 165 | char *NCONF_get_string(const CONF *conf, const char *group, const char *name); |
| 169 | int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, | 166 | int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, |
| 170 | long *result); | 167 | long *result); |
| 171 | int NCONF_dump_fp(const CONF *conf, FILE *out); | 168 | int NCONF_dump_fp(const CONF *conf, FILE *out); |
| 172 | int NCONF_dump_bio(const CONF *conf, BIO *out); | 169 | int NCONF_dump_bio(const CONF *conf, BIO *out); |
| 173 | 170 | ||
| 174 | #if 0 /* The following function has no error checking, | 171 | #if 0 /* The following function has no error checking, |
| 175 | and should therefore be avoided */ | 172 | and should therefore be avoided */ |
| 176 | long NCONF_get_number(CONF *conf,char *group,char *name); | 173 | long NCONF_get_number(CONF *conf, char *group, char *name); |
| 177 | #else | 174 | #else |
| 178 | #define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) | 175 | #define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r) |
| 179 | #endif | 176 | #endif |
| 180 | 177 | ||
| 181 | /* Module functions */ | 178 | /* Module functions */ |
| 182 | 179 | ||
| 183 | int CONF_modules_load(const CONF *cnf, const char *appname, | 180 | int CONF_modules_load(const CONF *cnf, const char *appname, |
| 184 | unsigned long flags); | 181 | unsigned long flags); |
| 185 | int CONF_modules_load_file(const char *filename, const char *appname, | 182 | int CONF_modules_load_file(const char *filename, const char *appname, |
| 186 | unsigned long flags); | 183 | unsigned long flags); |
| 187 | void CONF_modules_unload(int all); | 184 | void CONF_modules_unload(int all); |
| 188 | void CONF_modules_finish(void); | 185 | void CONF_modules_finish(void); |
| 189 | void CONF_modules_free(void); | 186 | void CONF_modules_free(void); |
| 190 | int CONF_module_add(const char *name, conf_init_func *ifunc, | 187 | int CONF_module_add(const char *name, conf_init_func *ifunc, |
| 191 | conf_finish_func *ffunc); | 188 | conf_finish_func *ffunc); |
| 192 | 189 | ||
| 193 | const char *CONF_imodule_get_name(const CONF_IMODULE *md); | 190 | const char *CONF_imodule_get_name(const CONF_IMODULE *md); |
| 194 | const char *CONF_imodule_get_value(const CONF_IMODULE *md); | 191 | const char *CONF_imodule_get_value(const CONF_IMODULE *md); |
| @@ -203,7 +200,7 @@ void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data); | |||
| 203 | char *CONF_get1_default_config_file(void); | 200 | char *CONF_get1_default_config_file(void); |
| 204 | 201 | ||
| 205 | int CONF_parse_list(const char *list, int sep, int nospc, | 202 | int CONF_parse_list(const char *list, int sep, int nospc, |
| 206 | int (*list_cb)(const char *elem, int len, void *usr), void *arg); | 203 | int (*list_cb)(const char *elem, int len, void *usr), void *arg); |
| 207 | 204 | ||
| 208 | void OPENSSL_load_builtin_modules(void); | 205 | void OPENSSL_load_builtin_modules(void); |
| 209 | 206 | ||
diff --git a/src/lib/libssl/src/crypto/conf/conf_api.c b/src/lib/libssl/src/crypto/conf/conf_api.c index f484000d0c..98e058dad4 100644 --- a/src/lib/libssl/src/crypto/conf/conf_api.c +++ b/src/lib/libssl/src/crypto/conf/conf_api.c | |||
| @@ -5,21 +5,21 @@ | |||
| 5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
| 6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
| 7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
| 8 | * | 8 | * |
| 9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
| 10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | 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 | 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 | 13 | * included with this distribution is covered by the same copyright terms |
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 15 | * | 15 | * |
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
| 18 | * If this package is used in a product, Eric Young should be given attribution | 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. | 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 | 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. | 21 | * in documentation (online or textual) provided with the package. |
| 22 | * | 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: | 25 | * are met: |
| @@ -34,10 +34,10 @@ | |||
| 34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
| 36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 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: | 38 | * the apps directory (application code) you must include an acknowledgement: |
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 40 | * | 40 | * |
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -49,7 +49,7 @@ | |||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 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 | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
| 52 | * | 52 | * |
| 53 | * The licence and distribution terms for any publically available version or | 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 | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| @@ -70,231 +70,241 @@ | |||
| 70 | #include <openssl/conf_api.h> | 70 | #include <openssl/conf_api.h> |
| 71 | 71 | ||
| 72 | static void value_free_hash_doall_arg(CONF_VALUE *a, | 72 | static void value_free_hash_doall_arg(CONF_VALUE *a, |
| 73 | LHASH_OF(CONF_VALUE) *conf); | 73 | LHASH_OF(CONF_VALUE) *conf); |
| 74 | static void value_free_stack_doall(CONF_VALUE *a); | 74 | static void value_free_stack_doall(CONF_VALUE *a); |
| 75 | static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE, | 75 | static IMPLEMENT_LHASH_DOALL_ARG_FN(value_free_hash, CONF_VALUE, |
| 76 | LHASH_OF(CONF_VALUE)) | 76 | LHASH_OF(CONF_VALUE)) |
| 77 | static IMPLEMENT_LHASH_DOALL_FN(value_free_stack, CONF_VALUE) | 77 | static IMPLEMENT_LHASH_DOALL_FN(value_free_stack, CONF_VALUE) |
| 78 | 78 | ||
| 79 | /* Up until OpenSSL 0.9.5a, this was get_section */ | 79 | /* Up until OpenSSL 0.9.5a, this was get_section */ |
| 80 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section) | 80 | CONF_VALUE * |
| 81 | { | 81 | _CONF_get_section(const CONF *conf, const char *section) |
| 82 | CONF_VALUE *v,vv; | 82 | { |
| 83 | 83 | CONF_VALUE *v, vv; | |
| 84 | if ((conf == NULL) || (section == NULL)) return(NULL); | 84 | |
| 85 | vv.name=NULL; | 85 | if ((conf == NULL) || (section == NULL)) |
| 86 | vv.section=(char *)section; | 86 | return (NULL); |
| 87 | v=lh_CONF_VALUE_retrieve(conf->data,&vv); | 87 | vv.name = NULL; |
| 88 | return(v); | 88 | vv.section = (char *)section; |
| 89 | } | 89 | v = lh_CONF_VALUE_retrieve(conf->data, &vv); |
| 90 | return (v); | ||
| 91 | } | ||
| 90 | 92 | ||
| 91 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ | 93 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ |
| 92 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, | 94 | STACK_OF(CONF_VALUE) * |
| 93 | const char *section) | 95 | _CONF_get_section_values(const CONF *conf, const char *section) |
| 94 | { | 96 | { |
| 95 | CONF_VALUE *v; | 97 | CONF_VALUE *v; |
| 96 | 98 | ||
| 97 | v=_CONF_get_section(conf,section); | 99 | v = _CONF_get_section(conf, section); |
| 98 | if (v != NULL) | 100 | if (v != NULL) |
| 99 | return((STACK_OF(CONF_VALUE) *)v->value); | 101 | return ((STACK_OF(CONF_VALUE) *)v->value); |
| 100 | else | 102 | else |
| 101 | return(NULL); | 103 | return (NULL); |
| 102 | } | 104 | } |
| 103 | 105 | ||
| 104 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) | 106 | int |
| 105 | { | 107 | _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value) |
| 108 | { | ||
| 106 | CONF_VALUE *v = NULL; | 109 | CONF_VALUE *v = NULL; |
| 107 | STACK_OF(CONF_VALUE) *ts; | 110 | STACK_OF(CONF_VALUE) *ts; |
| 108 | 111 | ||
| 109 | ts = (STACK_OF(CONF_VALUE) *)section->value; | 112 | ts = (STACK_OF(CONF_VALUE) *)section->value; |
| 110 | 113 | ||
| 111 | value->section=section->section; | 114 | value->section = section->section; |
| 112 | if (!sk_CONF_VALUE_push(ts,value)) | 115 | if (!sk_CONF_VALUE_push(ts, value)) { |
| 113 | { | ||
| 114 | return 0; | 116 | return 0; |
| 115 | } | 117 | } |
| 116 | 118 | ||
| 117 | v = lh_CONF_VALUE_insert(conf->data, value); | 119 | v = lh_CONF_VALUE_insert(conf->data, value); |
| 118 | if (v != NULL) | 120 | if (v != NULL) { |
| 119 | { | 121 | (void)sk_CONF_VALUE_delete_ptr(ts, v); |
| 120 | (void)sk_CONF_VALUE_delete_ptr(ts,v); | ||
| 121 | free(v->name); | 122 | free(v->name); |
| 122 | free(v->value); | 123 | free(v->value); |
| 123 | free(v); | 124 | free(v); |
| 124 | } | ||
| 125 | return 1; | ||
| 126 | } | 125 | } |
| 126 | return 1; | ||
| 127 | } | ||
| 127 | 128 | ||
| 128 | char *_CONF_get_string(const CONF *conf, const char *section, const char *name) | 129 | char * |
| 129 | { | 130 | _CONF_get_string(const CONF *conf, const char *section, const char *name) |
| 130 | CONF_VALUE *v,vv; | 131 | { |
| 132 | CONF_VALUE *v, vv; | ||
| 131 | char *p; | 133 | char *p; |
| 132 | 134 | ||
| 133 | if (name == NULL) return(NULL); | 135 | if (name == NULL) |
| 134 | if (conf != NULL) | 136 | return (NULL); |
| 135 | { | 137 | if (conf != NULL) { |
| 136 | if (section != NULL) | 138 | if (section != NULL) { |
| 137 | { | 139 | vv.name = (char *)name; |
| 138 | vv.name=(char *)name; | 140 | vv.section = (char *)section; |
| 139 | vv.section=(char *)section; | 141 | v = lh_CONF_VALUE_retrieve(conf->data, &vv); |
| 140 | v=lh_CONF_VALUE_retrieve(conf->data,&vv); | 142 | if (v != NULL) |
| 141 | if (v != NULL) return(v->value); | 143 | return (v->value); |
| 142 | if (strcmp(section,"ENV") == 0) | 144 | if (strcmp(section, "ENV") == 0) { |
| 143 | { | 145 | p = getenv(name); |
| 144 | p=getenv(name); | 146 | if (p != NULL) |
| 145 | if (p != NULL) return(p); | 147 | return (p); |
| 146 | } | ||
| 147 | } | 148 | } |
| 148 | vv.section="default"; | 149 | } |
| 149 | vv.name=(char *)name; | 150 | vv.section = "default"; |
| 150 | v=lh_CONF_VALUE_retrieve(conf->data,&vv); | 151 | vv.name = (char *)name; |
| 152 | v = lh_CONF_VALUE_retrieve(conf->data, &vv); | ||
| 151 | if (v != NULL) | 153 | if (v != NULL) |
| 152 | return(v->value); | 154 | return (v->value); |
| 153 | else | 155 | else |
| 154 | return(NULL); | 156 | return (NULL); |
| 155 | } | 157 | } else |
| 156 | else | 158 | return (getenv(name)); |
| 157 | return(getenv(name)); | 159 | } |
| 158 | } | ||
| 159 | 160 | ||
| 160 | #if 0 /* There's no way to provide error checking with this function, so | 161 | #if 0 /* There's no way to provide error checking with this function, so |
| 161 | force implementors of the higher levels to get a string and read | 162 | force implementors of the higher levels to get a string and read |
| 162 | the number themselves. */ | 163 | the number themselves. */ |
| 163 | long _CONF_get_number(CONF *conf, char *section, char *name) | 164 | long |
| 164 | { | 165 | _CONF_get_number(CONF *conf, char *section, char *name) |
| 166 | { | ||
| 165 | char *str; | 167 | char *str; |
| 166 | long ret=0; | 168 | long ret = 0; |
| 167 | 169 | ||
| 168 | str=_CONF_get_string(conf,section,name); | 170 | str = _CONF_get_string(conf, section, name); |
| 169 | if (str == NULL) return(0); | 171 | if (str == NULL) |
| 170 | for (;;) | 172 | return (0); |
| 171 | { | 173 | for (;;) { |
| 172 | if (conf->meth->is_number(conf, *str)) | 174 | if (conf->meth->is_number(conf, *str)) |
| 173 | ret=ret*10+conf->meth->to_int(conf, *str); | 175 | ret = ret * 10 + conf->meth->to_int(conf, *str); |
| 174 | else | 176 | else |
| 175 | return(ret); | 177 | return (ret); |
| 176 | str++; | 178 | str++; |
| 177 | } | ||
| 178 | } | 179 | } |
| 180 | } | ||
| 179 | #endif | 181 | #endif |
| 180 | 182 | ||
| 181 | static unsigned long conf_value_hash(const CONF_VALUE *v) | 183 | static unsigned long |
| 182 | { | 184 | conf_value_hash(const CONF_VALUE *v) |
| 183 | return (lh_strhash(v->section)<<2)^lh_strhash(v->name); | 185 | { |
| 184 | } | 186 | return (lh_strhash(v->section) << 2) ^ lh_strhash(v->name); |
| 187 | } | ||
| 188 | |||
| 185 | static IMPLEMENT_LHASH_HASH_FN(conf_value, CONF_VALUE) | 189 | static IMPLEMENT_LHASH_HASH_FN(conf_value, CONF_VALUE) |
| 186 | 190 | ||
| 187 | static int conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b) | 191 | static int |
| 188 | { | 192 | conf_value_cmp(const CONF_VALUE *a, const CONF_VALUE *b) |
| 193 | { | ||
| 189 | int i; | 194 | int i; |
| 190 | 195 | ||
| 191 | if (a->section != b->section) | 196 | if (a->section != b->section) { |
| 192 | { | 197 | i = strcmp(a->section, b->section); |
| 193 | i=strcmp(a->section,b->section); | 198 | if (i) |
| 194 | if (i) return(i); | 199 | return (i); |
| 195 | } | ||
| 196 | |||
| 197 | if ((a->name != NULL) && (b->name != NULL)) | ||
| 198 | { | ||
| 199 | i=strcmp(a->name,b->name); | ||
| 200 | return(i); | ||
| 201 | } | ||
| 202 | else if (a->name == b->name) | ||
| 203 | return(0); | ||
| 204 | else | ||
| 205 | return((a->name == NULL)?-1:1); | ||
| 206 | } | 200 | } |
| 201 | if ((a->name != NULL) && (b->name != NULL)) { | ||
| 202 | i = strcmp(a->name, b->name); | ||
| 203 | return (i); | ||
| 204 | } else if (a->name == b->name) | ||
| 205 | return (0); | ||
| 206 | else | ||
| 207 | return ((a->name == NULL)?-1 : 1); | ||
| 208 | } | ||
| 209 | |||
| 207 | static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE) | 210 | static IMPLEMENT_LHASH_COMP_FN(conf_value, CONF_VALUE) |
| 208 | 211 | ||
| 209 | int _CONF_new_data(CONF *conf) | 212 | int |
| 210 | { | 213 | _CONF_new_data(CONF *conf) |
| 211 | if (conf == NULL) | 214 | { |
| 212 | { | 215 | if (conf == NULL) { |
| 213 | return 0; | 216 | return 0; |
| 214 | } | 217 | } |
| 215 | if (conf->data == NULL) | 218 | if (conf->data == NULL) |
| 216 | if ((conf->data = lh_CONF_VALUE_new()) == NULL) | 219 | if ((conf->data = lh_CONF_VALUE_new()) == NULL) { |
| 217 | { | ||
| 218 | return 0; | 220 | return 0; |
| 219 | } | 221 | } |
| 220 | return 1; | 222 | return 1; |
| 221 | } | 223 | } |
| 222 | 224 | ||
| 223 | void _CONF_free_data(CONF *conf) | 225 | void |
| 224 | { | 226 | _CONF_free_data(CONF *conf) |
| 225 | if (conf == NULL || conf->data == NULL) return; | 227 | { |
| 228 | if (conf == NULL || conf->data == NULL) | ||
| 229 | return; | ||
| 226 | 230 | ||
| 227 | lh_CONF_VALUE_down_load(conf->data)=0; /* evil thing to make | 231 | lh_CONF_VALUE_down_load(conf->data) = 0; /* evil thing to make |
| 228 | * sure the 'free()' works as | 232 | * sure the 'free()' works as |
| 229 | * expected */ | 233 | * expected */ |
| 230 | lh_CONF_VALUE_doall_arg(conf->data, | 234 | lh_CONF_VALUE_doall_arg(conf->data, |
| 231 | LHASH_DOALL_ARG_FN(value_free_hash), | 235 | LHASH_DOALL_ARG_FN(value_free_hash), |
| 232 | LHASH_OF(CONF_VALUE), conf->data); | 236 | LHASH_OF(CONF_VALUE), conf->data); |
| 233 | 237 | ||
| 234 | /* We now have only 'section' entries in the hash table. | 238 | /* We now have only 'section' entries in the hash table. |
| 235 | * Due to problems with */ | 239 | * Due to problems with */ |
| 236 | 240 | ||
| 237 | lh_CONF_VALUE_doall(conf->data, LHASH_DOALL_FN(value_free_stack)); | 241 | lh_CONF_VALUE_doall(conf->data, LHASH_DOALL_FN(value_free_stack)); |
| 238 | lh_CONF_VALUE_free(conf->data); | 242 | lh_CONF_VALUE_free(conf->data); |
| 239 | } | 243 | } |
| 240 | 244 | ||
| 241 | static void value_free_hash_doall_arg(CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf) | 245 | static void |
| 242 | { | 246 | value_free_hash_doall_arg(CONF_VALUE *a, LHASH_OF(CONF_VALUE) *conf) |
| 247 | { | ||
| 243 | if (a->name != NULL) | 248 | if (a->name != NULL) |
| 244 | (void)lh_CONF_VALUE_delete(conf,a); | 249 | (void)lh_CONF_VALUE_delete(conf, a); |
| 245 | } | 250 | } |
| 246 | 251 | ||
| 247 | static void value_free_stack_doall(CONF_VALUE *a) | 252 | static void |
| 248 | { | 253 | value_free_stack_doall(CONF_VALUE *a) |
| 254 | { | ||
| 249 | CONF_VALUE *vv; | 255 | CONF_VALUE *vv; |
| 250 | STACK_OF(CONF_VALUE) *sk; | 256 | STACK_OF(CONF_VALUE) *sk; |
| 251 | int i; | 257 | int i; |
| 252 | 258 | ||
| 253 | if (a->name != NULL) return; | 259 | if (a->name != NULL) |
| 260 | return; | ||
| 254 | 261 | ||
| 255 | sk=(STACK_OF(CONF_VALUE) *)a->value; | 262 | sk = (STACK_OF(CONF_VALUE) *)a->value; |
| 256 | for (i=sk_CONF_VALUE_num(sk)-1; i>=0; i--) | 263 | for (i = sk_CONF_VALUE_num(sk) - 1; i >= 0; i--) { |
| 257 | { | 264 | vv = sk_CONF_VALUE_value(sk, i); |
| 258 | vv=sk_CONF_VALUE_value(sk,i); | ||
| 259 | free(vv->value); | 265 | free(vv->value); |
| 260 | free(vv->name); | 266 | free(vv->name); |
| 261 | free(vv); | 267 | free(vv); |
| 262 | } | 268 | } |
| 263 | if (sk != NULL) sk_CONF_VALUE_free(sk); | 269 | if (sk != NULL) |
| 270 | sk_CONF_VALUE_free(sk); | ||
| 264 | free(a->section); | 271 | free(a->section); |
| 265 | free(a); | 272 | free(a); |
| 266 | } | 273 | } |
| 267 | 274 | ||
| 268 | /* Up until OpenSSL 0.9.5a, this was new_section */ | 275 | /* Up until OpenSSL 0.9.5a, this was new_section */ |
| 269 | CONF_VALUE *_CONF_new_section(CONF *conf, const char *section) | 276 | CONF_VALUE * |
| 270 | { | 277 | _CONF_new_section(CONF *conf, const char *section) |
| 271 | STACK_OF(CONF_VALUE) *sk=NULL; | 278 | { |
| 272 | int ok=0,i; | 279 | STACK_OF(CONF_VALUE) *sk = NULL; |
| 273 | CONF_VALUE *v=NULL,*vv; | 280 | int ok = 0, i; |
| 274 | 281 | CONF_VALUE *v = NULL, *vv; | |
| 275 | if ((sk=sk_CONF_VALUE_new_null()) == NULL) | 282 | |
| 283 | if ((sk = sk_CONF_VALUE_new_null()) == NULL) | ||
| 276 | goto err; | 284 | goto err; |
| 277 | if ((v=malloc(sizeof(CONF_VALUE))) == NULL) | 285 | if ((v = malloc(sizeof(CONF_VALUE))) == NULL) |
| 278 | goto err; | 286 | goto err; |
| 279 | i=strlen(section)+1; | 287 | i = strlen(section) + 1; |
| 280 | if ((v->section=malloc(i)) == NULL) | 288 | if ((v->section = malloc(i)) == NULL) |
| 281 | goto err; | 289 | goto err; |
| 282 | 290 | ||
| 283 | memcpy(v->section,section,i); | 291 | memcpy(v->section, section, i); |
| 284 | v->name=NULL; | 292 | v->name = NULL; |
| 285 | v->value=(char *)sk; | 293 | v->value = (char *)sk; |
| 286 | 294 | ||
| 287 | vv=lh_CONF_VALUE_insert(conf->data,v); | 295 | vv = lh_CONF_VALUE_insert(conf->data, v); |
| 288 | OPENSSL_assert(vv == NULL); | 296 | OPENSSL_assert(vv == NULL); |
| 289 | ok=1; | 297 | ok = 1; |
| 298 | |||
| 290 | err: | 299 | err: |
| 291 | if (!ok) | 300 | if (!ok) { |
| 292 | { | 301 | if (sk != NULL) |
| 293 | if (sk != NULL) sk_CONF_VALUE_free(sk); | 302 | sk_CONF_VALUE_free(sk); |
| 294 | if (v != NULL) free(v); | 303 | if (v != NULL) |
| 295 | v=NULL; | 304 | free(v); |
| 296 | } | 305 | v = NULL; |
| 297 | return(v); | ||
| 298 | } | 306 | } |
| 307 | return (v); | ||
| 308 | } | ||
| 299 | 309 | ||
| 300 | IMPLEMENT_STACK_OF(CONF_VALUE) | 310 | IMPLEMENT_STACK_OF(CONF_VALUE) |
diff --git a/src/lib/libssl/src/crypto/conf/conf_api.h b/src/lib/libssl/src/crypto/conf/conf_api.h index 87a954aff6..0ad0f70a12 100644 --- a/src/lib/libssl/src/crypto/conf/conf_api.h +++ b/src/lib/libssl/src/crypto/conf/conf_api.h | |||
| @@ -5,21 +5,21 @@ | |||
| 5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
| 6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
| 7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
| 8 | * | 8 | * |
| 9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
| 10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | 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 | 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 | 13 | * included with this distribution is covered by the same copyright terms |
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 15 | * | 15 | * |
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
| 18 | * If this package is used in a product, Eric Young should be given attribution | 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. | 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 | 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. | 21 | * in documentation (online or textual) provided with the package. |
| 22 | * | 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: | 25 | * are met: |
| @@ -34,10 +34,10 @@ | |||
| 34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
| 36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 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: | 38 | * the apps directory (application code) you must include an acknowledgement: |
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 40 | * | 40 | * |
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -49,7 +49,7 @@ | |||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 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 | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
| 52 | * | 52 | * |
| 53 | * The licence and distribution terms for any publically available version or | 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 | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| @@ -72,11 +72,11 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section); | |||
| 72 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); | 72 | CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section); |
| 73 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ | 73 | /* Up until OpenSSL 0.9.5a, this was CONF_get_section */ |
| 74 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, | 74 | STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf, |
| 75 | const char *section); | 75 | const char *section); |
| 76 | 76 | ||
| 77 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); | 77 | int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value); |
| 78 | char *_CONF_get_string(const CONF *conf, const char *section, | 78 | char *_CONF_get_string(const CONF *conf, const char *section, |
| 79 | const char *name); | 79 | const char *name); |
| 80 | long _CONF_get_number(const CONF *conf, const char *section, const char *name); | 80 | long _CONF_get_number(const CONF *conf, const char *section, const char *name); |
| 81 | 81 | ||
| 82 | int _CONF_new_data(CONF *conf); | 82 | int _CONF_new_data(CONF *conf); |
| @@ -86,4 +86,3 @@ void _CONF_free_data(CONF *conf); | |||
| 86 | } | 86 | } |
| 87 | #endif | 87 | #endif |
| 88 | #endif | 88 | #endif |
| 89 | |||
diff --git a/src/lib/libssl/src/crypto/conf/conf_def.c b/src/lib/libssl/src/crypto/conf/conf_def.c index 5ab995a5c0..22fe7a8f60 100644 --- a/src/lib/libssl/src/crypto/conf/conf_def.c +++ b/src/lib/libssl/src/crypto/conf/conf_def.c | |||
| @@ -5,21 +5,21 @@ | |||
| 5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
| 6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
| 7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
| 8 | * | 8 | * |
| 9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
| 10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | 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 | 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 | 13 | * included with this distribution is covered by the same copyright terms |
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 15 | * | 15 | * |
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
| 18 | * If this package is used in a product, Eric Young should be given attribution | 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. | 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 | 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. | 21 | * in documentation (online or textual) provided with the package. |
| 22 | * | 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: | 25 | * are met: |
| @@ -34,10 +34,10 @@ | |||
| 34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
| 36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 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: | 38 | * the apps directory (application code) you must include an acknowledgement: |
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 40 | * | 40 | * |
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -49,7 +49,7 @@ | |||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 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 | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
| 52 | * | 52 | * |
| 53 | * The licence and distribution terms for any publically available version or | 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 | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| @@ -72,7 +72,7 @@ | |||
| 72 | static char *eat_ws(CONF *conf, char *p); | 72 | static char *eat_ws(CONF *conf, char *p); |
| 73 | static char *eat_alpha_numeric(CONF *conf, char *p); | 73 | static char *eat_alpha_numeric(CONF *conf, char *p); |
| 74 | static void clear_comments(CONF *conf, char *p); | 74 | static void clear_comments(CONF *conf, char *p); |
| 75 | static int str_copy(CONF *conf,char *section,char **to, char *from); | 75 | static int str_copy(CONF *conf, char *section, char **to, char *from); |
| 76 | static char *scan_quote(CONF *conf, char *p); | 76 | static char *scan_quote(CONF *conf, char *p); |
| 77 | static char *scan_dquote(CONF *conf, char *p); | 77 | static char *scan_dquote(CONF *conf, char *p); |
| 78 | #define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2))) | 78 | #define scan_esc(conf,p) (((IS_EOF((conf),(p)[1]))?((p)+1):((p)+2))) |
| @@ -101,7 +101,7 @@ static CONF_METHOD default_method = { | |||
| 101 | def_is_number, | 101 | def_is_number, |
| 102 | def_to_int, | 102 | def_to_int, |
| 103 | def_load | 103 | def_load |
| 104 | }; | 104 | }; |
| 105 | 105 | ||
| 106 | static CONF_METHOD WIN32_method = { | 106 | static CONF_METHOD WIN32_method = { |
| 107 | "WIN32", | 107 | "WIN32", |
| @@ -114,33 +114,37 @@ static CONF_METHOD WIN32_method = { | |||
| 114 | def_is_number, | 114 | def_is_number, |
| 115 | def_to_int, | 115 | def_to_int, |
| 116 | def_load | 116 | def_load |
| 117 | }; | 117 | }; |
| 118 | 118 | ||
| 119 | CONF_METHOD *NCONF_default() | 119 | CONF_METHOD * |
| 120 | { | 120 | NCONF_default() |
| 121 | { | ||
| 121 | return &default_method; | 122 | return &default_method; |
| 122 | } | 123 | } |
| 123 | CONF_METHOD *NCONF_WIN32() | 124 | |
| 124 | { | 125 | CONF_METHOD * |
| 126 | NCONF_WIN32() | ||
| 127 | { | ||
| 125 | return &WIN32_method; | 128 | return &WIN32_method; |
| 126 | } | 129 | } |
| 127 | 130 | ||
| 128 | static CONF *def_create(CONF_METHOD *meth) | 131 | static CONF * |
| 129 | { | 132 | def_create(CONF_METHOD *meth) |
| 133 | { | ||
| 130 | CONF *ret; | 134 | CONF *ret; |
| 131 | 135 | ||
| 132 | ret = malloc(sizeof(CONF) + sizeof(unsigned short *)); | 136 | ret = malloc(sizeof(CONF) + sizeof(unsigned short *)); |
| 133 | if (ret) | 137 | if (ret) |
| 134 | if (meth->init(ret) == 0) | 138 | if (meth->init(ret) == 0) { |
| 135 | { | ||
| 136 | free(ret); | 139 | free(ret); |
| 137 | ret = NULL; | 140 | ret = NULL; |
| 138 | } | 141 | } |
| 139 | return ret; | 142 | return ret; |
| 140 | } | 143 | } |
| 141 | 144 | ||
| 142 | static int def_init_default(CONF *conf) | 145 | static int |
| 143 | { | 146 | def_init_default(CONF *conf) |
| 147 | { | ||
| 144 | if (conf == NULL) | 148 | if (conf == NULL) |
| 145 | return 0; | 149 | return 0; |
| 146 | 150 | ||
| @@ -149,10 +153,11 @@ static int def_init_default(CONF *conf) | |||
| 149 | conf->data = NULL; | 153 | conf->data = NULL; |
| 150 | 154 | ||
| 151 | return 1; | 155 | return 1; |
| 152 | } | 156 | } |
| 153 | 157 | ||
| 154 | static int def_init_WIN32(CONF *conf) | 158 | static int |
| 155 | { | 159 | def_init_WIN32(CONF *conf) |
| 160 | { | ||
| 156 | if (conf == NULL) | 161 | if (conf == NULL) |
| 157 | return 0; | 162 | return 0; |
| 158 | 163 | ||
| @@ -161,576 +166,559 @@ static int def_init_WIN32(CONF *conf) | |||
| 161 | conf->data = NULL; | 166 | conf->data = NULL; |
| 162 | 167 | ||
| 163 | return 1; | 168 | return 1; |
| 164 | } | 169 | } |
| 165 | 170 | ||
| 166 | static int def_destroy(CONF *conf) | 171 | static int |
| 167 | { | 172 | def_destroy(CONF *conf) |
| 168 | if (def_destroy_data(conf)) | 173 | { |
| 169 | { | 174 | if (def_destroy_data(conf)) { |
| 170 | free(conf); | 175 | free(conf); |
| 171 | return 1; | 176 | return 1; |
| 172 | } | ||
| 173 | return 0; | ||
| 174 | } | 177 | } |
| 178 | return 0; | ||
| 179 | } | ||
| 175 | 180 | ||
| 176 | static int def_destroy_data(CONF *conf) | 181 | static int |
| 177 | { | 182 | def_destroy_data(CONF *conf) |
| 183 | { | ||
| 178 | if (conf == NULL) | 184 | if (conf == NULL) |
| 179 | return 0; | 185 | return 0; |
| 180 | _CONF_free_data(conf); | 186 | _CONF_free_data(conf); |
| 181 | return 1; | 187 | return 1; |
| 182 | } | 188 | } |
| 183 | 189 | ||
| 184 | static int def_load(CONF *conf, const char *name, long *line) | 190 | static int |
| 185 | { | 191 | def_load(CONF *conf, const char *name, long *line) |
| 192 | { | ||
| 186 | int ret; | 193 | int ret; |
| 187 | BIO *in=NULL; | 194 | BIO *in = NULL; |
| 188 | 195 | ||
| 189 | in=BIO_new_file(name, "rb"); | 196 | in = BIO_new_file(name, "rb"); |
| 190 | if (in == NULL) | 197 | if (in == NULL) { |
| 191 | { | ||
| 192 | if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE) | 198 | if (ERR_GET_REASON(ERR_peek_last_error()) == BIO_R_NO_SUCH_FILE) |
| 193 | CONFerr(CONF_F_DEF_LOAD,CONF_R_NO_SUCH_FILE); | 199 | CONFerr(CONF_F_DEF_LOAD, CONF_R_NO_SUCH_FILE); |
| 194 | else | 200 | else |
| 195 | CONFerr(CONF_F_DEF_LOAD,ERR_R_SYS_LIB); | 201 | CONFerr(CONF_F_DEF_LOAD, ERR_R_SYS_LIB); |
| 196 | return 0; | 202 | return 0; |
| 197 | } | 203 | } |
| 198 | 204 | ||
| 199 | ret = def_load_bio(conf, in, line); | 205 | ret = def_load_bio(conf, in, line); |
| 200 | BIO_free(in); | 206 | BIO_free(in); |
| 201 | 207 | ||
| 202 | return ret; | 208 | return ret; |
| 203 | } | 209 | } |
| 204 | 210 | ||
| 205 | static int def_load_bio(CONF *conf, BIO *in, long *line) | 211 | static int |
| 206 | { | 212 | def_load_bio(CONF *conf, BIO *in, long *line) |
| 213 | { | ||
| 207 | /* The macro BUFSIZE conflicts with a system macro in VxWorks */ | 214 | /* The macro BUFSIZE conflicts with a system macro in VxWorks */ |
| 208 | #define CONFBUFSIZE 512 | 215 | #define CONFBUFSIZE 512 |
| 209 | int bufnum=0,i,ii; | 216 | int bufnum = 0, i, ii; |
| 210 | BUF_MEM *buff=NULL; | 217 | BUF_MEM *buff = NULL; |
| 211 | char *s,*p,*end; | 218 | char *s, *p, *end; |
| 212 | int again; | 219 | int again; |
| 213 | long eline=0; | 220 | long eline = 0; |
| 214 | char btmp[DECIMAL_SIZE(eline)+1]; | 221 | char btmp[DECIMAL_SIZE(eline) + 1]; |
| 215 | CONF_VALUE *v=NULL,*tv; | 222 | CONF_VALUE *v = NULL, *tv; |
| 216 | CONF_VALUE *sv=NULL; | 223 | CONF_VALUE *sv = NULL; |
| 217 | char *section=NULL,*buf; | 224 | char *section = NULL, *buf; |
| 218 | char *start,*psection,*pname; | 225 | char *start, *psection, *pname; |
| 219 | void *h = (void *)(conf->data); | 226 | void *h = (void *)(conf->data); |
| 220 | 227 | ||
| 221 | if ((buff=BUF_MEM_new()) == NULL) | 228 | if ((buff = BUF_MEM_new()) == NULL) { |
| 222 | { | 229 | CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB); |
| 223 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_BUF_LIB); | ||
| 224 | goto err; | 230 | goto err; |
| 225 | } | 231 | } |
| 226 | 232 | ||
| 227 | section=(char *)malloc(10); | 233 | section = (char *)malloc(10); |
| 228 | if (section == NULL) | 234 | if (section == NULL) { |
| 229 | { | 235 | CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE); |
| 230 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE); | ||
| 231 | goto err; | 236 | goto err; |
| 232 | } | 237 | } |
| 233 | strlcpy(section,"default",10); | 238 | strlcpy(section, "default",10); |
| 234 | 239 | ||
| 235 | if (_CONF_new_data(conf) == 0) | 240 | if (_CONF_new_data(conf) == 0) { |
| 236 | { | 241 | CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_MALLOC_FAILURE); |
| 237 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_MALLOC_FAILURE); | ||
| 238 | goto err; | 242 | goto err; |
| 239 | } | 243 | } |
| 240 | 244 | ||
| 241 | sv=_CONF_new_section(conf,section); | 245 | sv = _CONF_new_section(conf, section); |
| 242 | if (sv == NULL) | 246 | if (sv == NULL) { |
| 243 | { | ||
| 244 | CONFerr(CONF_F_DEF_LOAD_BIO, | 247 | CONFerr(CONF_F_DEF_LOAD_BIO, |
| 245 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | 248 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); |
| 246 | goto err; | 249 | goto err; |
| 247 | } | 250 | } |
| 248 | 251 | ||
| 249 | bufnum=0; | 252 | bufnum = 0; |
| 250 | again=0; | 253 | again = 0; |
| 251 | for (;;) | 254 | for (;;) { |
| 252 | { | 255 | if (!BUF_MEM_grow(buff, bufnum + CONFBUFSIZE)) { |
| 253 | if (!BUF_MEM_grow(buff,bufnum+CONFBUFSIZE)) | 256 | CONFerr(CONF_F_DEF_LOAD_BIO, ERR_R_BUF_LIB); |
| 254 | { | ||
| 255 | CONFerr(CONF_F_DEF_LOAD_BIO,ERR_R_BUF_LIB); | ||
| 256 | goto err; | 257 | goto err; |
| 257 | } | 258 | } |
| 258 | p= &(buff->data[bufnum]); | 259 | p = &(buff->data[bufnum]); |
| 259 | *p='\0'; | 260 | *p = '\0'; |
| 260 | BIO_gets(in, p, CONFBUFSIZE-1); | 261 | BIO_gets(in, p, CONFBUFSIZE - 1); |
| 261 | p[CONFBUFSIZE-1]='\0'; | 262 | p[CONFBUFSIZE - 1] = '\0'; |
| 262 | ii=i=strlen(p); | 263 | ii = i = strlen(p); |
| 263 | if (i == 0 && !again) break; | 264 | if (i == 0 && !again) |
| 264 | again=0; | 265 | break; |
| 265 | while (i > 0) | 266 | again = 0; |
| 266 | { | 267 | while (i > 0) { |
| 267 | if ((p[i-1] != '\r') && (p[i-1] != '\n')) | 268 | if ((p[i - 1] != '\r') && (p[i - 1] != '\n')) |
| 268 | break; | 269 | break; |
| 269 | else | 270 | else |
| 270 | i--; | 271 | i--; |
| 271 | } | 272 | } |
| 272 | /* we removed some trailing stuff so there is a new | 273 | /* we removed some trailing stuff so there is a new |
| 273 | * line on the end. */ | 274 | * line on the end. */ |
| 274 | if (ii && i == ii) | 275 | if (ii && i == ii) |
| 275 | again=1; /* long line */ | 276 | again = 1; /* long line */ |
| 276 | else | 277 | else { |
| 277 | { | 278 | p[i] = '\0'; |
| 278 | p[i]='\0'; | ||
| 279 | eline++; /* another input line */ | 279 | eline++; /* another input line */ |
| 280 | } | 280 | } |
| 281 | 281 | ||
| 282 | /* we now have a line with trailing \r\n removed */ | 282 | /* we now have a line with trailing \r\n removed */ |
| 283 | 283 | ||
| 284 | /* i is the number of bytes */ | 284 | /* i is the number of bytes */ |
| 285 | bufnum+=i; | 285 | bufnum += i; |
| 286 | 286 | ||
| 287 | v=NULL; | 287 | v = NULL; |
| 288 | /* check for line continuation */ | 288 | /* check for line continuation */ |
| 289 | if (bufnum >= 1) | 289 | if (bufnum >= 1) { |
| 290 | { | ||
| 291 | /* If we have bytes and the last char '\\' and | 290 | /* If we have bytes and the last char '\\' and |
| 292 | * second last char is not '\\' */ | 291 | * second last char is not '\\' */ |
| 293 | p= &(buff->data[bufnum-1]); | 292 | p = &(buff->data[bufnum - 1]); |
| 294 | if (IS_ESC(conf,p[0]) && | 293 | if (IS_ESC(conf, p[0]) && |
| 295 | ((bufnum <= 1) || !IS_ESC(conf,p[-1]))) | 294 | ((bufnum <= 1) || !IS_ESC(conf, p[-1]))) { |
| 296 | { | ||
| 297 | bufnum--; | 295 | bufnum--; |
| 298 | again=1; | 296 | again = 1; |
| 299 | } | ||
| 300 | } | 297 | } |
| 301 | if (again) continue; | 298 | } |
| 302 | bufnum=0; | 299 | if (again) |
| 303 | buf=buff->data; | 300 | continue; |
| 301 | bufnum = 0; | ||
| 302 | buf = buff->data; | ||
| 304 | 303 | ||
| 305 | clear_comments(conf, buf); | 304 | clear_comments(conf, buf); |
| 306 | s=eat_ws(conf, buf); | 305 | s = eat_ws(conf, buf); |
| 307 | if (IS_EOF(conf,*s)) continue; /* blank line */ | 306 | if (IS_EOF(conf, *s)) |
| 308 | if (*s == '[') | 307 | continue; /* blank line */ |
| 309 | { | 308 | if (*s == '[') { |
| 310 | char *ss; | 309 | char *ss; |
| 311 | 310 | ||
| 312 | s++; | 311 | s++; |
| 313 | start=eat_ws(conf, s); | 312 | start = eat_ws(conf, s); |
| 314 | ss=start; | 313 | ss = start; |
| 315 | again: | 314 | again: |
| 316 | end=eat_alpha_numeric(conf, ss); | 315 | end = eat_alpha_numeric(conf, ss); |
| 317 | p=eat_ws(conf, end); | 316 | p = eat_ws(conf, end); |
| 318 | if (*p != ']') | 317 | if (*p != ']') { |
| 319 | { | 318 | if (*p != '\0') { |
| 320 | if (*p != '\0') | 319 | ss = p; |
| 321 | { | ||
| 322 | ss=p; | ||
| 323 | goto again; | 320 | goto again; |
| 324 | } | 321 | } |
| 325 | CONFerr(CONF_F_DEF_LOAD_BIO, | 322 | CONFerr(CONF_F_DEF_LOAD_BIO, |
| 326 | CONF_R_MISSING_CLOSE_SQUARE_BRACKET); | 323 | CONF_R_MISSING_CLOSE_SQUARE_BRACKET); |
| 327 | goto err; | 324 | goto err; |
| 328 | } | 325 | } |
| 329 | *end='\0'; | 326 | *end = '\0'; |
| 330 | if (!str_copy(conf,NULL,§ion,start)) goto err; | 327 | if (!str_copy(conf, NULL, §ion, start)) |
| 331 | if ((sv=_CONF_get_section(conf,section)) == NULL) | 328 | goto err; |
| 332 | sv=_CONF_new_section(conf,section); | 329 | if ((sv = _CONF_get_section(conf, section)) == NULL) |
| 333 | if (sv == NULL) | 330 | sv = _CONF_new_section(conf, section); |
| 334 | { | 331 | if (sv == NULL) { |
| 335 | CONFerr(CONF_F_DEF_LOAD_BIO, | 332 | CONFerr(CONF_F_DEF_LOAD_BIO, |
| 336 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | 333 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); |
| 337 | goto err; | 334 | goto err; |
| 338 | } | 335 | } |
| 339 | continue; | 336 | continue; |
| 337 | } else { | ||
| 338 | pname = s; | ||
| 339 | psection = NULL; | ||
| 340 | end = eat_alpha_numeric(conf, s); | ||
| 341 | if ((end[0] == ':') && (end[1] == ':')) { | ||
| 342 | *end = '\0'; | ||
| 343 | end += 2; | ||
| 344 | psection = pname; | ||
| 345 | pname = end; | ||
| 346 | end = eat_alpha_numeric(conf, end); | ||
| 340 | } | 347 | } |
| 341 | else | 348 | p = eat_ws(conf, end); |
| 342 | { | 349 | if (*p != '=') { |
| 343 | pname=s; | ||
| 344 | psection=NULL; | ||
| 345 | end=eat_alpha_numeric(conf, s); | ||
| 346 | if ((end[0] == ':') && (end[1] == ':')) | ||
| 347 | { | ||
| 348 | *end='\0'; | ||
| 349 | end+=2; | ||
| 350 | psection=pname; | ||
| 351 | pname=end; | ||
| 352 | end=eat_alpha_numeric(conf, end); | ||
| 353 | } | ||
| 354 | p=eat_ws(conf, end); | ||
| 355 | if (*p != '=') | ||
| 356 | { | ||
| 357 | CONFerr(CONF_F_DEF_LOAD_BIO, | 350 | CONFerr(CONF_F_DEF_LOAD_BIO, |
| 358 | CONF_R_MISSING_EQUAL_SIGN); | 351 | CONF_R_MISSING_EQUAL_SIGN); |
| 359 | goto err; | 352 | goto err; |
| 360 | } | 353 | } |
| 361 | *end='\0'; | 354 | *end = '\0'; |
| 362 | p++; | 355 | p++; |
| 363 | start=eat_ws(conf, p); | 356 | start = eat_ws(conf, p); |
| 364 | while (!IS_EOF(conf,*p)) | 357 | while (!IS_EOF(conf, *p)) |
| 365 | p++; | 358 | p++; |
| 366 | p--; | 359 | p--; |
| 367 | while ((p != start) && (IS_WS(conf,*p))) | 360 | while ((p != start) && (IS_WS(conf, *p))) |
| 368 | p--; | 361 | p--; |
| 369 | p++; | 362 | p++; |
| 370 | *p='\0'; | 363 | *p = '\0'; |
| 371 | 364 | ||
| 372 | if (!(v=(CONF_VALUE *)malloc(sizeof(CONF_VALUE)))) | 365 | if (!(v = (CONF_VALUE *)malloc(sizeof(CONF_VALUE)))) { |
| 373 | { | ||
| 374 | CONFerr(CONF_F_DEF_LOAD_BIO, | 366 | CONFerr(CONF_F_DEF_LOAD_BIO, |
| 375 | ERR_R_MALLOC_FAILURE); | 367 | ERR_R_MALLOC_FAILURE); |
| 376 | goto err; | 368 | goto err; |
| 377 | } | 369 | } |
| 378 | if (psection == NULL) psection=section; | 370 | if (psection == NULL) |
| 379 | v->name=(char *)malloc(strlen(pname)+1); | 371 | psection = section; |
| 380 | v->value=NULL; | 372 | v->name = (char *)malloc(strlen(pname) + 1); |
| 381 | if (v->name == NULL) | 373 | v->value = NULL; |
| 382 | { | 374 | if (v->name == NULL) { |
| 383 | CONFerr(CONF_F_DEF_LOAD_BIO, | 375 | CONFerr(CONF_F_DEF_LOAD_BIO, |
| 384 | ERR_R_MALLOC_FAILURE); | 376 | ERR_R_MALLOC_FAILURE); |
| 377 | goto err; | ||
| 378 | } | ||
| 379 | strlcpy(v->name, pname, strlen(pname) + 1); | ||
| 380 | if (!str_copy(conf, psection, &(v->value), start)) | ||
| 385 | goto err; | 381 | goto err; |
| 386 | } | ||
| 387 | strlcpy(v->name,pname,strlen(pname)+1); | ||
| 388 | if (!str_copy(conf,psection,&(v->value),start)) goto err; | ||
| 389 | 382 | ||
| 390 | if (strcmp(psection,section) != 0) | 383 | if (strcmp(psection, section) != 0) { |
| 391 | { | 384 | if ((tv = _CONF_get_section(conf, psection)) |
| 392 | if ((tv=_CONF_get_section(conf,psection)) | ||
| 393 | == NULL) | 385 | == NULL) |
| 394 | tv=_CONF_new_section(conf,psection); | 386 | tv = _CONF_new_section(conf, psection); |
| 395 | if (tv == NULL) | 387 | if (tv == NULL) { |
| 396 | { | ||
| 397 | CONFerr(CONF_F_DEF_LOAD_BIO, | 388 | CONFerr(CONF_F_DEF_LOAD_BIO, |
| 398 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); | 389 | CONF_R_UNABLE_TO_CREATE_NEW_SECTION); |
| 399 | goto err; | 390 | goto err; |
| 400 | } | ||
| 401 | } | 391 | } |
| 402 | else | 392 | } else |
| 403 | tv=sv; | 393 | tv = sv; |
| 404 | #if 1 | 394 | #if 1 |
| 405 | if (_CONF_add_string(conf, tv, v) == 0) | 395 | if (_CONF_add_string(conf, tv, v) == 0) { |
| 406 | { | ||
| 407 | CONFerr(CONF_F_DEF_LOAD_BIO, | 396 | CONFerr(CONF_F_DEF_LOAD_BIO, |
| 408 | ERR_R_MALLOC_FAILURE); | 397 | ERR_R_MALLOC_FAILURE); |
| 409 | goto err; | 398 | goto err; |
| 410 | } | 399 | } |
| 411 | #else | 400 | #else |
| 412 | v->section=tv->section; | 401 | v->section = tv->section; |
| 413 | if (!sk_CONF_VALUE_push(ts,v)) | 402 | if (!sk_CONF_VALUE_push(ts, v)) { |
| 414 | { | ||
| 415 | CONFerr(CONF_F_DEF_LOAD_BIO, | 403 | CONFerr(CONF_F_DEF_LOAD_BIO, |
| 416 | ERR_R_MALLOC_FAILURE); | 404 | ERR_R_MALLOC_FAILURE); |
| 417 | goto err; | 405 | goto err; |
| 418 | } | 406 | } |
| 419 | vv=(CONF_VALUE *)lh_insert(conf->data,v); | 407 | vv = (CONF_VALUE *)lh_insert(conf->data, v); |
| 420 | if (vv != NULL) | 408 | if (vv != NULL) { |
| 421 | { | 409 | sk_CONF_VALUE_delete_ptr(ts, vv); |
| 422 | sk_CONF_VALUE_delete_ptr(ts,vv); | ||
| 423 | free(vv->name); | 410 | free(vv->name); |
| 424 | free(vv->value); | 411 | free(vv->value); |
| 425 | free(vv); | 412 | free(vv); |
| 426 | } | ||
| 427 | #endif | ||
| 428 | v=NULL; | ||
| 429 | } | 413 | } |
| 414 | #endif | ||
| 415 | v = NULL; | ||
| 430 | } | 416 | } |
| 431 | if (buff != NULL) BUF_MEM_free(buff); | 417 | } |
| 432 | if (section != NULL) free(section); | 418 | if (buff != NULL) |
| 433 | return(1); | 419 | BUF_MEM_free(buff); |
| 420 | if (section != NULL) | ||
| 421 | free(section); | ||
| 422 | return (1); | ||
| 423 | |||
| 434 | err: | 424 | err: |
| 435 | if (buff != NULL) BUF_MEM_free(buff); | 425 | if (buff != NULL) |
| 436 | if (section != NULL) free(section); | 426 | BUF_MEM_free(buff); |
| 437 | if (line != NULL) *line=eline; | 427 | if (section != NULL) |
| 438 | snprintf(btmp,sizeof btmp,"%ld",eline); | 428 | free(section); |
| 439 | ERR_add_error_data(2,"line ",btmp); | 429 | if (line != NULL) |
| 440 | if ((h != conf->data) && (conf->data != NULL)) | 430 | *line = eline; |
| 441 | { | 431 | snprintf(btmp, sizeof btmp, "%ld", eline); |
| 432 | ERR_add_error_data(2, "line ", btmp); | ||
| 433 | if ((h != conf->data) && (conf->data != NULL)) { | ||
| 442 | CONF_free(conf->data); | 434 | CONF_free(conf->data); |
| 443 | conf->data=NULL; | 435 | conf->data = NULL; |
| 444 | } | ||
| 445 | if (v != NULL) | ||
| 446 | { | ||
| 447 | if (v->name != NULL) free(v->name); | ||
| 448 | if (v->value != NULL) free(v->value); | ||
| 449 | if (v != NULL) free(v); | ||
| 450 | } | ||
| 451 | return(0); | ||
| 452 | } | 436 | } |
| 453 | 437 | if (v != NULL) { | |
| 454 | static void clear_comments(CONF *conf, char *p) | 438 | if (v->name != NULL) |
| 455 | { | 439 | free(v->name); |
| 456 | for (;;) | 440 | if (v->value != NULL) |
| 457 | { | 441 | free(v->value); |
| 458 | if (IS_FCOMMENT(conf,*p)) | 442 | if (v != NULL) |
| 459 | { | 443 | free(v); |
| 460 | *p='\0'; | 444 | } |
| 445 | return (0); | ||
| 446 | } | ||
| 447 | |||
| 448 | static void | ||
| 449 | clear_comments(CONF *conf, char *p) | ||
| 450 | { | ||
| 451 | for (;;) { | ||
| 452 | if (IS_FCOMMENT(conf, *p)) { | ||
| 453 | *p = '\0'; | ||
| 461 | return; | 454 | return; |
| 462 | } | 455 | } |
| 463 | if (!IS_WS(conf,*p)) | 456 | if (!IS_WS(conf, *p)) { |
| 464 | { | ||
| 465 | break; | 457 | break; |
| 466 | } | ||
| 467 | p++; | ||
| 468 | } | 458 | } |
| 459 | p++; | ||
| 460 | } | ||
| 469 | 461 | ||
| 470 | for (;;) | 462 | for (;;) { |
| 471 | { | 463 | if (IS_COMMENT(conf, *p)) { |
| 472 | if (IS_COMMENT(conf,*p)) | 464 | *p = '\0'; |
| 473 | { | ||
| 474 | *p='\0'; | ||
| 475 | return; | 465 | return; |
| 476 | } | 466 | } |
| 477 | if (IS_DQUOTE(conf,*p)) | 467 | if (IS_DQUOTE(conf, *p)) { |
| 478 | { | 468 | p = scan_dquote(conf, p); |
| 479 | p=scan_dquote(conf, p); | ||
| 480 | continue; | 469 | continue; |
| 481 | } | 470 | } |
| 482 | if (IS_QUOTE(conf,*p)) | 471 | if (IS_QUOTE(conf, *p)) { |
| 483 | { | 472 | p = scan_quote(conf, p); |
| 484 | p=scan_quote(conf, p); | ||
| 485 | continue; | 473 | continue; |
| 486 | } | 474 | } |
| 487 | if (IS_ESC(conf,*p)) | 475 | if (IS_ESC(conf, *p)) { |
| 488 | { | 476 | p = scan_esc(conf, p); |
| 489 | p=scan_esc(conf,p); | ||
| 490 | continue; | 477 | continue; |
| 491 | } | 478 | } |
| 492 | if (IS_EOF(conf,*p)) | 479 | if (IS_EOF(conf, *p)) |
| 493 | return; | 480 | return; |
| 494 | else | 481 | else |
| 495 | p++; | 482 | p++; |
| 496 | } | ||
| 497 | } | 483 | } |
| 484 | } | ||
| 498 | 485 | ||
| 499 | static int str_copy(CONF *conf, char *section, char **pto, char *from) | 486 | static int |
| 500 | { | 487 | str_copy(CONF *conf, char *section, char **pto, char *from) |
| 501 | int q,r,rr=0,to=0,len=0; | 488 | { |
| 502 | char *s,*e,*rp,*p,*rrp,*np,*cp,v; | 489 | int q, r,rr = 0, to = 0, len = 0; |
| 490 | char *s, *e, *rp, *p, *rrp, *np, *cp, v; | ||
| 503 | BUF_MEM *buf; | 491 | BUF_MEM *buf; |
| 504 | 492 | ||
| 505 | if ((buf=BUF_MEM_new()) == NULL) return(0); | 493 | if ((buf = BUF_MEM_new()) == NULL) |
| 494 | return (0); | ||
| 506 | 495 | ||
| 507 | len=strlen(from)+1; | 496 | len = strlen(from) + 1; |
| 508 | if (!BUF_MEM_grow(buf,len)) goto err; | 497 | if (!BUF_MEM_grow(buf, len)) |
| 498 | goto err; | ||
| 509 | 499 | ||
| 510 | for (;;) | 500 | for (;;) { |
| 511 | { | 501 | if (IS_QUOTE(conf, *from)) { |
| 512 | if (IS_QUOTE(conf,*from)) | 502 | q = *from; |
| 513 | { | ||
| 514 | q= *from; | ||
| 515 | from++; | 503 | from++; |
| 516 | while (!IS_EOF(conf,*from) && (*from != q)) | 504 | while (!IS_EOF(conf, *from) && (*from != q)) { |
| 517 | { | 505 | if (IS_ESC(conf, *from)) { |
| 518 | if (IS_ESC(conf,*from)) | ||
| 519 | { | ||
| 520 | from++; | 506 | from++; |
| 521 | if (IS_EOF(conf,*from)) break; | 507 | if (IS_EOF(conf, *from)) |
| 522 | } | 508 | break; |
| 523 | buf->data[to++]= *(from++); | ||
| 524 | } | 509 | } |
| 525 | if (*from == q) from++; | 510 | buf->data[to++] = *(from++); |
| 526 | } | 511 | } |
| 527 | else if (IS_DQUOTE(conf,*from)) | 512 | if (*from == q) |
| 528 | { | 513 | from++; |
| 529 | q= *from; | 514 | } else if (IS_DQUOTE(conf, *from)) { |
| 515 | q = *from; | ||
| 530 | from++; | 516 | from++; |
| 531 | while (!IS_EOF(conf,*from)) | 517 | while (!IS_EOF(conf, *from)) { |
| 532 | { | 518 | if (*from == q) { |
| 533 | if (*from == q) | 519 | if (*(from + 1) == q) { |
| 534 | { | ||
| 535 | if (*(from+1) == q) | ||
| 536 | { | ||
| 537 | from++; | 520 | from++; |
| 538 | } | 521 | } else { |
| 539 | else | ||
| 540 | { | ||
| 541 | break; | 522 | break; |
| 542 | } | ||
| 543 | } | 523 | } |
| 544 | buf->data[to++]= *(from++); | ||
| 545 | } | 524 | } |
| 546 | if (*from == q) from++; | 525 | buf->data[to++] = *(from++); |
| 547 | } | 526 | } |
| 548 | else if (IS_ESC(conf,*from)) | 527 | if (*from == q) |
| 549 | { | 528 | from++; |
| 529 | } else if (IS_ESC(conf, *from)) { | ||
| 550 | from++; | 530 | from++; |
| 551 | v= *(from++); | 531 | v = *(from++); |
| 552 | if (IS_EOF(conf,v)) break; | 532 | if (IS_EOF(conf, v)) |
| 553 | else if (v == 'r') v='\r'; | 533 | break; |
| 554 | else if (v == 'n') v='\n'; | 534 | else if (v == 'r') |
| 555 | else if (v == 'b') v='\b'; | 535 | v = '\r'; |
| 556 | else if (v == 't') v='\t'; | 536 | else if (v == 'n') |
| 557 | buf->data[to++]= v; | 537 | v = '\n'; |
| 558 | } | 538 | else if (v == 'b') |
| 559 | else if (IS_EOF(conf,*from)) | 539 | v = '\b'; |
| 540 | else if (v == 't') | ||
| 541 | v = '\t'; | ||
| 542 | buf->data[to++] = v; | ||
| 543 | } else if (IS_EOF(conf, *from)) | ||
| 560 | break; | 544 | break; |
| 561 | else if (*from == '$') | 545 | else if (*from == '$') { |
| 562 | { | ||
| 563 | /* try to expand it */ | 546 | /* try to expand it */ |
| 564 | rrp=NULL; | 547 | rrp = NULL; |
| 565 | s= &(from[1]); | 548 | s = &(from[1]); |
| 566 | if (*s == '{') | 549 | if (*s == '{') |
| 567 | q='}'; | 550 | q = '}'; |
| 568 | else if (*s == '(') | 551 | else if (*s == '(') |
| 569 | q=')'; | 552 | q = ')'; |
| 570 | else q=0; | 553 | else |
| 554 | q = 0; | ||
| 571 | 555 | ||
| 572 | if (q) s++; | 556 | if (q) |
| 573 | cp=section; | 557 | s++; |
| 574 | e=np=s; | 558 | cp = section; |
| 575 | while (IS_ALPHA_NUMERIC(conf,*e)) | 559 | e = np = s; |
| 560 | while (IS_ALPHA_NUMERIC(conf, *e)) | ||
| 576 | e++; | 561 | e++; |
| 577 | if ((e[0] == ':') && (e[1] == ':')) | 562 | if ((e[0] == ':') && (e[1] == ':')) { |
| 578 | { | 563 | cp = np; |
| 579 | cp=np; | 564 | rrp = e; |
| 580 | rrp=e; | 565 | rr = *e; |
| 581 | rr= *e; | 566 | *rrp = '\0'; |
| 582 | *rrp='\0'; | 567 | e += 2; |
| 583 | e+=2; | 568 | np = e; |
| 584 | np=e; | 569 | while (IS_ALPHA_NUMERIC(conf, *e)) |
| 585 | while (IS_ALPHA_NUMERIC(conf,*e)) | ||
| 586 | e++; | 570 | e++; |
| 587 | } | 571 | } |
| 588 | r= *e; | 572 | r = *e; |
| 589 | *e='\0'; | 573 | *e = '\0'; |
| 590 | rp=e; | 574 | rp = e; |
| 591 | if (q) | 575 | if (q) { |
| 592 | { | 576 | if (r != q) { |
| 593 | if (r != q) | 577 | CONFerr(CONF_F_STR_COPY, |
| 594 | { | 578 | CONF_R_NO_CLOSE_BRACE); |
| 595 | CONFerr(CONF_F_STR_COPY,CONF_R_NO_CLOSE_BRACE); | ||
| 596 | goto err; | 579 | goto err; |
| 597 | } | ||
| 598 | e++; | ||
| 599 | } | 580 | } |
| 581 | e++; | ||
| 582 | } | ||
| 600 | /* So at this point we have | 583 | /* So at this point we have |
| 601 | * np which is the start of the name string which is | 584 | * np which is the start of the name string which is |
| 602 | * '\0' terminated. | 585 | * '\0' terminated. |
| 603 | * cp which is the start of the section string which is | 586 | * cp which is the start of the section string which is |
| 604 | * '\0' terminated. | 587 | * '\0' terminated. |
| 605 | * e is the 'next point after'. | 588 | * e is the 'next point after'. |
| 606 | * r and rr are the chars replaced by the '\0' | 589 | * r and rr are the chars replaced by the '\0' |
| 607 | * rp and rrp is where 'r' and 'rr' came from. | 590 | * rp and rrp is where 'r' and 'rr' came from. |
| 608 | */ | 591 | */ |
| 609 | p=_CONF_get_string(conf,cp,np); | 592 | p = _CONF_get_string(conf, cp, np); |
| 610 | if (rrp != NULL) *rrp=rr; | 593 | if (rrp != NULL) |
| 611 | *rp=r; | 594 | *rrp = rr; |
| 612 | if (p == NULL) | 595 | *rp = r; |
| 613 | { | 596 | if (p == NULL) { |
| 614 | CONFerr(CONF_F_STR_COPY,CONF_R_VARIABLE_HAS_NO_VALUE); | 597 | CONFerr(CONF_F_STR_COPY, |
| 598 | CONF_R_VARIABLE_HAS_NO_VALUE); | ||
| 615 | goto err; | 599 | goto err; |
| 616 | } | 600 | } |
| 617 | BUF_MEM_grow_clean(buf,(strlen(p)+buf->length-(e-from))); | 601 | BUF_MEM_grow_clean(buf, |
| 602 | (strlen(p) + buf->length - (e - from))); | ||
| 618 | while (*p) | 603 | while (*p) |
| 619 | buf->data[to++]= *(p++); | 604 | buf->data[to++] = *(p++); |
| 620 | 605 | ||
| 621 | /* Since we change the pointer 'from', we also have | 606 | /* Since we change the pointer 'from', we also have |
| 622 | to change the perceived length of the string it | 607 | to change the perceived length of the string it |
| 623 | points at. /RL */ | 608 | points at. /RL */ |
| 624 | len -= e-from; | 609 | len -= e - from; |
| 625 | from=e; | 610 | from = e; |
| 626 | 611 | ||
| 627 | /* In case there were no braces or parenthesis around | 612 | /* In case there were no braces or parenthesis around |
| 628 | the variable reference, we have to put back the | 613 | the variable reference, we have to put back the |
| 629 | character that was replaced with a '\0'. /RL */ | 614 | character that was replaced with a '\0'. /RL */ |
| 630 | *rp = r; | 615 | *rp = r; |
| 631 | } | 616 | } else |
| 632 | else | 617 | buf->data[to++] = *(from++); |
| 633 | buf->data[to++]= *(from++); | 618 | } |
| 634 | } | ||
| 635 | buf->data[to]='\0'; | 619 | buf->data[to]='\0'; |
| 636 | if (*pto != NULL) free(*pto); | 620 | if (*pto != NULL) |
| 637 | *pto=buf->data; | 621 | free(*pto); |
| 622 | *pto = buf->data; | ||
| 638 | free(buf); | 623 | free(buf); |
| 639 | return(1); | 624 | return (1); |
| 640 | err: | ||
| 641 | if (buf != NULL) BUF_MEM_free(buf); | ||
| 642 | return(0); | ||
| 643 | } | ||
| 644 | 625 | ||
| 645 | static char *eat_ws(CONF *conf, char *p) | 626 | err: |
| 646 | { | 627 | if (buf != NULL) |
| 647 | while (IS_WS(conf,*p) && (!IS_EOF(conf,*p))) | 628 | BUF_MEM_free(buf); |
| 629 | return (0); | ||
| 630 | } | ||
| 631 | |||
| 632 | static char * | ||
| 633 | eat_ws(CONF *conf, char *p) | ||
| 634 | { | ||
| 635 | while (IS_WS(conf, *p) && (!IS_EOF(conf, *p))) | ||
| 648 | p++; | 636 | p++; |
| 649 | return(p); | 637 | return (p); |
| 650 | } | 638 | } |
| 651 | 639 | ||
| 652 | static char *eat_alpha_numeric(CONF *conf, char *p) | 640 | static char * |
| 653 | { | 641 | eat_alpha_numeric(CONF *conf, char *p) |
| 654 | for (;;) | 642 | { |
| 655 | { | 643 | for (;;) { |
| 656 | if (IS_ESC(conf,*p)) | 644 | if (IS_ESC(conf, *p)) { |
| 657 | { | 645 | p = scan_esc(conf, p); |
| 658 | p=scan_esc(conf,p); | ||
| 659 | continue; | 646 | continue; |
| 660 | } | ||
| 661 | if (!IS_ALPHA_NUMERIC_PUNCT(conf,*p)) | ||
| 662 | return(p); | ||
| 663 | p++; | ||
| 664 | } | 647 | } |
| 648 | if (!IS_ALPHA_NUMERIC_PUNCT(conf, *p)) | ||
| 649 | return (p); | ||
| 650 | p++; | ||
| 665 | } | 651 | } |
| 652 | } | ||
| 666 | 653 | ||
| 667 | static char *scan_quote(CONF *conf, char *p) | 654 | static char * |
| 668 | { | 655 | scan_quote(CONF *conf, char *p) |
| 669 | int q= *p; | 656 | { |
| 657 | int q = *p; | ||
| 670 | 658 | ||
| 671 | p++; | 659 | p++; |
| 672 | while (!(IS_EOF(conf,*p)) && (*p != q)) | 660 | while (!(IS_EOF(conf, *p)) && (*p != q)) { |
| 673 | { | 661 | if (IS_ESC(conf, *p)) { |
| 674 | if (IS_ESC(conf,*p)) | ||
| 675 | { | ||
| 676 | p++; | 662 | p++; |
| 677 | if (IS_EOF(conf,*p)) return(p); | 663 | if (IS_EOF(conf, *p)) |
| 678 | } | 664 | return (p); |
| 679 | p++; | ||
| 680 | } | 665 | } |
| 681 | if (*p == q) p++; | 666 | p++; |
| 682 | return(p); | ||
| 683 | } | 667 | } |
| 668 | if (*p == q) | ||
| 669 | p++; | ||
| 670 | return (p); | ||
| 671 | } | ||
| 684 | 672 | ||
| 685 | 673 | ||
| 686 | static char *scan_dquote(CONF *conf, char *p) | 674 | static char * |
| 687 | { | 675 | scan_dquote(CONF *conf, char *p) |
| 688 | int q= *p; | 676 | { |
| 677 | int q = *p; | ||
| 689 | 678 | ||
| 690 | p++; | 679 | p++; |
| 691 | while (!(IS_EOF(conf,*p))) | 680 | while (!(IS_EOF(conf, *p))) { |
| 692 | { | 681 | if (*p == q) { |
| 693 | if (*p == q) | 682 | if (*(p + 1) == q) { |
| 694 | { | ||
| 695 | if (*(p+1) == q) | ||
| 696 | { | ||
| 697 | p++; | 683 | p++; |
| 698 | } | 684 | } else { |
| 699 | else | ||
| 700 | { | ||
| 701 | break; | 685 | break; |
| 702 | } | ||
| 703 | } | 686 | } |
| 704 | p++; | ||
| 705 | } | 687 | } |
| 706 | if (*p == q) p++; | 688 | p++; |
| 707 | return(p); | ||
| 708 | } | 689 | } |
| 690 | if (*p == q) | ||
| 691 | p++; | ||
| 692 | return (p); | ||
| 693 | } | ||
| 709 | 694 | ||
| 710 | static void dump_value_doall_arg(CONF_VALUE *a, BIO *out) | 695 | static void |
| 711 | { | 696 | dump_value_doall_arg(CONF_VALUE *a, BIO *out) |
| 697 | { | ||
| 712 | if (a->name) | 698 | if (a->name) |
| 713 | BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value); | 699 | BIO_printf(out, "[%s] %s=%s\n", a->section, a->name, a->value); |
| 714 | else | 700 | else |
| 715 | BIO_printf(out, "[[%s]]\n", a->section); | 701 | BIO_printf(out, "[[%s]]\n", a->section); |
| 716 | } | 702 | } |
| 717 | 703 | ||
| 718 | static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE, BIO) | 704 | static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_value, CONF_VALUE, BIO) |
| 719 | 705 | ||
| 720 | static int def_dump(const CONF *conf, BIO *out) | 706 | static int |
| 721 | { | 707 | def_dump(const CONF *conf, BIO *out) |
| 708 | { | ||
| 722 | lh_CONF_VALUE_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), | 709 | lh_CONF_VALUE_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_value), |
| 723 | BIO, out); | 710 | BIO, out); |
| 724 | return 1; | 711 | return 1; |
| 725 | } | 712 | } |
| 726 | 713 | ||
| 727 | static int def_is_number(const CONF *conf, char c) | 714 | static int |
| 728 | { | 715 | def_is_number(const CONF *conf, char c) |
| 729 | return IS_NUMBER(conf,c); | 716 | { |
| 730 | } | 717 | return IS_NUMBER(conf, c); |
| 718 | } | ||
| 731 | 719 | ||
| 732 | static int def_to_int(const CONF *conf, char c) | 720 | static int |
| 733 | { | 721 | def_to_int(const CONF *conf, char c) |
| 722 | { | ||
| 734 | return c - '0'; | 723 | return c - '0'; |
| 735 | } | 724 | } |
| 736 | |||
diff --git a/src/lib/libssl/src/crypto/conf/conf_def.h b/src/lib/libssl/src/crypto/conf/conf_def.h index b18e6e2728..022300b9a1 100644 --- a/src/lib/libssl/src/crypto/conf/conf_def.h +++ b/src/lib/libssl/src/crypto/conf/conf_def.h | |||
| @@ -5,21 +5,21 @@ | |||
| 5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
| 6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
| 7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
| 8 | * | 8 | * |
| 9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
| 10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | 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 | 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 | 13 | * included with this distribution is covered by the same copyright terms |
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 15 | * | 15 | * |
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
| 18 | * If this package is used in a product, Eric Young should be given attribution | 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. | 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 | 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. | 21 | * in documentation (online or textual) provided with the package. |
| 22 | * | 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: | 25 | * are met: |
| @@ -34,10 +34,10 @@ | |||
| 34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
| 36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 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: | 38 | * the apps directory (application code) you must include an acknowledgement: |
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 40 | * | 40 | * |
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -49,7 +49,7 @@ | |||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 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 | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
| 52 | * | 52 | * |
| 53 | * The licence and distribution terms for any publically available version or | 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 | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| @@ -91,73 +91,72 @@ | |||
| 91 | #define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE) | 91 | #define IS_DQUOTE(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_DQUOTE) |
| 92 | #define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT) | 92 | #define IS_HIGHBIT(c,a) (KEYTYPES(c)[(a)&0xff]&CONF_HIGHBIT) |
| 93 | 93 | ||
| 94 | static unsigned short CONF_type_default[256]={ | 94 | static unsigned short CONF_type_default[256] = { |
| 95 | 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | 95 | 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 96 | 0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000, | 96 | 0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000, |
| 97 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | 97 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 98 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | 98 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, |
| 99 | 0x0010,0x0200,0x0040,0x0080,0x0000,0x0200,0x0200,0x0040, | 99 | 0x0010, 0x0200, 0x0040, 0x0080, 0x0000, 0x0200, 0x0200, 0x0040, |
| 100 | 0x0000,0x0000,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200, | 100 | 0x0000, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, |
| 101 | 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001, | 101 | 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, |
| 102 | 0x0001,0x0001,0x0000,0x0200,0x0000,0x0000,0x0000,0x0200, | 102 | 0x0001, 0x0001, 0x0000, 0x0200, 0x0000, 0x0000, 0x0000, 0x0200, |
| 103 | 0x0200,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | 103 | 0x0200, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, |
| 104 | 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | 104 | 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, |
| 105 | 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | 105 | 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, |
| 106 | 0x0002,0x0002,0x0002,0x0000,0x0020,0x0000,0x0200,0x0100, | 106 | 0x0002, 0x0002, 0x0002, 0x0000, 0x0020, 0x0000, 0x0200, 0x0100, |
| 107 | 0x0040,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | 107 | 0x0040, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, |
| 108 | 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | 108 | 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, |
| 109 | 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | 109 | 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, |
| 110 | 0x0004,0x0004,0x0004,0x0000,0x0200,0x0000,0x0200,0x0000, | 110 | 0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000, |
| 111 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 111 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 112 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 112 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 113 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 113 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 114 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 114 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 115 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 115 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 116 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 116 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 117 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 117 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 118 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 118 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 119 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 119 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 120 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 120 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 121 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 121 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 122 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 122 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 123 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 123 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 124 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 124 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 125 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 125 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 126 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | 126 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, |
| 127 | }; | 127 | }; |
| 128 | |||
| 129 | static unsigned short CONF_type_win32[256]={ | ||
| 130 | 0x0008,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | ||
| 131 | 0x0000,0x0010,0x0010,0x0000,0x0000,0x0010,0x0000,0x0000, | ||
| 132 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | ||
| 133 | 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, | ||
| 134 | 0x0010,0x0200,0x0400,0x0000,0x0000,0x0200,0x0200,0x0000, | ||
| 135 | 0x0000,0x0000,0x0200,0x0200,0x0200,0x0200,0x0200,0x0200, | ||
| 136 | 0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001,0x0001, | ||
| 137 | 0x0001,0x0001,0x0000,0x0A00,0x0000,0x0000,0x0000,0x0200, | ||
| 138 | 0x0200,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | ||
| 139 | 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | ||
| 140 | 0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002,0x0002, | ||
| 141 | 0x0002,0x0002,0x0002,0x0000,0x0000,0x0000,0x0200,0x0100, | ||
| 142 | 0x0000,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | ||
| 143 | 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | ||
| 144 | 0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004,0x0004, | ||
| 145 | 0x0004,0x0004,0x0004,0x0000,0x0200,0x0000,0x0200,0x0000, | ||
| 146 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 147 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 148 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 149 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 150 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 151 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 152 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 153 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 154 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 155 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 156 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 157 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 158 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 159 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 160 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 161 | 0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000,0x1000, | ||
| 162 | }; | ||
| 163 | 128 | ||
| 129 | static unsigned short CONF_type_win32[256] = { | ||
| 130 | 0x0008, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 131 | 0x0000, 0x0010, 0x0010, 0x0000, 0x0000, 0x0010, 0x0000, 0x0000, | ||
| 132 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 133 | 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, | ||
| 134 | 0x0010, 0x0200, 0x0400, 0x0000, 0x0000, 0x0200, 0x0200, 0x0000, | ||
| 135 | 0x0000, 0x0000, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, 0x0200, | ||
| 136 | 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, | ||
| 137 | 0x0001, 0x0001, 0x0000, 0x0A00, 0x0000, 0x0000, 0x0000, 0x0200, | ||
| 138 | 0x0200, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, | ||
| 139 | 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, | ||
| 140 | 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, | ||
| 141 | 0x0002, 0x0002, 0x0002, 0x0000, 0x0000, 0x0000, 0x0200, 0x0100, | ||
| 142 | 0x0000, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, | ||
| 143 | 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, | ||
| 144 | 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, 0x0004, | ||
| 145 | 0x0004, 0x0004, 0x0004, 0x0000, 0x0200, 0x0000, 0x0200, 0x0000, | ||
| 146 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 147 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 148 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 149 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 150 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 151 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 152 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 153 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 154 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 155 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 156 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 157 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 158 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 159 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 160 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 161 | 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, 0x1000, | ||
| 162 | }; | ||
diff --git a/src/lib/libssl/src/crypto/conf/conf_err.c b/src/lib/libssl/src/crypto/conf/conf_err.c index 25bb5dc9aa..94feb5ec94 100644 --- a/src/lib/libssl/src/crypto/conf/conf_err.c +++ b/src/lib/libssl/src/crypto/conf/conf_err.c | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | * are met: | 7 | * are met: |
| 8 | * | 8 | * |
| 9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * | 11 | * |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
| @@ -68,64 +68,61 @@ | |||
| 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0) | 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_CONF,func,0) |
| 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason) | 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_CONF,0,reason) |
| 70 | 70 | ||
| 71 | static ERR_STRING_DATA CONF_str_functs[]= | 71 | static ERR_STRING_DATA CONF_str_functs[]= { |
| 72 | { | 72 | {ERR_FUNC(CONF_F_CONF_DUMP_FP), "CONF_dump_fp"}, |
| 73 | {ERR_FUNC(CONF_F_CONF_DUMP_FP), "CONF_dump_fp"}, | 73 | {ERR_FUNC(CONF_F_CONF_LOAD), "CONF_load"}, |
| 74 | {ERR_FUNC(CONF_F_CONF_LOAD), "CONF_load"}, | 74 | {ERR_FUNC(CONF_F_CONF_LOAD_BIO), "CONF_load_bio"}, |
| 75 | {ERR_FUNC(CONF_F_CONF_LOAD_BIO), "CONF_load_bio"}, | 75 | {ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"}, |
| 76 | {ERR_FUNC(CONF_F_CONF_LOAD_FP), "CONF_load_fp"}, | 76 | {ERR_FUNC(CONF_F_CONF_MODULES_LOAD), "CONF_modules_load"}, |
| 77 | {ERR_FUNC(CONF_F_CONF_MODULES_LOAD), "CONF_modules_load"}, | 77 | {ERR_FUNC(CONF_F_CONF_PARSE_LIST), "CONF_parse_list"}, |
| 78 | {ERR_FUNC(CONF_F_CONF_PARSE_LIST), "CONF_parse_list"}, | 78 | {ERR_FUNC(CONF_F_DEF_LOAD), "DEF_LOAD"}, |
| 79 | {ERR_FUNC(CONF_F_DEF_LOAD), "DEF_LOAD"}, | 79 | {ERR_FUNC(CONF_F_DEF_LOAD_BIO), "DEF_LOAD_BIO"}, |
| 80 | {ERR_FUNC(CONF_F_DEF_LOAD_BIO), "DEF_LOAD_BIO"}, | 80 | {ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"}, |
| 81 | {ERR_FUNC(CONF_F_MODULE_INIT), "MODULE_INIT"}, | 81 | {ERR_FUNC(CONF_F_MODULE_LOAD_DSO), "MODULE_LOAD_DSO"}, |
| 82 | {ERR_FUNC(CONF_F_MODULE_LOAD_DSO), "MODULE_LOAD_DSO"}, | 82 | {ERR_FUNC(CONF_F_MODULE_RUN), "MODULE_RUN"}, |
| 83 | {ERR_FUNC(CONF_F_MODULE_RUN), "MODULE_RUN"}, | 83 | {ERR_FUNC(CONF_F_NCONF_DUMP_BIO), "NCONF_dump_bio"}, |
| 84 | {ERR_FUNC(CONF_F_NCONF_DUMP_BIO), "NCONF_dump_bio"}, | 84 | {ERR_FUNC(CONF_F_NCONF_DUMP_FP), "NCONF_dump_fp"}, |
| 85 | {ERR_FUNC(CONF_F_NCONF_DUMP_FP), "NCONF_dump_fp"}, | 85 | {ERR_FUNC(CONF_F_NCONF_GET_NUMBER), "NCONF_get_number"}, |
| 86 | {ERR_FUNC(CONF_F_NCONF_GET_NUMBER), "NCONF_get_number"}, | 86 | {ERR_FUNC(CONF_F_NCONF_GET_NUMBER_E), "NCONF_get_number_e"}, |
| 87 | {ERR_FUNC(CONF_F_NCONF_GET_NUMBER_E), "NCONF_get_number_e"}, | 87 | {ERR_FUNC(CONF_F_NCONF_GET_SECTION), "NCONF_get_section"}, |
| 88 | {ERR_FUNC(CONF_F_NCONF_GET_SECTION), "NCONF_get_section"}, | 88 | {ERR_FUNC(CONF_F_NCONF_GET_STRING), "NCONF_get_string"}, |
| 89 | {ERR_FUNC(CONF_F_NCONF_GET_STRING), "NCONF_get_string"}, | 89 | {ERR_FUNC(CONF_F_NCONF_LOAD), "NCONF_load"}, |
| 90 | {ERR_FUNC(CONF_F_NCONF_LOAD), "NCONF_load"}, | 90 | {ERR_FUNC(CONF_F_NCONF_LOAD_BIO), "NCONF_load_bio"}, |
| 91 | {ERR_FUNC(CONF_F_NCONF_LOAD_BIO), "NCONF_load_bio"}, | 91 | {ERR_FUNC(CONF_F_NCONF_LOAD_FP), "NCONF_load_fp"}, |
| 92 | {ERR_FUNC(CONF_F_NCONF_LOAD_FP), "NCONF_load_fp"}, | 92 | {ERR_FUNC(CONF_F_NCONF_NEW), "NCONF_new"}, |
| 93 | {ERR_FUNC(CONF_F_NCONF_NEW), "NCONF_new"}, | 93 | {ERR_FUNC(CONF_F_STR_COPY), "STR_COPY"}, |
| 94 | {ERR_FUNC(CONF_F_STR_COPY), "STR_COPY"}, | 94 | {0, NULL} |
| 95 | {0,NULL} | 95 | }; |
| 96 | }; | ||
| 97 | 96 | ||
| 98 | static ERR_STRING_DATA CONF_str_reasons[]= | 97 | static ERR_STRING_DATA CONF_str_reasons[]= { |
| 99 | { | 98 | {ERR_REASON(CONF_R_ERROR_LOADING_DSO) , "error loading dso"}, |
| 100 | {ERR_REASON(CONF_R_ERROR_LOADING_DSO) ,"error loading dso"}, | 99 | {ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) , "list cannot be null"}, |
| 101 | {ERR_REASON(CONF_R_LIST_CANNOT_BE_NULL) ,"list cannot be null"}, | 100 | {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET), "missing close square bracket"}, |
| 102 | {ERR_REASON(CONF_R_MISSING_CLOSE_SQUARE_BRACKET),"missing close square bracket"}, | 101 | {ERR_REASON(CONF_R_MISSING_EQUAL_SIGN) , "missing equal sign"}, |
| 103 | {ERR_REASON(CONF_R_MISSING_EQUAL_SIGN) ,"missing equal sign"}, | 102 | {ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION), "missing finish function"}, |
| 104 | {ERR_REASON(CONF_R_MISSING_FINISH_FUNCTION),"missing finish function"}, | 103 | {ERR_REASON(CONF_R_MISSING_INIT_FUNCTION), "missing init function"}, |
| 105 | {ERR_REASON(CONF_R_MISSING_INIT_FUNCTION),"missing init function"}, | 104 | {ERR_REASON(CONF_R_MODULE_INITIALIZATION_ERROR), "module initialization error"}, |
| 106 | {ERR_REASON(CONF_R_MODULE_INITIALIZATION_ERROR),"module initialization error"}, | 105 | {ERR_REASON(CONF_R_NO_CLOSE_BRACE) , "no close brace"}, |
| 107 | {ERR_REASON(CONF_R_NO_CLOSE_BRACE) ,"no close brace"}, | 106 | {ERR_REASON(CONF_R_NO_CONF) , "no conf"}, |
| 108 | {ERR_REASON(CONF_R_NO_CONF) ,"no conf"}, | 107 | {ERR_REASON(CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE), "no conf or environment variable"}, |
| 109 | {ERR_REASON(CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE),"no conf or environment variable"}, | 108 | {ERR_REASON(CONF_R_NO_SECTION) , "no section"}, |
| 110 | {ERR_REASON(CONF_R_NO_SECTION) ,"no section"}, | 109 | {ERR_REASON(CONF_R_NO_SUCH_FILE) , "no such file"}, |
| 111 | {ERR_REASON(CONF_R_NO_SUCH_FILE) ,"no such file"}, | 110 | {ERR_REASON(CONF_R_NO_VALUE) , "no value"}, |
| 112 | {ERR_REASON(CONF_R_NO_VALUE) ,"no value"}, | 111 | {ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION), "unable to create new section"}, |
| 113 | {ERR_REASON(CONF_R_UNABLE_TO_CREATE_NEW_SECTION),"unable to create new section"}, | 112 | {ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME) , "unknown module name"}, |
| 114 | {ERR_REASON(CONF_R_UNKNOWN_MODULE_NAME) ,"unknown module name"}, | 113 | {ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE), "variable has no value"}, |
| 115 | {ERR_REASON(CONF_R_VARIABLE_HAS_NO_VALUE),"variable has no value"}, | 114 | {0, NULL} |
| 116 | {0,NULL} | 115 | }; |
| 117 | }; | ||
| 118 | 116 | ||
| 119 | #endif | 117 | #endif |
| 120 | 118 | ||
| 121 | void ERR_load_CONF_strings(void) | 119 | void |
| 122 | { | 120 | ERR_load_CONF_strings(void) |
| 121 | { | ||
| 123 | #ifndef OPENSSL_NO_ERR | 122 | #ifndef OPENSSL_NO_ERR |
| 124 | 123 | if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) { | |
| 125 | if (ERR_func_error_string(CONF_str_functs[0].error) == NULL) | 124 | ERR_load_strings(0, CONF_str_functs); |
| 126 | { | 125 | ERR_load_strings(0, CONF_str_reasons); |
| 127 | ERR_load_strings(0,CONF_str_functs); | ||
| 128 | ERR_load_strings(0,CONF_str_reasons); | ||
| 129 | } | ||
| 130 | #endif | ||
| 131 | } | 126 | } |
| 127 | #endif | ||
| 128 | } | ||
diff --git a/src/lib/libssl/src/crypto/conf/conf_lib.c b/src/lib/libssl/src/crypto/conf/conf_lib.c index 6f8866fa1a..469af6e825 100644 --- a/src/lib/libssl/src/crypto/conf/conf_lib.c +++ b/src/lib/libssl/src/crypto/conf/conf_lib.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * are met: | 10 | * are met: |
| 11 | * | 11 | * |
| 12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * | 14 | * |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
| @@ -65,66 +65,67 @@ | |||
| 65 | 65 | ||
| 66 | const char CONF_version[]="CONF" OPENSSL_VERSION_PTEXT; | 66 | const char CONF_version[]="CONF" OPENSSL_VERSION_PTEXT; |
| 67 | 67 | ||
| 68 | static CONF_METHOD *default_CONF_method=NULL; | 68 | static CONF_METHOD *default_CONF_method = NULL; |
| 69 | 69 | ||
| 70 | /* Init a 'CONF' structure from an old LHASH */ | 70 | /* Init a 'CONF' structure from an old LHASH */ |
| 71 | 71 | ||
| 72 | void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash) | 72 | void |
| 73 | { | 73 | CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash) |
| 74 | { | ||
| 74 | if (default_CONF_method == NULL) | 75 | if (default_CONF_method == NULL) |
| 75 | default_CONF_method = NCONF_default(); | 76 | default_CONF_method = NCONF_default(); |
| 76 | |||
| 77 | default_CONF_method->init(conf); | 77 | default_CONF_method->init(conf); |
| 78 | conf->data = hash; | 78 | conf->data = hash; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | /* The following section contains the "CONF classic" functions, | 81 | /* The following section contains the "CONF classic" functions, |
| 82 | rewritten in terms of the new CONF interface. */ | 82 | rewritten in terms of the new CONF interface. */ |
| 83 | 83 | ||
| 84 | int CONF_set_default_method(CONF_METHOD *meth) | 84 | int |
| 85 | { | 85 | CONF_set_default_method(CONF_METHOD *meth) |
| 86 | { | ||
| 86 | default_CONF_method = meth; | 87 | default_CONF_method = meth; |
| 87 | return 1; | 88 | return 1; |
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, | 91 | LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, |
| 91 | long *eline) | 92 | long *eline) |
| 92 | { | 93 | { |
| 93 | LHASH_OF(CONF_VALUE) *ltmp; | 94 | LHASH_OF(CONF_VALUE) *ltmp; |
| 94 | BIO *in=NULL; | 95 | BIO *in = NULL; |
| 95 | 96 | ||
| 96 | in=BIO_new_file(file, "rb"); | 97 | in = BIO_new_file(file, "rb"); |
| 97 | if (in == NULL) | 98 | if (in == NULL) { |
| 98 | { | 99 | CONFerr(CONF_F_CONF_LOAD, ERR_R_SYS_LIB); |
| 99 | CONFerr(CONF_F_CONF_LOAD,ERR_R_SYS_LIB); | ||
| 100 | return NULL; | 100 | return NULL; |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | ltmp = CONF_load_bio(conf, in, eline); | 103 | ltmp = CONF_load_bio(conf, in, eline); |
| 104 | BIO_free(in); | 104 | BIO_free(in); |
| 105 | 105 | ||
| 106 | return ltmp; | 106 | return ltmp; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | #ifndef OPENSSL_NO_FP_API | 109 | #ifndef OPENSSL_NO_FP_API |
| 110 | LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, | 110 | LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, |
| 111 | long *eline) | 111 | long *eline) |
| 112 | { | 112 | { |
| 113 | BIO *btmp; | 113 | BIO *btmp; |
| 114 | LHASH_OF(CONF_VALUE) *ltmp; | 114 | LHASH_OF(CONF_VALUE) *ltmp; |
| 115 | if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { | 115 | |
| 116 | CONFerr(CONF_F_CONF_LOAD_FP,ERR_R_BUF_LIB); | 116 | if (!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { |
| 117 | CONFerr(CONF_F_CONF_LOAD_FP, ERR_R_BUF_LIB); | ||
| 117 | return NULL; | 118 | return NULL; |
| 118 | } | 119 | } |
| 119 | ltmp = CONF_load_bio(conf, btmp, eline); | 120 | ltmp = CONF_load_bio(conf, btmp, eline); |
| 120 | BIO_free(btmp); | 121 | BIO_free(btmp); |
| 121 | return ltmp; | 122 | return ltmp; |
| 122 | } | 123 | } |
| 123 | #endif | 124 | #endif |
| 124 | 125 | ||
| 125 | LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, | 126 | LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, |
| 126 | long *eline) | 127 | long *eline) |
| 127 | { | 128 | { |
| 128 | CONF ctmp; | 129 | CONF ctmp; |
| 129 | int ret; | 130 | int ret; |
| 130 | 131 | ||
| @@ -134,92 +135,89 @@ LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp, | |||
| 134 | if (ret) | 135 | if (ret) |
| 135 | return ctmp.data; | 136 | return ctmp.data; |
| 136 | return NULL; | 137 | return NULL; |
| 137 | } | 138 | } |
| 138 | 139 | ||
| 139 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, | 140 | STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf, |
| 140 | const char *section) | 141 | const char *section) |
| 141 | { | 142 | { |
| 142 | if (conf == NULL) | 143 | if (conf == NULL) { |
| 143 | { | ||
| 144 | return NULL; | 144 | return NULL; |
| 145 | } | 145 | } else { |
| 146 | else | ||
| 147 | { | ||
| 148 | CONF ctmp; | 146 | CONF ctmp; |
| 149 | CONF_set_nconf(&ctmp, conf); | 147 | CONF_set_nconf(&ctmp, conf); |
| 150 | return NCONF_get_section(&ctmp, section); | 148 | return NCONF_get_section(&ctmp, section); |
| 151 | } | ||
| 152 | } | 149 | } |
| 150 | } | ||
| 153 | 151 | ||
| 154 | char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf,const char *group, | 152 | char * |
| 155 | const char *name) | 153 | CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, |
| 156 | { | 154 | const char *name) |
| 157 | if (conf == NULL) | 155 | { |
| 158 | { | 156 | if (conf == NULL) { |
| 159 | return NCONF_get_string(NULL, group, name); | 157 | return NCONF_get_string(NULL, group, name); |
| 160 | } | 158 | } else { |
| 161 | else | ||
| 162 | { | ||
| 163 | CONF ctmp; | 159 | CONF ctmp; |
| 164 | CONF_set_nconf(&ctmp, conf); | 160 | CONF_set_nconf(&ctmp, conf); |
| 165 | return NCONF_get_string(&ctmp, group, name); | 161 | return NCONF_get_string(&ctmp, group, name); |
| 166 | } | ||
| 167 | } | 162 | } |
| 163 | } | ||
| 168 | 164 | ||
| 169 | long CONF_get_number(LHASH_OF(CONF_VALUE) *conf,const char *group, | 165 | long |
| 170 | const char *name) | 166 | CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, |
| 171 | { | 167 | const char *name) |
| 168 | { | ||
| 172 | int status; | 169 | int status; |
| 173 | long result = 0; | 170 | long result = 0; |
| 174 | 171 | ||
| 175 | if (conf == NULL) | 172 | if (conf == NULL) { |
| 176 | { | ||
| 177 | status = NCONF_get_number_e(NULL, group, name, &result); | 173 | status = NCONF_get_number_e(NULL, group, name, &result); |
| 178 | } | 174 | } else { |
| 179 | else | ||
| 180 | { | ||
| 181 | CONF ctmp; | 175 | CONF ctmp; |
| 182 | CONF_set_nconf(&ctmp, conf); | 176 | CONF_set_nconf(&ctmp, conf); |
| 183 | status = NCONF_get_number_e(&ctmp, group, name, &result); | 177 | status = NCONF_get_number_e(&ctmp, group, name, &result); |
| 184 | } | 178 | } |
| 185 | 179 | ||
| 186 | if (status == 0) | 180 | if (status == 0) { |
| 187 | { | ||
| 188 | /* This function does not believe in errors... */ | 181 | /* This function does not believe in errors... */ |
| 189 | ERR_clear_error(); | 182 | ERR_clear_error(); |
| 190 | } | ||
| 191 | return result; | ||
| 192 | } | 183 | } |
| 184 | return result; | ||
| 185 | } | ||
| 193 | 186 | ||
| 194 | void CONF_free(LHASH_OF(CONF_VALUE) *conf) | 187 | void |
| 195 | { | 188 | CONF_free(LHASH_OF(CONF_VALUE) *conf) |
| 189 | { | ||
| 196 | CONF ctmp; | 190 | CONF ctmp; |
| 191 | |||
| 197 | CONF_set_nconf(&ctmp, conf); | 192 | CONF_set_nconf(&ctmp, conf); |
| 198 | NCONF_free_data(&ctmp); | 193 | NCONF_free_data(&ctmp); |
| 199 | } | 194 | } |
| 200 | 195 | ||
| 201 | #ifndef OPENSSL_NO_FP_API | 196 | #ifndef OPENSSL_NO_FP_API |
| 202 | int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out) | 197 | int |
| 203 | { | 198 | CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out) |
| 199 | { | ||
| 204 | BIO *btmp; | 200 | BIO *btmp; |
| 205 | int ret; | 201 | int ret; |
| 206 | 202 | ||
| 207 | if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { | 203 | if (!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { |
| 208 | CONFerr(CONF_F_CONF_DUMP_FP,ERR_R_BUF_LIB); | 204 | CONFerr(CONF_F_CONF_DUMP_FP, ERR_R_BUF_LIB); |
| 209 | return 0; | 205 | return 0; |
| 210 | } | 206 | } |
| 211 | ret = CONF_dump_bio(conf, btmp); | 207 | ret = CONF_dump_bio(conf, btmp); |
| 212 | BIO_free(btmp); | 208 | BIO_free(btmp); |
| 213 | return ret; | 209 | return ret; |
| 214 | } | 210 | } |
| 215 | #endif | 211 | #endif |
| 216 | 212 | ||
| 217 | int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out) | 213 | int |
| 218 | { | 214 | CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out) |
| 215 | { | ||
| 219 | CONF ctmp; | 216 | CONF ctmp; |
| 217 | |||
| 220 | CONF_set_nconf(&ctmp, conf); | 218 | CONF_set_nconf(&ctmp, conf); |
| 221 | return NCONF_dump_bio(&ctmp, out); | 219 | return NCONF_dump_bio(&ctmp, out); |
| 222 | } | 220 | } |
| 223 | 221 | ||
| 224 | /* The following section contains the "New CONF" functions. They are | 222 | /* The following section contains the "New CONF" functions. They are |
| 225 | completely centralised around a new CONF structure that may contain | 223 | completely centralised around a new CONF structure that may contain |
| @@ -227,177 +225,179 @@ int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out) | |||
| 227 | These functions are also written in terms of the bridge functions used | 225 | These functions are also written in terms of the bridge functions used |
| 228 | by the "CONF classic" functions, for consistency. */ | 226 | by the "CONF classic" functions, for consistency. */ |
| 229 | 227 | ||
| 230 | CONF *NCONF_new(CONF_METHOD *meth) | 228 | CONF * |
| 231 | { | 229 | NCONF_new(CONF_METHOD *meth) |
| 230 | { | ||
| 232 | CONF *ret; | 231 | CONF *ret; |
| 233 | 232 | ||
| 234 | if (meth == NULL) | 233 | if (meth == NULL) |
| 235 | meth = NCONF_default(); | 234 | meth = NCONF_default(); |
| 236 | 235 | ||
| 237 | ret = meth->create(meth); | 236 | ret = meth->create(meth); |
| 238 | if (ret == NULL) | 237 | if (ret == NULL) { |
| 239 | { | 238 | CONFerr(CONF_F_NCONF_NEW, ERR_R_MALLOC_FAILURE); |
| 240 | CONFerr(CONF_F_NCONF_NEW,ERR_R_MALLOC_FAILURE); | 239 | return (NULL); |
| 241 | return(NULL); | 240 | } |
| 242 | } | ||
| 243 | 241 | ||
| 244 | return ret; | 242 | return ret; |
| 245 | } | 243 | } |
| 246 | 244 | ||
| 247 | void NCONF_free(CONF *conf) | 245 | void |
| 248 | { | 246 | NCONF_free(CONF *conf) |
| 247 | { | ||
| 249 | if (conf == NULL) | 248 | if (conf == NULL) |
| 250 | return; | 249 | return; |
| 251 | conf->meth->destroy(conf); | 250 | conf->meth->destroy(conf); |
| 252 | } | 251 | } |
| 253 | 252 | ||
| 254 | void NCONF_free_data(CONF *conf) | 253 | void |
| 255 | { | 254 | NCONF_free_data(CONF *conf) |
| 255 | { | ||
| 256 | if (conf == NULL) | 256 | if (conf == NULL) |
| 257 | return; | 257 | return; |
| 258 | conf->meth->destroy_data(conf); | 258 | conf->meth->destroy_data(conf); |
| 259 | } | 259 | } |
| 260 | 260 | ||
| 261 | int NCONF_load(CONF *conf, const char *file, long *eline) | 261 | int |
| 262 | { | 262 | NCONF_load(CONF *conf, const char *file, long *eline) |
| 263 | if (conf == NULL) | 263 | { |
| 264 | { | 264 | if (conf == NULL) { |
| 265 | CONFerr(CONF_F_NCONF_LOAD,CONF_R_NO_CONF); | 265 | CONFerr(CONF_F_NCONF_LOAD, CONF_R_NO_CONF); |
| 266 | return 0; | 266 | return 0; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | return conf->meth->load(conf, file, eline); | 269 | return conf->meth->load(conf, file, eline); |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | #ifndef OPENSSL_NO_FP_API | 272 | #ifndef OPENSSL_NO_FP_API |
| 273 | int NCONF_load_fp(CONF *conf, FILE *fp,long *eline) | 273 | int |
| 274 | { | 274 | NCONF_load_fp(CONF *conf, FILE *fp, long *eline) |
| 275 | { | ||
| 275 | BIO *btmp; | 276 | BIO *btmp; |
| 276 | int ret; | 277 | int ret; |
| 277 | if(!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) | 278 | |
| 278 | { | 279 | if (!(btmp = BIO_new_fp(fp, BIO_NOCLOSE))) { |
| 279 | CONFerr(CONF_F_NCONF_LOAD_FP,ERR_R_BUF_LIB); | 280 | CONFerr(CONF_F_NCONF_LOAD_FP, ERR_R_BUF_LIB); |
| 280 | return 0; | 281 | return 0; |
| 281 | } | 282 | } |
| 282 | ret = NCONF_load_bio(conf, btmp, eline); | 283 | ret = NCONF_load_bio(conf, btmp, eline); |
| 283 | BIO_free(btmp); | 284 | BIO_free(btmp); |
| 284 | return ret; | 285 | return ret; |
| 285 | } | 286 | } |
| 286 | #endif | 287 | #endif |
| 287 | 288 | ||
| 288 | int NCONF_load_bio(CONF *conf, BIO *bp,long *eline) | 289 | int |
| 289 | { | 290 | NCONF_load_bio(CONF *conf, BIO *bp, long *eline) |
| 290 | if (conf == NULL) | 291 | { |
| 291 | { | 292 | if (conf == NULL) { |
| 292 | CONFerr(CONF_F_NCONF_LOAD_BIO,CONF_R_NO_CONF); | 293 | CONFerr(CONF_F_NCONF_LOAD_BIO, CONF_R_NO_CONF); |
| 293 | return 0; | 294 | return 0; |
| 294 | } | 295 | } |
| 295 | 296 | ||
| 296 | return conf->meth->load_bio(conf, bp, eline); | 297 | return conf->meth->load_bio(conf, bp, eline); |
| 297 | } | 298 | } |
| 298 | 299 | ||
| 299 | STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section) | 300 | STACK_OF(CONF_VALUE) * |
| 300 | { | 301 | NCONF_get_section(const CONF *conf, const char *section) |
| 301 | if (conf == NULL) | 302 | { |
| 302 | { | 303 | if (conf == NULL) { |
| 303 | CONFerr(CONF_F_NCONF_GET_SECTION,CONF_R_NO_CONF); | 304 | CONFerr(CONF_F_NCONF_GET_SECTION, CONF_R_NO_CONF); |
| 304 | return NULL; | 305 | return NULL; |
| 305 | } | 306 | } |
| 306 | 307 | ||
| 307 | if (section == NULL) | 308 | if (section == NULL) { |
| 308 | { | 309 | CONFerr(CONF_F_NCONF_GET_SECTION, CONF_R_NO_SECTION); |
| 309 | CONFerr(CONF_F_NCONF_GET_SECTION,CONF_R_NO_SECTION); | ||
| 310 | return NULL; | 310 | return NULL; |
| 311 | } | 311 | } |
| 312 | 312 | ||
| 313 | return _CONF_get_section_values(conf, section); | 313 | return _CONF_get_section_values(conf, section); |
| 314 | } | 314 | } |
| 315 | 315 | ||
| 316 | char *NCONF_get_string(const CONF *conf,const char *group,const char *name) | 316 | char * |
| 317 | { | 317 | NCONF_get_string(const CONF *conf, const char *group, const char *name) |
| 318 | { | ||
| 318 | char *s = _CONF_get_string(conf, group, name); | 319 | char *s = _CONF_get_string(conf, group, name); |
| 319 | 320 | ||
| 320 | /* Since we may get a value from an environment variable even | 321 | /* Since we may get a value from an environment variable even |
| 321 | if conf is NULL, let's check the value first */ | 322 | if conf is NULL, let's check the value first */ |
| 322 | if (s) return s; | 323 | if (s) |
| 324 | return s; | ||
| 323 | 325 | ||
| 324 | if (conf == NULL) | 326 | if (conf == NULL) { |
| 325 | { | ||
| 326 | CONFerr(CONF_F_NCONF_GET_STRING, | 327 | CONFerr(CONF_F_NCONF_GET_STRING, |
| 327 | CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE); | 328 | CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE); |
| 328 | return NULL; | 329 | return NULL; |
| 329 | } | ||
| 330 | CONFerr(CONF_F_NCONF_GET_STRING, | ||
| 331 | CONF_R_NO_VALUE); | ||
| 332 | ERR_add_error_data(4,"group=",group," name=",name); | ||
| 333 | return NULL; | ||
| 334 | } | 330 | } |
| 331 | CONFerr(CONF_F_NCONF_GET_STRING, CONF_R_NO_VALUE); | ||
| 332 | ERR_add_error_data(4, "group=", group, " name=", name); | ||
| 333 | return NULL; | ||
| 334 | } | ||
| 335 | 335 | ||
| 336 | int NCONF_get_number_e(const CONF *conf,const char *group,const char *name, | 336 | int |
| 337 | long *result) | 337 | NCONF_get_number_e(const CONF *conf, const char *group, const char *name, |
| 338 | { | 338 | long *result) |
| 339 | { | ||
| 339 | char *str; | 340 | char *str; |
| 340 | 341 | ||
| 341 | if (result == NULL) | 342 | if (result == NULL) { |
| 342 | { | 343 | CONFerr(CONF_F_NCONF_GET_NUMBER_E, ERR_R_PASSED_NULL_PARAMETER); |
| 343 | CONFerr(CONF_F_NCONF_GET_NUMBER_E,ERR_R_PASSED_NULL_PARAMETER); | ||
| 344 | return 0; | 344 | return 0; |
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | str = NCONF_get_string(conf,group,name); | 347 | str = NCONF_get_string(conf, group, name); |
| 348 | 348 | ||
| 349 | if (str == NULL) | 349 | if (str == NULL) |
| 350 | return 0; | 350 | return 0; |
| 351 | 351 | ||
| 352 | for (*result = 0;conf->meth->is_number(conf, *str);) | 352 | for (*result = 0; conf->meth->is_number(conf, *str); ) { |
| 353 | { | 353 | *result = (*result) * 10 + conf->meth->to_int(conf, *str); |
| 354 | *result = (*result)*10 + conf->meth->to_int(conf, *str); | ||
| 355 | str++; | 354 | str++; |
| 356 | } | 355 | } |
| 357 | 356 | ||
| 358 | return 1; | 357 | return 1; |
| 359 | } | 358 | } |
| 360 | 359 | ||
| 361 | #ifndef OPENSSL_NO_FP_API | 360 | #ifndef OPENSSL_NO_FP_API |
| 362 | int NCONF_dump_fp(const CONF *conf, FILE *out) | 361 | int |
| 363 | { | 362 | NCONF_dump_fp(const CONF *conf, FILE *out) |
| 363 | { | ||
| 364 | BIO *btmp; | 364 | BIO *btmp; |
| 365 | int ret; | 365 | int ret; |
| 366 | if(!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { | 366 | if (!(btmp = BIO_new_fp(out, BIO_NOCLOSE))) { |
| 367 | CONFerr(CONF_F_NCONF_DUMP_FP,ERR_R_BUF_LIB); | 367 | CONFerr(CONF_F_NCONF_DUMP_FP, ERR_R_BUF_LIB); |
| 368 | return 0; | 368 | return 0; |
| 369 | } | 369 | } |
| 370 | ret = NCONF_dump_bio(conf, btmp); | 370 | ret = NCONF_dump_bio(conf, btmp); |
| 371 | BIO_free(btmp); | 371 | BIO_free(btmp); |
| 372 | return ret; | 372 | return ret; |
| 373 | } | 373 | } |
| 374 | #endif | 374 | #endif |
| 375 | 375 | ||
| 376 | int NCONF_dump_bio(const CONF *conf, BIO *out) | 376 | int |
| 377 | { | 377 | NCONF_dump_bio(const CONF *conf, BIO *out) |
| 378 | if (conf == NULL) | 378 | { |
| 379 | { | 379 | if (conf == NULL) { |
| 380 | CONFerr(CONF_F_NCONF_DUMP_BIO,CONF_R_NO_CONF); | 380 | CONFerr(CONF_F_NCONF_DUMP_BIO, CONF_R_NO_CONF); |
| 381 | return 0; | 381 | return 0; |
| 382 | } | 382 | } |
| 383 | 383 | ||
| 384 | return conf->meth->dump(conf, out); | 384 | return conf->meth->dump(conf, out); |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | 387 | ||
| 388 | /* This function should be avoided */ | 388 | /* This function should be avoided */ |
| 389 | #if 0 | 389 | #if 0 |
| 390 | long NCONF_get_number(CONF *conf,char *group,char *name) | 390 | long |
| 391 | { | 391 | NCONF_get_number(CONF *conf, char *group, char *name) |
| 392 | { | ||
| 392 | int status; | 393 | int status; |
| 393 | long ret=0; | 394 | long ret = 0; |
| 394 | 395 | ||
| 395 | status = NCONF_get_number_e(conf, group, name, &ret); | 396 | status = NCONF_get_number_e(conf, group, name, &ret); |
| 396 | if (status == 0) | 397 | if (status == 0) { |
| 397 | { | ||
| 398 | /* This function does not believe in errors... */ | 398 | /* This function does not believe in errors... */ |
| 399 | ERR_get_error(); | 399 | ERR_get_error(); |
| 400 | } | ||
| 401 | return ret; | ||
| 402 | } | 400 | } |
| 401 | return ret; | ||
| 402 | } | ||
| 403 | #endif | 403 | #endif |
diff --git a/src/lib/libssl/src/crypto/conf/conf_mall.c b/src/lib/libssl/src/crypto/conf/conf_mall.c index c6f4cb2d55..8454d26fa8 100644 --- a/src/lib/libssl/src/crypto/conf/conf_mall.c +++ b/src/lib/libssl/src/crypto/conf/conf_mall.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * are met: | 10 | * are met: |
| 11 | * | 11 | * |
| 12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * | 14 | * |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
| @@ -69,12 +69,12 @@ | |||
| 69 | 69 | ||
| 70 | /* Load all OpenSSL builtin modules */ | 70 | /* Load all OpenSSL builtin modules */ |
| 71 | 71 | ||
| 72 | void OPENSSL_load_builtin_modules(void) | 72 | void |
| 73 | { | 73 | OPENSSL_load_builtin_modules(void) |
| 74 | { | ||
| 74 | /* Add builtin modules here */ | 75 | /* Add builtin modules here */ |
| 75 | ASN1_add_oid_module(); | 76 | ASN1_add_oid_module(); |
| 76 | #ifndef OPENSSL_NO_ENGINE | 77 | #ifndef OPENSSL_NO_ENGINE |
| 77 | ENGINE_add_conf_module(); | 78 | ENGINE_add_conf_module(); |
| 78 | #endif | 79 | #endif |
| 79 | } | 80 | } |
| 80 | |||
diff --git a/src/lib/libssl/src/crypto/conf/conf_mod.c b/src/lib/libssl/src/crypto/conf/conf_mod.c index af33451844..80266e43d8 100644 --- a/src/lib/libssl/src/crypto/conf/conf_mod.c +++ b/src/lib/libssl/src/crypto/conf/conf_mod.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * are met: | 10 | * are met: |
| 11 | * | 11 | * |
| 12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * | 14 | * |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
| @@ -74,20 +74,19 @@ | |||
| 74 | * static modules. | 74 | * static modules. |
| 75 | */ | 75 | */ |
| 76 | 76 | ||
| 77 | struct conf_module_st | 77 | struct conf_module_st { |
| 78 | { | ||
| 79 | /* DSO of this module or NULL if static */ | 78 | /* DSO of this module or NULL if static */ |
| 80 | DSO *dso; | 79 | DSO *dso; |
| 81 | /* Name of the module */ | 80 | /* Name of the module */ |
| 82 | char *name; | 81 | char *name; |
| 83 | /* Init function */ | 82 | /* Init function */ |
| 84 | conf_init_func *init; | 83 | conf_init_func *init; |
| 85 | /* Finish function */ | 84 | /* Finish function */ |
| 86 | conf_finish_func *finish; | 85 | conf_finish_func *finish; |
| 87 | /* Number of successfully initialized modules */ | 86 | /* Number of successfully initialized modules */ |
| 88 | int links; | 87 | int links; |
| 89 | void *usr_data; | 88 | void *usr_data; |
| 90 | }; | 89 | }; |
| 91 | 90 | ||
| 92 | 91 | ||
| 93 | /* This structure contains information about modules that have been | 92 | /* This structure contains information about modules that have been |
| @@ -95,14 +94,13 @@ struct conf_module_st | |||
| 95 | * given module. | 94 | * given module. |
| 96 | */ | 95 | */ |
| 97 | 96 | ||
| 98 | struct conf_imodule_st | 97 | struct conf_imodule_st { |
| 99 | { | ||
| 100 | CONF_MODULE *pmod; | 98 | CONF_MODULE *pmod; |
| 101 | char *name; | 99 | char *name; |
| 102 | char *value; | 100 | char *value; |
| 103 | unsigned long flags; | 101 | unsigned long flags; |
| 104 | void *usr_data; | 102 | void *usr_data; |
| 105 | }; | 103 | }; |
| 106 | 104 | ||
| 107 | static STACK_OF(CONF_MODULE) *supported_modules = NULL; | 105 | static STACK_OF(CONF_MODULE) *supported_modules = NULL; |
| 108 | static STACK_OF(CONF_IMODULE) *initialized_modules = NULL; | 106 | static STACK_OF(CONF_IMODULE) *initialized_modules = NULL; |
| @@ -110,20 +108,20 @@ static STACK_OF(CONF_IMODULE) *initialized_modules = NULL; | |||
| 110 | static void module_free(CONF_MODULE *md); | 108 | static void module_free(CONF_MODULE *md); |
| 111 | static void module_finish(CONF_IMODULE *imod); | 109 | static void module_finish(CONF_IMODULE *imod); |
| 112 | static int module_run(const CONF *cnf, char *name, char *value, | 110 | static int module_run(const CONF *cnf, char *name, char *value, |
| 113 | unsigned long flags); | 111 | unsigned long flags); |
| 114 | static CONF_MODULE *module_add(DSO *dso, const char *name, | 112 | static CONF_MODULE *module_add(DSO *dso, const char *name, |
| 115 | conf_init_func *ifunc, conf_finish_func *ffunc); | 113 | conf_init_func *ifunc, conf_finish_func *ffunc); |
| 116 | static CONF_MODULE *module_find(char *name); | 114 | static CONF_MODULE *module_find(char *name); |
| 117 | static int module_init(CONF_MODULE *pmod, char *name, char *value, | 115 | static int module_init(CONF_MODULE *pmod, char *name, char *value, |
| 118 | const CONF *cnf); | 116 | const CONF *cnf); |
| 119 | static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, | 117 | static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, |
| 120 | unsigned long flags); | 118 | unsigned long flags); |
| 121 | 119 | ||
| 122 | /* Main function: load modules from a CONF structure */ | 120 | /* Main function: load modules from a CONF structure */ |
| 123 | 121 | ||
| 124 | int CONF_modules_load(const CONF *cnf, const char *appname, | 122 | int |
| 125 | unsigned long flags) | 123 | CONF_modules_load(const CONF *cnf, const char *appname, unsigned long flags) |
| 126 | { | 124 | { |
| 127 | STACK_OF(CONF_VALUE) *values; | 125 | STACK_OF(CONF_VALUE) *values; |
| 128 | CONF_VALUE *vl; | 126 | CONF_VALUE *vl; |
| 129 | char *vsection = NULL; | 127 | char *vsection = NULL; |
| @@ -139,33 +137,31 @@ int CONF_modules_load(const CONF *cnf, const char *appname, | |||
| 139 | if (!appname || (!vsection && (flags & CONF_MFLAGS_DEFAULT_SECTION))) | 137 | if (!appname || (!vsection && (flags & CONF_MFLAGS_DEFAULT_SECTION))) |
| 140 | vsection = NCONF_get_string(cnf, NULL, "openssl_conf"); | 138 | vsection = NCONF_get_string(cnf, NULL, "openssl_conf"); |
| 141 | 139 | ||
| 142 | if (!vsection) | 140 | if (!vsection) { |
| 143 | { | ||
| 144 | ERR_clear_error(); | 141 | ERR_clear_error(); |
| 145 | return 1; | 142 | return 1; |
| 146 | } | 143 | } |
| 147 | 144 | ||
| 148 | values = NCONF_get_section(cnf, vsection); | 145 | values = NCONF_get_section(cnf, vsection); |
| 149 | 146 | ||
| 150 | if (!values) | 147 | if (!values) |
| 151 | return 0; | 148 | return 0; |
| 152 | 149 | ||
| 153 | for (i = 0; i < sk_CONF_VALUE_num(values); i++) | 150 | for (i = 0; i < sk_CONF_VALUE_num(values); i++) { |
| 154 | { | ||
| 155 | vl = sk_CONF_VALUE_value(values, i); | 151 | vl = sk_CONF_VALUE_value(values, i); |
| 156 | ret = module_run(cnf, vl->name, vl->value, flags); | 152 | ret = module_run(cnf, vl->name, vl->value, flags); |
| 157 | if (ret <= 0) | 153 | if (ret <= 0) |
| 158 | if(!(flags & CONF_MFLAGS_IGNORE_ERRORS)) | 154 | if (!(flags & CONF_MFLAGS_IGNORE_ERRORS)) |
| 159 | return ret; | 155 | return ret; |
| 160 | } | 156 | } |
| 161 | 157 | ||
| 162 | return 1; | 158 | return 1; |
| 159 | } | ||
| 163 | 160 | ||
| 164 | } | 161 | int |
| 165 | 162 | CONF_modules_load_file(const char *filename, const char *appname, | |
| 166 | int CONF_modules_load_file(const char *filename, const char *appname, | 163 | unsigned long flags) |
| 167 | unsigned long flags) | 164 | { |
| 168 | { | ||
| 169 | char *file = NULL; | 165 | char *file = NULL; |
| 170 | CONF *conf = NULL; | 166 | CONF *conf = NULL; |
| 171 | int ret = 0; | 167 | int ret = 0; |
| @@ -173,39 +169,36 @@ int CONF_modules_load_file(const char *filename, const char *appname, | |||
| 173 | if (!conf) | 169 | if (!conf) |
| 174 | goto err; | 170 | goto err; |
| 175 | 171 | ||
| 176 | if (filename == NULL) | 172 | if (filename == NULL) { |
| 177 | { | ||
| 178 | file = CONF_get1_default_config_file(); | 173 | file = CONF_get1_default_config_file(); |
| 179 | if (!file) | 174 | if (!file) |
| 180 | goto err; | 175 | goto err; |
| 181 | } | 176 | } else |
| 182 | else | ||
| 183 | file = (char *)filename; | 177 | file = (char *)filename; |
| 184 | 178 | ||
| 185 | if (NCONF_load(conf, file, NULL) <= 0) | 179 | if (NCONF_load(conf, file, NULL) <= 0) { |
| 186 | { | ||
| 187 | if ((flags & CONF_MFLAGS_IGNORE_MISSING_FILE) && | 180 | if ((flags & CONF_MFLAGS_IGNORE_MISSING_FILE) && |
| 188 | (ERR_GET_REASON(ERR_peek_last_error()) == CONF_R_NO_SUCH_FILE)) | 181 | (ERR_GET_REASON(ERR_peek_last_error()) == |
| 189 | { | 182 | CONF_R_NO_SUCH_FILE)) { |
| 190 | ERR_clear_error(); | 183 | ERR_clear_error(); |
| 191 | ret = 1; | 184 | ret = 1; |
| 192 | } | ||
| 193 | goto err; | ||
| 194 | } | 185 | } |
| 186 | goto err; | ||
| 187 | } | ||
| 195 | 188 | ||
| 196 | ret = CONF_modules_load(conf, appname, flags); | 189 | ret = CONF_modules_load(conf, appname, flags); |
| 197 | 190 | ||
| 198 | err: | 191 | err: |
| 199 | if (filename == NULL) | 192 | if (filename == NULL) |
| 200 | free(file); | 193 | free(file); |
| 201 | NCONF_free(conf); | 194 | NCONF_free(conf); |
| 202 | 195 | ||
| 203 | return ret; | 196 | return ret; |
| 204 | } | 197 | } |
| 205 | 198 | ||
| 206 | static int module_run(const CONF *cnf, char *name, char *value, | 199 | static int |
| 207 | unsigned long flags) | 200 | module_run(const CONF *cnf, char *name, char *value, unsigned long flags) |
| 208 | { | 201 | { |
| 209 | CONF_MODULE *md; | 202 | CONF_MODULE *md; |
| 210 | int ret; | 203 | int ret; |
| 211 | 204 | ||
| @@ -215,62 +208,58 @@ static int module_run(const CONF *cnf, char *name, char *value, | |||
| 215 | if (!md && !(flags & CONF_MFLAGS_NO_DSO)) | 208 | if (!md && !(flags & CONF_MFLAGS_NO_DSO)) |
| 216 | md = module_load_dso(cnf, name, value, flags); | 209 | md = module_load_dso(cnf, name, value, flags); |
| 217 | 210 | ||
| 218 | if (!md) | 211 | if (!md) { |
| 219 | { | 212 | if (!(flags & CONF_MFLAGS_SILENT)) { |
| 220 | if (!(flags & CONF_MFLAGS_SILENT)) | ||
| 221 | { | ||
| 222 | CONFerr(CONF_F_MODULE_RUN, CONF_R_UNKNOWN_MODULE_NAME); | 213 | CONFerr(CONF_F_MODULE_RUN, CONF_R_UNKNOWN_MODULE_NAME); |
| 223 | ERR_add_error_data(2, "module=", name); | 214 | ERR_add_error_data(2, "module=", name); |
| 224 | } | ||
| 225 | return -1; | ||
| 226 | } | 215 | } |
| 216 | return -1; | ||
| 217 | } | ||
| 227 | 218 | ||
| 228 | ret = module_init(md, name, value, cnf); | 219 | ret = module_init(md, name, value, cnf); |
| 229 | 220 | ||
| 230 | if (ret <= 0) | 221 | if (ret <= 0) { |
| 231 | { | 222 | if (!(flags & CONF_MFLAGS_SILENT)) { |
| 232 | if (!(flags & CONF_MFLAGS_SILENT)) | 223 | char rcode[DECIMAL_SIZE(ret) + 1]; |
| 233 | { | 224 | CONFerr(CONF_F_MODULE_RUN, |
| 234 | char rcode[DECIMAL_SIZE(ret)+1]; | 225 | CONF_R_MODULE_INITIALIZATION_ERROR); |
| 235 | CONFerr(CONF_F_MODULE_RUN, CONF_R_MODULE_INITIALIZATION_ERROR); | ||
| 236 | snprintf(rcode, sizeof rcode, "%-8d", ret); | 226 | snprintf(rcode, sizeof rcode, "%-8d", ret); |
| 237 | ERR_add_error_data(6, "module=", name, ", value=", value, ", retcode=", rcode); | 227 | ERR_add_error_data(6, "module=", name, ", value=", |
| 238 | } | 228 | value, ", retcode=", rcode); |
| 239 | } | 229 | } |
| 230 | } | ||
| 240 | 231 | ||
| 241 | return ret; | 232 | return ret; |
| 242 | } | 233 | } |
| 243 | 234 | ||
| 244 | /* Load a module from a DSO */ | 235 | /* Load a module from a DSO */ |
| 245 | static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, | 236 | static CONF_MODULE * |
| 246 | unsigned long flags) | 237 | module_load_dso(const CONF *cnf, char *name, char *value, unsigned long flags) |
| 247 | { | 238 | { |
| 248 | DSO *dso = NULL; | 239 | DSO *dso = NULL; |
| 249 | conf_init_func *ifunc; | 240 | conf_init_func *ifunc; |
| 250 | conf_finish_func *ffunc; | 241 | conf_finish_func *ffunc; |
| 251 | char *path = NULL; | 242 | char *path = NULL; |
| 252 | int errcode = 0; | 243 | int errcode = 0; |
| 253 | CONF_MODULE *md; | 244 | CONF_MODULE *md; |
| 245 | |||
| 254 | /* Look for alternative path in module section */ | 246 | /* Look for alternative path in module section */ |
| 255 | path = NCONF_get_string(cnf, value, "path"); | 247 | path = NCONF_get_string(cnf, value, "path"); |
| 256 | if (!path) | 248 | if (!path) { |
| 257 | { | ||
| 258 | ERR_clear_error(); | 249 | ERR_clear_error(); |
| 259 | path = name; | 250 | path = name; |
| 260 | } | 251 | } |
| 261 | dso = DSO_load(NULL, path, NULL, 0); | 252 | dso = DSO_load(NULL, path, NULL, 0); |
| 262 | if (!dso) | 253 | if (!dso) { |
| 263 | { | ||
| 264 | errcode = CONF_R_ERROR_LOADING_DSO; | 254 | errcode = CONF_R_ERROR_LOADING_DSO; |
| 265 | goto err; | 255 | goto err; |
| 266 | } | 256 | } |
| 267 | ifunc = (conf_init_func *)DSO_bind_func(dso, DSO_mod_init_name); | 257 | ifunc = (conf_init_func *)DSO_bind_func(dso, DSO_mod_init_name); |
| 268 | if (!ifunc) | 258 | if (!ifunc) { |
| 269 | { | ||
| 270 | errcode = CONF_R_MISSING_INIT_FUNCTION; | 259 | errcode = CONF_R_MISSING_INIT_FUNCTION; |
| 271 | goto err; | 260 | goto err; |
| 272 | } | 261 | } |
| 273 | ffunc = (conf_finish_func *)DSO_bind_func(dso, DSO_mod_finish_name); | 262 | ffunc = (conf_finish_func *)DSO_bind_func(dso, DSO_mod_finish_name); |
| 274 | /* All OK, add module */ | 263 | /* All OK, add module */ |
| 275 | md = module_add(dso, name, ifunc, ffunc); | 264 | md = module_add(dso, name, ifunc, ffunc); |
| 276 | 265 | ||
| @@ -279,19 +268,21 @@ static CONF_MODULE *module_load_dso(const CONF *cnf, char *name, char *value, | |||
| 279 | 268 | ||
| 280 | return md; | 269 | return md; |
| 281 | 270 | ||
| 282 | err: | 271 | err: |
| 283 | if (dso) | 272 | if (dso) |
| 284 | DSO_free(dso); | 273 | DSO_free(dso); |
| 285 | CONFerr(CONF_F_MODULE_LOAD_DSO, errcode); | 274 | CONFerr(CONF_F_MODULE_LOAD_DSO, errcode); |
| 286 | ERR_add_error_data(4, "module=", name, ", path=", path); | 275 | ERR_add_error_data(4, "module=", name, ", path=", path); |
| 287 | return NULL; | 276 | return NULL; |
| 288 | } | 277 | } |
| 289 | 278 | ||
| 290 | /* add module to list */ | 279 | /* add module to list */ |
| 291 | static CONF_MODULE *module_add(DSO *dso, const char *name, | 280 | static CONF_MODULE * |
| 292 | conf_init_func *ifunc, conf_finish_func *ffunc) | 281 | module_add(DSO *dso, const char *name, conf_init_func *ifunc, |
| 293 | { | 282 | conf_finish_func *ffunc) |
| 283 | { | ||
| 294 | CONF_MODULE *tmod = NULL; | 284 | CONF_MODULE *tmod = NULL; |
| 285 | |||
| 295 | if (supported_modules == NULL) | 286 | if (supported_modules == NULL) |
| 296 | supported_modules = sk_CONF_MODULE_new_null(); | 287 | supported_modules = sk_CONF_MODULE_new_null(); |
| 297 | if (supported_modules == NULL) | 288 | if (supported_modules == NULL) |
| @@ -306,47 +297,46 @@ static CONF_MODULE *module_add(DSO *dso, const char *name, | |||
| 306 | tmod->finish = ffunc; | 297 | tmod->finish = ffunc; |
| 307 | tmod->links = 0; | 298 | tmod->links = 0; |
| 308 | 299 | ||
| 309 | if (!sk_CONF_MODULE_push(supported_modules, tmod)) | 300 | if (!sk_CONF_MODULE_push(supported_modules, tmod)) { |
| 310 | { | ||
| 311 | free(tmod); | 301 | free(tmod); |
| 312 | return NULL; | 302 | return NULL; |
| 313 | } | 303 | } |
| 314 | 304 | ||
| 315 | return tmod; | 305 | return tmod; |
| 316 | } | 306 | } |
| 317 | 307 | ||
| 318 | /* Find a module from the list. We allow module names of the | 308 | /* Find a module from the list. We allow module names of the |
| 319 | * form modname.XXXX to just search for modname to allow the | 309 | * form modname.XXXX to just search for modname to allow the |
| 320 | * same module to be initialized more than once. | 310 | * same module to be initialized more than once. |
| 321 | */ | 311 | */ |
| 322 | 312 | ||
| 323 | static CONF_MODULE *module_find(char *name) | 313 | static CONF_MODULE * |
| 324 | { | 314 | module_find(char *name) |
| 315 | { | ||
| 325 | CONF_MODULE *tmod; | 316 | CONF_MODULE *tmod; |
| 326 | int i, nchar; | 317 | int i, nchar; |
| 327 | char *p; | 318 | char *p; |
| 319 | |||
| 328 | p = strrchr(name, '.'); | 320 | p = strrchr(name, '.'); |
| 329 | 321 | ||
| 330 | if (p) | 322 | if (p) |
| 331 | nchar = p - name; | 323 | nchar = p - name; |
| 332 | else | 324 | else |
| 333 | nchar = strlen(name); | 325 | nchar = strlen(name); |
| 334 | 326 | ||
| 335 | for (i = 0; i < sk_CONF_MODULE_num(supported_modules); i++) | 327 | for (i = 0; i < sk_CONF_MODULE_num(supported_modules); i++) { |
| 336 | { | ||
| 337 | tmod = sk_CONF_MODULE_value(supported_modules, i); | 328 | tmod = sk_CONF_MODULE_value(supported_modules, i); |
| 338 | if (!strncmp(tmod->name, name, nchar)) | 329 | if (!strncmp(tmod->name, name, nchar)) |
| 339 | return tmod; | 330 | return tmod; |
| 340 | } | 331 | } |
| 341 | 332 | ||
| 342 | return NULL; | 333 | return NULL; |
| 343 | 334 | } | |
| 344 | } | ||
| 345 | 335 | ||
| 346 | /* initialize a module */ | 336 | /* initialize a module */ |
| 347 | static int module_init(CONF_MODULE *pmod, char *name, char *value, | 337 | static int |
| 348 | const CONF *cnf) | 338 | module_init(CONF_MODULE *pmod, char *name, char *value, const CONF *cnf) |
| 349 | { | 339 | { |
| 350 | int ret = 1; | 340 | int ret = 1; |
| 351 | int init_called = 0; | 341 | int init_called = 0; |
| 352 | CONF_IMODULE *imod = NULL; | 342 | CONF_IMODULE *imod = NULL; |
| @@ -365,68 +355,63 @@ static int module_init(CONF_MODULE *pmod, char *name, char *value, | |||
| 365 | goto memerr; | 355 | goto memerr; |
| 366 | 356 | ||
| 367 | /* Try to initialize module */ | 357 | /* Try to initialize module */ |
| 368 | if(pmod->init) | 358 | if (pmod->init) { |
| 369 | { | ||
| 370 | ret = pmod->init(imod, cnf); | 359 | ret = pmod->init(imod, cnf); |
| 371 | init_called = 1; | 360 | init_called = 1; |
| 372 | /* Error occurred, exit */ | 361 | /* Error occurred, exit */ |
| 373 | if (ret <= 0) | 362 | if (ret <= 0) |
| 374 | goto err; | 363 | goto err; |
| 375 | } | 364 | } |
| 376 | 365 | ||
| 377 | if (initialized_modules == NULL) | 366 | if (initialized_modules == NULL) { |
| 378 | { | ||
| 379 | initialized_modules = sk_CONF_IMODULE_new_null(); | 367 | initialized_modules = sk_CONF_IMODULE_new_null(); |
| 380 | if (!initialized_modules) | 368 | if (!initialized_modules) { |
| 381 | { | ||
| 382 | CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); | 369 | CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); |
| 383 | goto err; | 370 | goto err; |
| 384 | } | ||
| 385 | } | 371 | } |
| 372 | } | ||
| 386 | 373 | ||
| 387 | if (!sk_CONF_IMODULE_push(initialized_modules, imod)) | 374 | if (!sk_CONF_IMODULE_push(initialized_modules, imod)) { |
| 388 | { | ||
| 389 | CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); | 375 | CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); |
| 390 | goto err; | 376 | goto err; |
| 391 | } | 377 | } |
| 392 | 378 | ||
| 393 | pmod->links++; | 379 | pmod->links++; |
| 394 | 380 | ||
| 395 | return ret; | 381 | return ret; |
| 396 | 382 | ||
| 397 | err: | 383 | err: |
| 398 | |||
| 399 | /* We've started the module so we'd better finish it */ | 384 | /* We've started the module so we'd better finish it */ |
| 400 | if (pmod->finish && init_called) | 385 | if (pmod->finish && init_called) |
| 401 | pmod->finish(imod); | 386 | pmod->finish(imod); |
| 402 | 387 | ||
| 403 | memerr: | 388 | memerr: |
| 404 | if (imod) | 389 | if (imod) { |
| 405 | { | ||
| 406 | if (imod->name) | 390 | if (imod->name) |
| 407 | free(imod->name); | 391 | free(imod->name); |
| 408 | if (imod->value) | 392 | if (imod->value) |
| 409 | free(imod->value); | 393 | free(imod->value); |
| 410 | free(imod); | 394 | free(imod); |
| 411 | } | 395 | } |
| 412 | 396 | ||
| 413 | return -1; | 397 | return -1; |
| 414 | 398 | } | |
| 415 | } | ||
| 416 | 399 | ||
| 417 | /* Unload any dynamic modules that have a link count of zero: | 400 | /* Unload any dynamic modules that have a link count of zero: |
| 418 | * i.e. have no active initialized modules. If 'all' is set | 401 | * i.e. have no active initialized modules. If 'all' is set |
| 419 | * then all modules are unloaded including static ones. | 402 | * then all modules are unloaded including static ones. |
| 420 | */ | 403 | */ |
| 421 | 404 | ||
| 422 | void CONF_modules_unload(int all) | 405 | void |
| 423 | { | 406 | CONF_modules_unload(int all) |
| 407 | { | ||
| 424 | int i; | 408 | int i; |
| 425 | CONF_MODULE *md; | 409 | CONF_MODULE *md; |
| 410 | |||
| 426 | CONF_modules_finish(); | 411 | CONF_modules_finish(); |
| 412 | |||
| 427 | /* unload modules in reverse order */ | 413 | /* unload modules in reverse order */ |
| 428 | for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) | 414 | for (i = sk_CONF_MODULE_num(supported_modules) - 1; i >= 0; i--) { |
| 429 | { | ||
| 430 | md = sk_CONF_MODULE_value(supported_modules, i); | 415 | md = sk_CONF_MODULE_value(supported_modules, i); |
| 431 | /* If static or in use and 'all' not set ignore it */ | 416 | /* If static or in use and 'all' not set ignore it */ |
| 432 | if (((md->links > 0) || !md->dso) && !all) | 417 | if (((md->links > 0) || !md->dso) && !all) |
| @@ -434,112 +419,125 @@ void CONF_modules_unload(int all) | |||
| 434 | /* Since we're working in reverse this is OK */ | 419 | /* Since we're working in reverse this is OK */ |
| 435 | (void)sk_CONF_MODULE_delete(supported_modules, i); | 420 | (void)sk_CONF_MODULE_delete(supported_modules, i); |
| 436 | module_free(md); | 421 | module_free(md); |
| 437 | } | 422 | } |
| 438 | if (sk_CONF_MODULE_num(supported_modules) == 0) | 423 | if (sk_CONF_MODULE_num(supported_modules) == 0) { |
| 439 | { | ||
| 440 | sk_CONF_MODULE_free(supported_modules); | 424 | sk_CONF_MODULE_free(supported_modules); |
| 441 | supported_modules = NULL; | 425 | supported_modules = NULL; |
| 442 | } | ||
| 443 | } | 426 | } |
| 427 | } | ||
| 444 | 428 | ||
| 445 | /* unload a single module */ | 429 | /* unload a single module */ |
| 446 | static void module_free(CONF_MODULE *md) | 430 | static void |
| 447 | { | 431 | module_free(CONF_MODULE *md) |
| 432 | { | ||
| 448 | if (md->dso) | 433 | if (md->dso) |
| 449 | DSO_free(md->dso); | 434 | DSO_free(md->dso); |
| 450 | free(md->name); | 435 | free(md->name); |
| 451 | free(md); | 436 | free(md); |
| 452 | } | 437 | } |
| 453 | 438 | ||
| 454 | /* finish and free up all modules instances */ | 439 | /* finish and free up all modules instances */ |
| 455 | 440 | ||
| 456 | void CONF_modules_finish(void) | 441 | void |
| 457 | { | 442 | CONF_modules_finish(void) |
| 443 | { | ||
| 458 | CONF_IMODULE *imod; | 444 | CONF_IMODULE *imod; |
| 459 | while (sk_CONF_IMODULE_num(initialized_modules) > 0) | 445 | |
| 460 | { | 446 | while (sk_CONF_IMODULE_num(initialized_modules) > 0) { |
| 461 | imod = sk_CONF_IMODULE_pop(initialized_modules); | 447 | imod = sk_CONF_IMODULE_pop(initialized_modules); |
| 462 | module_finish(imod); | 448 | module_finish(imod); |
| 463 | } | 449 | } |
| 464 | sk_CONF_IMODULE_free(initialized_modules); | 450 | sk_CONF_IMODULE_free(initialized_modules); |
| 465 | initialized_modules = NULL; | 451 | initialized_modules = NULL; |
| 466 | } | 452 | } |
| 467 | 453 | ||
| 468 | /* finish a module instance */ | 454 | /* finish a module instance */ |
| 469 | 455 | ||
| 470 | static void module_finish(CONF_IMODULE *imod) | 456 | static void |
| 471 | { | 457 | module_finish(CONF_IMODULE *imod) |
| 458 | { | ||
| 472 | if (imod->pmod->finish) | 459 | if (imod->pmod->finish) |
| 473 | imod->pmod->finish(imod); | 460 | imod->pmod->finish(imod); |
| 474 | imod->pmod->links--; | 461 | imod->pmod->links--; |
| 475 | free(imod->name); | 462 | free(imod->name); |
| 476 | free(imod->value); | 463 | free(imod->value); |
| 477 | free(imod); | 464 | free(imod); |
| 478 | } | 465 | } |
| 479 | 466 | ||
| 480 | /* Add a static module to OpenSSL */ | 467 | /* Add a static module to OpenSSL */ |
| 481 | 468 | ||
| 482 | int CONF_module_add(const char *name, conf_init_func *ifunc, | 469 | int |
| 483 | conf_finish_func *ffunc) | 470 | CONF_module_add(const char *name, conf_init_func *ifunc, |
| 484 | { | 471 | conf_finish_func *ffunc) |
| 472 | { | ||
| 485 | if (module_add(NULL, name, ifunc, ffunc)) | 473 | if (module_add(NULL, name, ifunc, ffunc)) |
| 486 | return 1; | 474 | return 1; |
| 487 | else | 475 | else |
| 488 | return 0; | 476 | return 0; |
| 489 | } | 477 | } |
| 490 | 478 | ||
| 491 | void CONF_modules_free(void) | 479 | void |
| 492 | { | 480 | CONF_modules_free(void) |
| 481 | { | ||
| 493 | CONF_modules_finish(); | 482 | CONF_modules_finish(); |
| 494 | CONF_modules_unload(1); | 483 | CONF_modules_unload(1); |
| 495 | } | 484 | } |
| 496 | 485 | ||
| 497 | /* Utility functions */ | 486 | /* Utility functions */ |
| 498 | 487 | ||
| 499 | const char *CONF_imodule_get_name(const CONF_IMODULE *md) | 488 | const char * |
| 500 | { | 489 | CONF_imodule_get_name(const CONF_IMODULE *md) |
| 490 | { | ||
| 501 | return md->name; | 491 | return md->name; |
| 502 | } | 492 | } |
| 503 | 493 | ||
| 504 | const char *CONF_imodule_get_value(const CONF_IMODULE *md) | 494 | const char * |
| 505 | { | 495 | CONF_imodule_get_value(const CONF_IMODULE *md) |
| 496 | { | ||
| 506 | return md->value; | 497 | return md->value; |
| 507 | } | 498 | } |
| 508 | 499 | ||
| 509 | void *CONF_imodule_get_usr_data(const CONF_IMODULE *md) | 500 | void * |
| 510 | { | 501 | CONF_imodule_get_usr_data(const CONF_IMODULE *md) |
| 502 | { | ||
| 511 | return md->usr_data; | 503 | return md->usr_data; |
| 512 | } | 504 | } |
| 513 | 505 | ||
| 514 | void CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data) | 506 | void |
| 515 | { | 507 | CONF_imodule_set_usr_data(CONF_IMODULE *md, void *usr_data) |
| 508 | { | ||
| 516 | md->usr_data = usr_data; | 509 | md->usr_data = usr_data; |
| 517 | } | 510 | } |
| 518 | 511 | ||
| 519 | CONF_MODULE *CONF_imodule_get_module(const CONF_IMODULE *md) | 512 | CONF_MODULE * |
| 520 | { | 513 | CONF_imodule_get_module(const CONF_IMODULE *md) |
| 514 | { | ||
| 521 | return md->pmod; | 515 | return md->pmod; |
| 522 | } | 516 | } |
| 523 | 517 | ||
| 524 | unsigned long CONF_imodule_get_flags(const CONF_IMODULE *md) | 518 | unsigned long |
| 525 | { | 519 | CONF_imodule_get_flags(const CONF_IMODULE *md) |
| 520 | { | ||
| 526 | return md->flags; | 521 | return md->flags; |
| 527 | } | 522 | } |
| 528 | 523 | ||
| 529 | void CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags) | 524 | void |
| 530 | { | 525 | CONF_imodule_set_flags(CONF_IMODULE *md, unsigned long flags) |
| 526 | { | ||
| 531 | md->flags = flags; | 527 | md->flags = flags; |
| 532 | } | 528 | } |
| 533 | 529 | ||
| 534 | void *CONF_module_get_usr_data(CONF_MODULE *pmod) | 530 | void * |
| 535 | { | 531 | CONF_module_get_usr_data(CONF_MODULE *pmod) |
| 532 | { | ||
| 536 | return pmod->usr_data; | 533 | return pmod->usr_data; |
| 537 | } | 534 | } |
| 538 | 535 | ||
| 539 | void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data) | 536 | void |
| 540 | { | 537 | CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data) |
| 538 | { | ||
| 541 | pmod->usr_data = usr_data; | 539 | pmod->usr_data = usr_data; |
| 542 | } | 540 | } |
| 543 | 541 | ||
| 544 | /* Return default config file name */ | 542 | /* Return default config file name */ |
| 545 | 543 | ||
| @@ -549,9 +547,10 @@ CONF_get1_default_config_file(void) | |||
| 549 | char *file; | 547 | char *file; |
| 550 | 548 | ||
| 551 | file = getenv("OPENSSL_CONF"); | 549 | file = getenv("OPENSSL_CONF"); |
| 552 | if (file) | 550 | if (file) |
| 553 | return BUF_strdup(file); | 551 | return BUF_strdup(file); |
| 554 | if (asprintf(&file, "%s/openssl.cnf", X509_get_default_cert_area()) == -1) | 552 | if (asprintf(&file, "%s/openssl.cnf", |
| 553 | X509_get_default_cert_area()) == -1) | ||
| 555 | return (NULL); | 554 | return (NULL); |
| 556 | return file; | 555 | return file; |
| 557 | } | 556 | } |
| @@ -562,47 +561,42 @@ CONF_get1_default_config_file(void) | |||
| 562 | * be used to parse comma separated lists for example. | 561 | * be used to parse comma separated lists for example. |
| 563 | */ | 562 | */ |
| 564 | 563 | ||
| 565 | int CONF_parse_list(const char *list_, int sep, int nospc, | 564 | int |
| 566 | int (*list_cb)(const char *elem, int len, void *usr), void *arg) | 565 | CONF_parse_list(const char *list_, int sep, int nospc, |
| 567 | { | 566 | int (*list_cb)(const char *elem, int len, void *usr), void *arg) |
| 567 | { | ||
| 568 | int ret; | 568 | int ret; |
| 569 | const char *lstart, *tmpend, *p; | 569 | const char *lstart, *tmpend, *p; |
| 570 | 570 | ||
| 571 | if(list_ == NULL) | 571 | if (list_ == NULL) { |
| 572 | { | ||
| 573 | CONFerr(CONF_F_CONF_PARSE_LIST, CONF_R_LIST_CANNOT_BE_NULL); | 572 | CONFerr(CONF_F_CONF_PARSE_LIST, CONF_R_LIST_CANNOT_BE_NULL); |
| 574 | return 0; | 573 | return 0; |
| 575 | } | 574 | } |
| 576 | 575 | ||
| 577 | lstart = list_; | 576 | lstart = list_; |
| 578 | for(;;) | 577 | for (;;) { |
| 579 | { | 578 | if (nospc) { |
| 580 | if (nospc) | 579 | while (*lstart && isspace((unsigned char)*lstart)) |
| 581 | { | ||
| 582 | while(*lstart && isspace((unsigned char)*lstart)) | ||
| 583 | lstart++; | 580 | lstart++; |
| 584 | } | 581 | } |
| 585 | p = strchr(lstart, sep); | 582 | p = strchr(lstart, sep); |
| 586 | if (p == lstart || !*lstart) | 583 | if (p == lstart || !*lstart) |
| 587 | ret = list_cb(NULL, 0, arg); | 584 | ret = list_cb(NULL, 0, arg); |
| 588 | else | 585 | else { |
| 589 | { | ||
| 590 | if (p) | 586 | if (p) |
| 591 | tmpend = p - 1; | 587 | tmpend = p - 1; |
| 592 | else | 588 | else |
| 593 | tmpend = lstart + strlen(lstart) - 1; | 589 | tmpend = lstart + strlen(lstart) - 1; |
| 594 | if (nospc) | 590 | if (nospc) { |
| 595 | { | 591 | while (isspace((unsigned char)*tmpend)) |
| 596 | while(isspace((unsigned char)*tmpend)) | ||
| 597 | tmpend--; | 592 | tmpend--; |
| 598 | } | ||
| 599 | ret = list_cb(lstart, tmpend - lstart + 1, arg); | ||
| 600 | } | 593 | } |
| 594 | ret = list_cb(lstart, tmpend - lstart + 1, arg); | ||
| 595 | } | ||
| 601 | if (ret <= 0) | 596 | if (ret <= 0) |
| 602 | return ret; | 597 | return ret; |
| 603 | if (p == NULL) | 598 | if (p == NULL) |
| 604 | return 1; | 599 | return 1; |
| 605 | lstart = p + 1; | 600 | lstart = p + 1; |
| 606 | } | ||
| 607 | } | 601 | } |
| 608 | 602 | } | |
diff --git a/src/lib/libssl/src/crypto/conf/conf_sap.c b/src/lib/libssl/src/crypto/conf/conf_sap.c index 760dc2632d..bbd73df812 100644 --- a/src/lib/libssl/src/crypto/conf/conf_sap.c +++ b/src/lib/libssl/src/crypto/conf/conf_sap.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * are met: | 10 | * are met: |
| 11 | * | 11 | * |
| 12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * | 14 | * |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
| @@ -74,8 +74,9 @@ | |||
| 74 | 74 | ||
| 75 | static int openssl_configured = 0; | 75 | static int openssl_configured = 0; |
| 76 | 76 | ||
| 77 | void OPENSSL_config(const char *config_name) | 77 | void |
| 78 | { | 78 | OPENSSL_config(const char *config_name) |
| 79 | { | ||
| 79 | if (openssl_configured) | 80 | if (openssl_configured) |
| 80 | return; | 81 | return; |
| 81 | 82 | ||
| @@ -86,26 +87,24 @@ void OPENSSL_config(const char *config_name) | |||
| 86 | #endif | 87 | #endif |
| 87 | /* Add others here? */ | 88 | /* Add others here? */ |
| 88 | 89 | ||
| 89 | |||
| 90 | ERR_clear_error(); | 90 | ERR_clear_error(); |
| 91 | if (CONF_modules_load_file(NULL, config_name, | 91 | if (CONF_modules_load_file(NULL, config_name, |
| 92 | CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) | 92 | CONF_MFLAGS_DEFAULT_SECTION|CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0) { |
| 93 | { | ||
| 94 | BIO *bio_err; | 93 | BIO *bio_err; |
| 95 | ERR_load_crypto_strings(); | 94 | ERR_load_crypto_strings(); |
| 96 | if ((bio_err=BIO_new_fp(stderr, BIO_NOCLOSE)) != NULL) | 95 | if ((bio_err = BIO_new_fp(stderr, BIO_NOCLOSE)) != NULL) { |
| 97 | { | 96 | BIO_printf(bio_err, "Auto configuration failed\n"); |
| 98 | BIO_printf(bio_err,"Auto configuration failed\n"); | ||
| 99 | ERR_print_errors(bio_err); | 97 | ERR_print_errors(bio_err); |
| 100 | BIO_free(bio_err); | 98 | BIO_free(bio_err); |
| 101 | } | ||
| 102 | exit(1); | ||
| 103 | } | 99 | } |
| 100 | exit(1); | ||
| 101 | } | ||
| 104 | 102 | ||
| 105 | return; | 103 | return; |
| 106 | } | 104 | } |
| 107 | 105 | ||
| 108 | void OPENSSL_no_config() | 106 | void |
| 109 | { | 107 | OPENSSL_no_config() |
| 108 | { | ||
| 110 | openssl_configured = 1; | 109 | openssl_configured = 1; |
| 111 | } | 110 | } |
diff --git a/src/lib/libssl/src/crypto/conf/test.c b/src/lib/libssl/src/crypto/conf/test.c index 7fab85053e..c22071152c 100644 --- a/src/lib/libssl/src/crypto/conf/test.c +++ b/src/lib/libssl/src/crypto/conf/test.c | |||
| @@ -5,21 +5,21 @@ | |||
| 5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
| 6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
| 7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
| 8 | * | 8 | * |
| 9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
| 10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | 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 | 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 | 13 | * included with this distribution is covered by the same copyright terms |
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 15 | * | 15 | * |
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
| 18 | * If this package is used in a product, Eric Young should be given attribution | 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. | 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 | 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. | 21 | * in documentation (online or textual) provided with the package. |
| 22 | * | 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: | 25 | * are met: |
| @@ -34,10 +34,10 @@ | |||
| 34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
| 36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 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: | 38 | * the apps directory (application code) you must include an acknowledgement: |
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 40 | * | 40 | * |
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -49,7 +49,7 @@ | |||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 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 | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
| 52 | * | 52 | * |
| 53 | * The licence and distribution terms for any publically available version or | 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 | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| @@ -62,37 +62,36 @@ | |||
| 62 | #include <openssl/err.h> | 62 | #include <openssl/err.h> |
| 63 | 63 | ||
| 64 | main() | 64 | main() |
| 65 | { | 65 | { |
| 66 | LHASH *conf; | 66 | LHASH *conf; |
| 67 | long eline; | 67 | long eline; |
| 68 | char *s,*s2; | 68 | char *s, *s2; |
| 69 | 69 | ||
| 70 | #ifdef USE_WIN32 | 70 | #ifdef USE_WIN32 |
| 71 | CONF_set_default_method(CONF_WIN32); | 71 | CONF_set_default_method(CONF_WIN32); |
| 72 | #endif | 72 | #endif |
| 73 | conf=CONF_load(NULL,"ssleay.cnf",&eline); | 73 | conf = CONF_load(NULL, "ssleay.cnf", &eline); |
| 74 | if (conf == NULL) | 74 | if (conf == NULL) { |
| 75 | { | ||
| 76 | ERR_load_crypto_strings(); | 75 | ERR_load_crypto_strings(); |
| 77 | printf("unable to load configuration, line %ld\n",eline); | 76 | printf("unable to load configuration, line %ld\n", eline); |
| 78 | ERR_print_errors_fp(stderr); | 77 | ERR_print_errors_fp(stderr); |
| 79 | exit(1); | 78 | exit(1); |
| 80 | } | 79 | } |
| 81 | lh_stats(conf,stdout); | 80 | lh_stats(conf, stdout); |
| 82 | lh_node_stats(conf,stdout); | 81 | lh_node_stats(conf, stdout); |
| 83 | lh_node_usage_stats(conf,stdout); | 82 | lh_node_usage_stats(conf, stdout); |
| 84 | 83 | ||
| 85 | s=CONF_get_string(conf,NULL,"init2"); | 84 | s = CONF_get_string(conf,NULL, "init2"); |
| 86 | printf("init2=%s\n",(s == NULL)?"NULL":s); | 85 | printf("init2=%s\n", (s == NULL) ? "NULL" : s); |
| 87 | 86 | ||
| 88 | s=CONF_get_string(conf,NULL,"cipher1"); | 87 | s = CONF_get_string(conf, NULL, "cipher1"); |
| 89 | printf("cipher1=%s\n",(s == NULL)?"NULL":s); | 88 | printf("cipher1=%s\n", (s == NULL) ? "NULL" : s); |
| 90 | 89 | ||
| 91 | s=CONF_get_string(conf,"s_client","cipher1"); | 90 | s = CONF_get_string(conf, "s_client", "cipher1"); |
| 92 | printf("s_client:cipher1=%s\n",(s == NULL)?"NULL":s); | 91 | printf("s_client:cipher1=%s\n", (s == NULL) ? "NULL" : s); |
| 93 | 92 | ||
| 94 | printf("---------------------------- DUMP ------------------------\n"); | 93 | printf("---------------------------- DUMP ------------------------\n"); |
| 95 | CONF_dump_fp(conf, stdout); | 94 | CONF_dump_fp(conf, stdout); |
| 96 | 95 | ||
| 97 | exit(0); | 96 | exit(0); |
| 98 | } | 97 | } |
