summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2019-04-09 18:20:15 +0200
committerDaiki Ueno <dueno@redhat.com>2019-04-10 11:35:00 +0200
commit60a0716e4a04f6801f15b31af195219292eb4424 (patch)
treee70543a15d22b0b90e87943bca726a32d4fcf1bb
parent1d0da3cdfb0ccc9b46bce4e16760482f2654fbf3 (diff)
downloadgnutls-tmp-fix-pha-pkcs11-test.tar.gz
tests: fix race condition in tls13/post-handshake-with-cert-pkcs11tmp-fix-pha-pkcs11-test
The test had a strange setup of server/client processes: the server runs in a child process and the client runs in a parent process. The intention behind this was to detect softhsm availability in the parent process and exit with 77 if missing. However, there was a potential race when the server exits and proceeds to the next call of start(). This fixes the process setup and moves the softhsm detection at the program startup. Signed-off-by: Daiki Ueno <dueno@redhat.com>
-rw-r--r--tests/tls13/post-handshake-with-cert-pkcs11.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/tls13/post-handshake-with-cert-pkcs11.c b/tests/tls13/post-handshake-with-cert-pkcs11.c
index ca78ade689..01aa2d08a7 100644
--- a/tests/tls13/post-handshake-with-cert-pkcs11.c
+++ b/tests/tls13/post-handshake-with-cert-pkcs11.c
@@ -427,13 +427,13 @@ void start(const char *name, int err, int cli_err, int type)
if (child) {
/* parent */
close(fd[1]);
- client(fd[0], cli_err);
+ server(fd[0], err, type);
kill(child, SIGTERM);
wait(&status);
check_wait_status(status);
} else {
close(fd[0]);
- server(fd[1], err, type);
+ client(fd[1], cli_err);
exit(0);
}
@@ -444,6 +444,9 @@ void doit(void)
const char *bin;
char buf[128];
+ /* check if softhsm module is loadable */
+ (void) softhsm_lib();
+
/* initialize SoftHSM token that libpkcs11mock2.so internally uses */
bin = softhsm_bin();