gnome-keyring r1628 - in trunk: . pkcs11/gck pkcs11/user-store



Author: nnielsen
Date: Sat Feb 28 01:24:20 2009
New Revision: 1628
URL: http://svn.gnome.org/viewvc/gnome-keyring?rev=1628&view=rev

Log:
Make different virtual functions for the logout of SO and user.

Modified:
   trunk/ChangeLog
   trunk/pkcs11/gck/gck-module.c
   trunk/pkcs11/gck/gck-module.h
   trunk/pkcs11/user-store/gck-user-module.c

Modified: trunk/pkcs11/gck/gck-module.c
==============================================================================
--- trunk/pkcs11/gck/gck-module.c	(original)
+++ trunk/pkcs11/gck/gck-module.c	Sat Feb 28 01:24:20 2009
@@ -549,8 +549,9 @@
 	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 @@
 }
 
 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 @@
 }
 
 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 @@
 
 	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);
+
+	else if (slot->logged_in == CKU_SO)
+		return gck_module_logout_so (self, slot_id);
 
-	return gck_module_logout_any (self, slot_id);
+	else 
+		g_return_val_if_reached (CKR_GENERAL_ERROR);
 }

Modified: trunk/pkcs11/gck/gck-module.h
==============================================================================
--- trunk/pkcs11/gck/gck-module.h	(original)
+++ trunk/pkcs11/gck/gck-module.h	Sat Feb 28 01:24:20 2009
@@ -69,10 +69,12 @@
 	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_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);

Modified: trunk/pkcs11/user-store/gck-user-module.c
==============================================================================
--- trunk/pkcs11/user-store/gck-user-module.c	(original)
+++ trunk/pkcs11/user-store/gck-user-module.c	Sat Feb 28 01:24:20 2009
@@ -234,7 +234,7 @@
 }
 
 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 @@
 	
 	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 @@
 	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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]