Skip to content

Commit

Permalink
Skip encryption tests if override of calls within libzip doesn’t work.
Browse files Browse the repository at this point in the history
  • Loading branch information
dillof committed Mar 4, 2021
1 parent e728a15 commit 845ed8d
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 18 deletions.
1 change: 1 addition & 0 deletions regress/encryption-nonrandom-aes128.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
features CRYPTO
precheck liboverride-test
description encrypt file without entropy, to make results repeatable
return 0
preload nonrandomopen.so
Expand Down
1 change: 1 addition & 0 deletions regress/encryption-nonrandom-aes192.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
features CRYPTO
precheck liboverride-test
description encrypt file without entropy, to make results repeatable
return 0
preload nonrandomopen.so
Expand Down
1 change: 1 addition & 0 deletions regress/encryption-nonrandom-aes256.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
features CRYPTO
precheck liboverride-test
description encrypt file without entropy, to make results repeatable
return 0
preload nonrandomopen.so
Expand Down
1 change: 1 addition & 0 deletions regress/encryption-nonrandom-pkware.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
features CRYPTO
precheck liboverride-test
description encrypt file by Traditional PKWARE
return 0
preload nonrandomopen.so
Expand Down
18 changes: 0 additions & 18 deletions regress/liboverride-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@

#include "zip.h"

#define DEBUG 1

#ifdef DEBUG
#include <stdio.h>
#endif

/*
Some systems bind functions called and defined within a shared library, so the override doesn't work. This program calls zip_open and checks whether the override worked.
*/
Expand All @@ -54,30 +48,18 @@ main(int argc, const char *argv[]) {
if (getenv("LIBOVERRIDE_SET") == NULL) {
setenv("LIBOVERRIDE_SET", "1", 1);
setenv("LD_PRELOAD", "libliboverride.so", 1);
#ifdef DEBUG
printf("setting LD_PRELOAD and calling us again\n");
#endif
execv(argv[0], (void *)argv);
exit(2);
}

if (zip_open("nosuchfile", 0, &error_code) != NULL) {
#ifdef DEBUG
printf("zip_open() succeeded\n");
#endif
/* We expect failure. */
exit(1);
}
if (error_code != 32000) {
#ifdef DEBUG
printf("got wrong error code %d\n", error_code);
#endif
/* Override didn't take, we didn't get its magic error code. */
exit(1);
}

#ifdef DEBUG
printf("override worked\n");
#endif
exit(0);
}

0 comments on commit 845ed8d

Please sign in to comment.