diff options
author | deraadt <> | 2015-04-11 16:03:21 +0000 |
---|---|---|
committer | deraadt <> | 2015-04-11 16:03:21 +0000 |
commit | 3f6d0024da68bdf5d0f128537ac3ed536e6e6a6c (patch) | |
tree | 02ee416418c40719cf48cd968d4b546afbaf642a /src/lib/libcrypto/conf | |
parent | 0a2c31c8f577b7611e81418bbe11b6a748f005ca (diff) | |
download | openbsd-3f6d0024da68bdf5d0f128537ac3ed536e6e6a6c.tar.gz openbsd-3f6d0024da68bdf5d0f128537ac3ed536e6e6a6c.tar.bz2 openbsd-3f6d0024da68bdf5d0f128537ac3ed536e6e6a6c.zip |
Remove all getenv() calls, especially those wrapped by issetugid().
getenv()'s wrapped by issetugid() are safe, but issetugid() is correct
difficult to impliment on many operating systems. By accident, a grand
experiment was run over the last year, where issetugid() returned 1 (the
safe value) on a few operating systems. Noone noticed & complained that
certain environment variables were not working.......
ok doug beck jsing, discussion with others
Diffstat (limited to 'src/lib/libcrypto/conf')
-rw-r--r-- | src/lib/libcrypto/conf/conf_api.c | 18 | ||||
-rw-r--r-- | src/lib/libcrypto/conf/conf_mod.c | 6 |
2 files changed, 4 insertions, 20 deletions
diff --git a/src/lib/libcrypto/conf/conf_api.c b/src/lib/libcrypto/conf/conf_api.c index efa4be9f6b..f296e6a962 100644 --- a/src/lib/libcrypto/conf/conf_api.c +++ b/src/lib/libcrypto/conf/conf_api.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: conf_api.c,v 1.14 2015/02/10 11:22:21 jsing Exp $ */ | 1 | /* $OpenBSD: conf_api.c,v 1.15 2015/04/11 16:03:21 deraadt Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -130,7 +130,6 @@ char * | |||
130 | _CONF_get_string(const CONF *conf, const char *section, const char *name) | 130 | _CONF_get_string(const CONF *conf, const char *section, const char *name) |
131 | { | 131 | { |
132 | CONF_VALUE *v, vv; | 132 | CONF_VALUE *v, vv; |
133 | char *p; | ||
134 | 133 | ||
135 | if (name == NULL) | 134 | if (name == NULL) |
136 | return (NULL); | 135 | return (NULL); |
@@ -141,14 +140,6 @@ _CONF_get_string(const CONF *conf, const char *section, const char *name) | |||
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) |
143 | return (v->value); | 142 | return (v->value); |
144 | if (strcmp(section, "ENV") == 0) { | ||
145 | if (issetugid() == 0) | ||
146 | p = getenv(name); | ||
147 | else | ||
148 | p = NULL; | ||
149 | if (p != NULL) | ||
150 | return (p); | ||
151 | } | ||
152 | } | 143 | } |
153 | vv.section = "default"; | 144 | vv.section = "default"; |
154 | vv.name = (char *)name; | 145 | vv.name = (char *)name; |
@@ -157,11 +148,8 @@ _CONF_get_string(const CONF *conf, const char *section, const char *name) | |||
157 | return (v->value); | 148 | return (v->value); |
158 | else | 149 | else |
159 | return (NULL); | 150 | return (NULL); |
160 | } else { | 151 | } else |
161 | if (issetugid()) | 152 | return (NULL); |
162 | return (NULL); | ||
163 | return (getenv(name)); | ||
164 | } | ||
165 | } | 153 | } |
166 | 154 | ||
167 | static unsigned long | 155 | static unsigned long |
diff --git a/src/lib/libcrypto/conf/conf_mod.c b/src/lib/libcrypto/conf/conf_mod.c index 4363f297c7..cb54cc2a87 100644 --- a/src/lib/libcrypto/conf/conf_mod.c +++ b/src/lib/libcrypto/conf/conf_mod.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: conf_mod.c,v 1.25 2014/07/22 02:21:20 beck Exp $ */ | 1 | /* $OpenBSD: conf_mod.c,v 1.26 2015/04/11 16:03:21 deraadt Exp $ */ |
2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Stephen Henson (steve@openssl.org) for the OpenSSL |
3 | * project 2001. | 3 | * project 2001. |
4 | */ | 4 | */ |
@@ -546,10 +546,6 @@ CONF_get1_default_config_file(void) | |||
546 | { | 546 | { |
547 | char *file = NULL; | 547 | char *file = NULL; |
548 | 548 | ||
549 | if (issetugid() == 0) | ||
550 | file = getenv("OPENSSL_CONF"); | ||
551 | if (file) | ||
552 | return strdup(file); | ||
553 | if (asprintf(&file, "%s/openssl.cnf", | 549 | if (asprintf(&file, "%s/openssl.cnf", |
554 | X509_get_default_cert_area()) == -1) | 550 | X509_get_default_cert_area()) == -1) |
555 | return (NULL); | 551 | return (NULL); |