forked from p11-glue/p11-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
list-modules: Do not embed module-name and module-path in URL
module-name and module-path are query attributes, which are to modify the default settings (RFC 7512 section 2.4). As p11-kit manages the default configuration, it shouldn't print them as part of the token URL. This instead prints the absolute path of each module in a separate field of the output. Signed-off-by: Daiki Ueno <[email protected]>
- Loading branch information
Showing
5 changed files
with
127 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/bin/sh | ||
|
||
test "${abs_top_builddir+set}" = set || { | ||
echo "set abs_top_builddir" 1>&2 | ||
exit 1 | ||
} | ||
|
||
. "$abs_top_builddir/common/test-init.sh" | ||
|
||
setup() { | ||
testdir=$PWD/test-objects-$$ | ||
test -d "$testdir" || mkdir "$testdir" | ||
cd "$testdir" | ||
} | ||
|
||
teardown() { | ||
rm -rf "$testdir" | ||
} | ||
|
||
test_list_modules() { | ||
cat > list.exp <<EOF | ||
module: four | ||
uri: pkcs11:library-description=MOCK%20LIBRARY;library-manufacturer=MOCK%20MANUFACTURER | ||
library-description: MOCK LIBRARY | ||
library-manufacturer: MOCK MANUFACTURER | ||
library-version: 45.145 | ||
token: TEST LABEL | ||
uri: pkcs11:model=TEST%20MODEL;manufacturer=TEST%20MANUFACTURER;serial=TEST%20SERIAL;token=TEST%20LABEL | ||
manufacturer: TEST MANUFACTURER | ||
model: TEST MODEL | ||
serial-number: TEST SERIAL | ||
hardware-version: 75.175 | ||
firmware-version: 85.185 | ||
flags: | ||
login-required | ||
user-pin-initialized | ||
clock-on-token | ||
token-initialized | ||
module: eleven | ||
uri: pkcs11:library-description=MOCK%20LIBRARY;library-manufacturer=MOCK%20MANUFACTURER | ||
library-description: MOCK LIBRARY | ||
library-manufacturer: MOCK MANUFACTURER | ||
library-version: 45.145 | ||
token: TEST LABEL | ||
uri: pkcs11:model=TEST%20MODEL;manufacturer=TEST%20MANUFACTURER;serial=TEST%20SERIAL;token=TEST%20LABEL | ||
manufacturer: TEST MANUFACTURER | ||
model: TEST MODEL | ||
serial-number: TEST SERIAL | ||
hardware-version: 75.175 | ||
firmware-version: 85.185 | ||
flags: | ||
login-required | ||
user-pin-initialized | ||
clock-on-token | ||
token-initialized | ||
module: one | ||
uri: pkcs11:library-description=MOCK%20LIBRARY;library-manufacturer=MOCK%20MANUFACTURER | ||
library-description: MOCK LIBRARY | ||
library-manufacturer: MOCK MANUFACTURER | ||
library-version: 45.145 | ||
token: TEST LABEL | ||
uri: pkcs11:model=TEST%20MODEL;manufacturer=TEST%20MANUFACTURER;serial=TEST%20SERIAL;token=TEST%20LABEL | ||
manufacturer: TEST MANUFACTURER | ||
model: TEST MODEL | ||
serial-number: TEST SERIAL | ||
hardware-version: 75.175 | ||
firmware-version: 85.185 | ||
flags: | ||
login-required | ||
user-pin-initialized | ||
clock-on-token | ||
token-initialized | ||
module: two-duplicate | ||
uri: pkcs11:library-description=MOCK%20LIBRARY;library-manufacturer=MOCK%20MANUFACTURER | ||
library-description: MOCK LIBRARY | ||
library-manufacturer: MOCK MANUFACTURER | ||
library-version: 45.145 | ||
token: TEST LABEL | ||
uri: pkcs11:model=TEST%20MODEL;manufacturer=TEST%20MANUFACTURER;serial=TEST%20SERIAL;token=TEST%20LABEL | ||
manufacturer: TEST MANUFACTURER | ||
model: TEST MODEL | ||
serial-number: TEST SERIAL | ||
hardware-version: 75.175 | ||
firmware-version: 85.185 | ||
flags: | ||
login-required | ||
user-pin-initialized | ||
clock-on-token | ||
token-initialized | ||
EOF | ||
|
||
# Since the path is absolute, it may contain user's current working | ||
# directory; strip it before taking a diff. | ||
if ! "$abs_top_builddir"/p11-kit/p11-kit-testable list-modules -q | sed '/^ *path: /d' > list.out; then | ||
assert_fail "unable to run: p11-kit list-modules" | ||
fi | ||
|
||
: ${DIFF=diff} | ||
if ! ${DIFF} list.exp list.out > list.diff; then | ||
sed 's/^/# /' list.diff | ||
assert_fail "output contains incorrect result" | ||
fi | ||
} | ||
|
||
run test_list_modules |