summaryrefslogtreecommitdiff
path: root/engines/e_dasync.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-11-04 11:34:15 +0000
committerMatt Caswell <matt@openssl.org>2020-11-06 10:34:48 +0000
commitb9b2135d22b93f949fd77f293925fc66158416ff (patch)
treee82c316f4f3ef24d8ec2e77a9de085d583b1adc3 /engines/e_dasync.c
parentb8ae4a83de0de38fd382f3981e503f2ab5461c07 (diff)
downloadopenssl-new-b9b2135d22b93f949fd77f293925fc66158416ff.tar.gz
Don't clear the whole error stack when loading engines
Loading the various built-in engines was unconditionally clearing the whole error stack. During config file processing processing a .include directive which fails results in errors being added to the stack - but we carry on anyway. These errors were then later being removed by the engine loading code, meaning that problems with the .include directive never get shown. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13311)
Diffstat (limited to 'engines/e_dasync.c')
-rw-r--r--engines/e_dasync.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/engines/e_dasync.c b/engines/e_dasync.c
index b817b2ba5f..4eb50d055c 100644
--- a/engines/e_dasync.c
+++ b/engines/e_dasync.c
@@ -348,9 +348,19 @@ void engine_load_dasync_int(void)
ENGINE *toadd = engine_dasync();
if (!toadd)
return;
+ ERR_set_mark();
ENGINE_add(toadd);
+ /*
+ * If the "add" worked, it gets a structural reference. So either way, we
+ * release our just-created reference.
+ */
ENGINE_free(toadd);
- ERR_clear_error();
+ /*
+ * If the "add" didn't work, it was probably a conflict because it was
+ * already added (eg. someone calling ENGINE_load_blah then calling
+ * ENGINE_load_builtin_engines() perhaps).
+ */
+ ERR_pop_to_mark();
}
static int dasync_init(ENGINE *e)