From 643aed189104d8db598e85406a222cd1145ea5b4 Mon Sep 17 00:00:00 2001 From: Clemens Fruhwirth Date: Mon, 30 Jun 2008 12:21:06 +0000 Subject: [PATCH] Add non-exclusive override to interface definition, add regression test git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@26 36d66b0a-2a48-0410-832c-cd162a569da5 --- lib/libcryptsetup.h | 7 +++++++ luks/Makefile.am | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/libcryptsetup.h b/lib/libcryptsetup.h index e2db46a..f87b736 100644 --- a/lib/libcryptsetup.h +++ b/lib/libcryptsetup.h @@ -1,5 +1,8 @@ #ifndef _LIBCRYPTSETUP_H #define _LIBCRYPTSETUP_H +#ifdef __cplusplus +extern "C" { +#endif #include @@ -17,6 +20,7 @@ struct interface_callbacks { #define CRYPT_FLAG_READONLY (1 << 1) #define CRYPT_FLAG_VERIFY_IF_POSSIBLE (1 << 2) #define CRYPT_FLAG_VERIFY_ON_DELKEY (1 << 3) +#define CRYPT_FLAG_NON_EXCLUSIVE_ACCESS (1 << 4) struct crypt_options { const char *name; @@ -65,4 +69,7 @@ void crypt_get_error(char *buf, size_t size); void crypt_put_options(struct crypt_options *options); const char *crypt_get_dir(void); +#ifdef __cplusplus +} +#endif #endif /* _LIBCRYPTSETUP_H */ diff --git a/luks/Makefile.am b/luks/Makefile.am index b4b3709..fdbab67 100644 --- a/luks/Makefile.am +++ b/luks/Makefile.am @@ -125,6 +125,16 @@ test: @../src/cryptsetup -v remove dummy @echo "success" +# Non-Exclusive Open test + @echo Case: Non-Exclusive Open + echo "key0" | ../src/cryptsetup -v --readonly luksOpen $(LOOPDEV) dummy1 2>/dev/null +# must fail + echo "key0" | ../src/cryptsetup -v --readonly luksOpen $(LOOPDEV) dummy2 2>/dev/null || true + echo "key0" | ../src/cryptsetup -v --non-exclusive --readonly luksOpen $(LOOPDEV) dummy2 2>/dev/null + @../src/cryptsetup -v remove dummy1 + @../src/cryptsetup -v remove dummy2 + + # Key Slot 1 and key material section 1 must change, the rest must not @echo Case: add key test for key files @cp $(IMG) $(ORIG_IMG) -- 2.7.4