diff options
author | Stef Walter <stef@memberwebs.com> | 2010-08-25 08:14:32 -0500 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2010-08-25 08:14:32 -0500 |
commit | 18c11c0c269ac13b51abc86fa4af82e185024793 (patch) | |
tree | 68910c069371f6e2e1b76fab2a7d2ccb20b382c3 /gck/gck-session.c | |
parent | 6de786291040d4f4498c13ed8f16270d6386e943 (diff) | |
download | gcr-18c11c0c269ac13b51abc86fa4af82e185024793.tar.gz |
Port gnome-keyring to new gck library.
Diffstat (limited to 'gck/gck-session.c')
-rw-r--r-- | gck/gck-session.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gck/gck-session.c b/gck/gck-session.c index 9813a31..225a812 100644 --- a/gck/gck-session.c +++ b/gck/gck-session.c @@ -408,6 +408,34 @@ gck_session_get_info (GckSession *self) return sessioninfo; } +gulong +gck_session_get_state (GckSession *self) +{ + CK_FUNCTION_LIST_PTR funcs; + CK_SESSION_INFO info; + CK_RV rv; + + g_return_val_if_fail (GCK_IS_SESSION (self), 0); + g_return_val_if_fail (GCK_IS_MODULE (self->pv->module), 0); + + g_object_ref (self->pv->module); + + funcs = gck_module_get_functions (self->pv->module); + g_return_val_if_fail (funcs, 0); + + memset (&info, 0, sizeof (info)); + rv = (funcs->C_GetSessionInfo) (self->pv->handle, &info); + + g_object_unref (self->pv->module); + + if (rv != CKR_OK) { + g_warning ("couldn't get session info: %s", gck_message_from_rv (rv)); + return 0; + } + + return info.state; +} + /* --------------------------------------------------------------------------------------------- * INIT PIN */ |