diff options
author | Stef Walter <stefw@gnome.org> | 2013-03-28 17:54:39 +0100 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-03-28 17:54:39 +0100 |
commit | 4560373c254473990306c13178b959ccc5d338e4 (patch) | |
tree | d4e2d863ad87984b9ee62849651878b1f3fec7bc /trust/module.c | |
parent | 10d8e6d1836701e311d2b55e116909198932915b (diff) | |
download | p11-kit-4560373c254473990306c13178b959ccc5d338e4.tar.gz |
Don't complain when applications call C_Logout or C_Login
Some callers erroneously call our C_Logout function, like NSS.
So return appropriate error codes in these cases.
https://bugs.freedesktop.org/show_bug.cgi?id=62874
Diffstat (limited to 'trust/module.c')
-rw-r--r-- | trust/module.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/trust/module.c b/trust/module.c index 6be2847..51a75e0 100644 --- a/trust/module.c +++ b/trust/module.c @@ -855,13 +855,41 @@ sys_C_Login (CK_SESSION_HANDLE handle, CK_UTF8CHAR_PTR pin, CK_ULONG pin_len) { - return_val_if_reached (CKR_FUNCTION_NOT_SUPPORTED); + CK_RV rv; + + p11_debug ("in"); + + p11_lock (); + + rv = lookup_session (handle, NULL); + if (rv == CKR_OK) + rv = CKR_USER_TYPE_INVALID; + + p11_unlock (); + + p11_debug ("out: 0x%lx", rv); + + return rv; } static CK_RV sys_C_Logout (CK_SESSION_HANDLE handle) { - return_val_if_reached (CKR_FUNCTION_NOT_SUPPORTED); + CK_RV rv; + + p11_debug ("in"); + + p11_lock (); + + rv = lookup_session (handle, NULL); + if (rv == CKR_OK) + rv = CKR_USER_NOT_LOGGED_IN; + + p11_unlock (); + + p11_debug ("out: 0x%lx", rv); + + return rv; } static CK_RV |