summaryrefslogtreecommitdiff
path: root/trust/module.c
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2013-06-14 13:02:22 +0200
committerStef Walter <stef@thewalter.net>2013-06-14 13:32:04 +0200
commitbfe10cd0660fd81d78c8c5ce3eaa7d1f046859e1 (patch)
tree7c691c0a82eca27ce905bc448e6f51575b46dae8 /trust/module.c
parent045df29606ea9853b4fc8bdba062a5e4a7a5be95 (diff)
downloadp11-kit-bfe10cd0660fd81d78c8c5ce3eaa7d1f046859e1.tar.gz
trust: Correctly reflect the CK_TOKEN_INFO writability flags
Correctly set the CKF_TOKEN_WRITE_PROTECTED flag for paths which we will be able to write to.
Diffstat (limited to 'trust/module.c')
-rw-r--r--trust/module.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/trust/module.c b/trust/module.c
index abfabae..ea514b1 100644
--- a/trust/module.c
+++ b/trust/module.c
@@ -544,7 +544,7 @@ sys_C_GetTokenInfo (CK_SLOT_ID id,
info->firmwareVersion.minor = 0;
info->hardwareVersion.major = PACKAGE_MAJOR;
info->hardwareVersion.minor = PACKAGE_MINOR;
- info->flags = CKF_TOKEN_INITIALIZED | CKF_WRITE_PROTECTED;
+ info->flags = CKF_TOKEN_INITIALIZED;
strncpy ((char*)info->manufacturerID, MANUFACTURER_ID, 32);
strncpy ((char*)info->model, TOKEN_MODEL, 16);
strncpy ((char*)info->serialNumber, TOKEN_SERIAL_NUMBER, 16);
@@ -566,6 +566,9 @@ sys_C_GetTokenInfo (CK_SLOT_ID id,
length = sizeof (info->label);
memset (info->label, ' ', sizeof (info->label));
memcpy (info->label, label, length);
+
+ if (!p11_token_is_writable (token))
+ info->flags |= CKF_WRITE_PROTECTED;
}
p11_unlock ();