summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Walter <stefw@src.gnome.org>2009-02-28 01:24:20 +0000
committerStefan Walter <stefw@src.gnome.org>2009-02-28 01:24:20 +0000
commitbdf25f4f033a04c047ca281489346eb4958a2e79 (patch)
tree692c0c215a6e7b59ae5bac11916f42b3fc418008
parent416d25809297e2b261d89b1846f78e56fbd0488e (diff)
downloadgnome-keyring-bdf25f4f033a04c047ca281489346eb4958a2e79.tar.gz
Make different virtual functions for the logout of SO and user.
svn path=/trunk/; revision=1628
-rw-r--r--ChangeLog5
-rw-r--r--pkcs11/gck/gck-module.c26
-rw-r--r--pkcs11/gck/gck-module.h11
-rw-r--r--pkcs11/user-store/gck-user-module.c6
4 files changed, 37 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 25ff6a52..9505760f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,11 @@
importing into them. More functionality along this line will
be needed in future versions.
+ * pkcs11/gck/gck-module.c:
+ * pkcs11/gck/gck-module.h:
+ * pkcs11/user-store/gck-user-module.c: Make different virtual functions
+ for the logout of SO and user.
+
2009-02-25 Stef Walter <stef@memberwebs.com>
* pkcs11/gck/gck-module.c:
diff --git a/pkcs11/gck/gck-module.c b/pkcs11/gck/gck-module.c
index e6271007..1c021eb1 100644
--- a/pkcs11/gck/gck-module.c
+++ b/pkcs11/gck/gck-module.c
@@ -549,8 +549,9 @@ gck_module_class_init (GckModuleClass *klass)
klass->remove_token_object = gck_module_real_remove_token_object;
klass->login_change = gck_module_real_login_change;
klass->login_user = gck_module_real_login_user;
+ klass->logout_user = gck_module_real_logout_any;
klass->login_so = gck_module_real_login_so;
- klass->logout_any = gck_module_real_logout_any;
+ klass->logout_so = gck_module_real_logout_any;
g_object_class_install_property (gobject_class, PROP_MANAGER,
g_param_spec_object ("manager", "Manager", "Token object manager",
@@ -624,6 +625,14 @@ gck_module_login_user (GckModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin,
}
CK_RV
+gck_module_logout_user (GckModule *self, CK_SLOT_ID slot_id)
+{
+ g_return_val_if_fail (GCK_IS_MODULE (self), CKR_GENERAL_ERROR);
+ g_assert (GCK_MODULE_GET_CLASS (self)->logout_user);
+ return GCK_MODULE_GET_CLASS (self)->logout_user (self, slot_id);
+}
+
+CK_RV
gck_module_login_so (GckModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin, CK_ULONG n_pin)
{
g_return_val_if_fail (GCK_IS_MODULE (self), CKR_GENERAL_ERROR);
@@ -632,11 +641,11 @@ gck_module_login_so (GckModule *self, CK_SLOT_ID slot_id, CK_UTF8CHAR_PTR pin, C
}
CK_RV
-gck_module_logout_any (GckModule *self, CK_SLOT_ID slot_id)
+gck_module_logout_so (GckModule *self, CK_SLOT_ID slot_id)
{
g_return_val_if_fail (GCK_IS_MODULE (self), CKR_GENERAL_ERROR);
- g_assert (GCK_MODULE_GET_CLASS (self)->logout_any);
- return GCK_MODULE_GET_CLASS (self)->logout_any (self, slot_id);
+ g_assert (GCK_MODULE_GET_CLASS (self)->logout_so);
+ return GCK_MODULE_GET_CLASS (self)->logout_so (self, slot_id);
}
CK_ULONG
@@ -1110,6 +1119,13 @@ gck_module_C_Logout (GckModule *self, CK_SESSION_HANDLE handle)
if (slot->logged_in == CKU_NONE)
return CKR_USER_NOT_LOGGED_IN;
+
+ else if (slot->logged_in == CKU_USER)
+ return gck_module_logout_user (self, slot_id);
- return gck_module_logout_any (self, slot_id);
+ else if (slot->logged_in == CKU_SO)
+ return gck_module_logout_so (self, slot_id);
+
+ else
+ g_return_val_if_reached (CKR_GENERAL_ERROR);
}
diff --git a/pkcs11/gck/gck-module.h b/pkcs11/gck/gck-module.h
index 6e4f8987..cf877d50 100644
--- a/pkcs11/gck/gck-module.h
+++ b/pkcs11/gck/gck-module.h
@@ -69,10 +69,12 @@ struct _GckModuleClass {
CK_RV (*login_user) (GckModule *self, CK_SLOT_ID slot_id,
CK_UTF8CHAR_PTR pin, CK_ULONG n_pin);
+ CK_RV (*logout_user) (GckModule *self, CK_SLOT_ID slot_id);
+
CK_RV (*login_so) (GckModule *self, CK_SLOT_ID slot_id,
CK_UTF8CHAR_PTR pin, CK_ULONG n_pin);
-
- CK_RV (*logout_any) (GckModule *self, CK_SLOT_ID slot_id);
+
+ CK_RV (*logout_so) (GckModule *self, CK_SLOT_ID slot_id);
};
/*
@@ -119,12 +121,15 @@ CK_RV gck_module_login_user (GckModule *se
CK_UTF8CHAR_PTR pin,
CK_ULONG n_pin);
+CK_RV gck_module_logout_user (GckModule *self,
+ CK_SLOT_ID slot_id);
+
CK_RV gck_module_login_so (GckModule *self,
CK_SLOT_ID slot_id,
CK_UTF8CHAR_PTR pin,
CK_ULONG n_pin);
-CK_RV gck_module_logout_any (GckModule *self,
+CK_RV gck_module_logout_so (GckModule *self,
CK_SLOT_ID slot_id);
CK_RV gck_module_refresh_token (GckModule *self);
diff --git a/pkcs11/user-store/gck-user-module.c b/pkcs11/user-store/gck-user-module.c
index 2965bcf5..d2d28ffa 100644
--- a/pkcs11/user-store/gck-user-module.c
+++ b/pkcs11/user-store/gck-user-module.c
@@ -234,7 +234,7 @@ gck_user_module_real_login_so (GckModule *base, CK_SLOT_ID slot_id, CK_UTF8CHAR_
}
static CK_RV
-gck_user_module_real_logout_any (GckModule *base, CK_SLOT_ID slot_id)
+gck_user_module_real_logout_user (GckModule *base, CK_SLOT_ID slot_id)
{
GckUserModule *self = GCK_USER_MODULE (base);
CK_RV rv;
@@ -247,7 +247,7 @@ gck_user_module_real_logout_any (GckModule *base, CK_SLOT_ID slot_id)
rv = gck_user_storage_lock (self->storage);
if (rv == CKR_OK)
- rv = GCK_MODULE_CLASS (gck_user_module_parent_class)->logout_any (base, slot_id);
+ rv = GCK_MODULE_CLASS (gck_user_module_parent_class)->logout_user (base, slot_id);
return rv;
}
@@ -327,7 +327,7 @@ gck_user_module_class_init (GckUserModuleClass *klass)
module_class->remove_token_object = gck_user_module_real_remove_token_object;
module_class->login_user = gck_user_module_real_login_user;
module_class->login_so = gck_user_module_real_login_so;
- module_class->logout_any = gck_user_module_real_logout_any;
+ module_class->logout_user = gck_user_module_real_logout_user;
module_class->login_change = gck_user_module_real_login_change;
}