gnome-keyring r1515 - in trunk: . pkcs11/rpc-layer



Author: nnielsen
Date: Sat Feb  7 23:23:29 2009
New Revision: 1515
URL: http://svn.gnome.org/viewvc/gnome-keyring?rev=1515&view=rev

Log:
Use 64 bit integers when transferring ulongs between module and daemon.

Modified:
   trunk/ChangeLog
   trunk/pkcs11/rpc-layer/gck-rpc-message.c
   trunk/pkcs11/rpc-layer/gck-rpc-module.c

Modified: trunk/pkcs11/rpc-layer/gck-rpc-message.c
==============================================================================
--- trunk/pkcs11/rpc-layer/gck-rpc-message.c	(original)
+++ trunk/pkcs11/rpc-layer/gck-rpc-message.c	Sat Feb  7 23:23:29 2009
@@ -309,16 +309,16 @@
 int
 gck_rpc_message_read_ulong (GckRpcMessage *msg, CK_ULONG *val)
 {
-	uint32_t v;
+	uint64_t v;
 	assert (msg);
 	
 	/* Make sure this is in the right order */
 	assert (!msg->signature || gck_rpc_message_verify_part (msg, "u"));
 
-	if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &v))
+	if (!egg_buffer_get_uint64 (&msg->buffer, msg->parsed, &msg->parsed, &v))
 		return 0;
 	if (val)
-		*val = v;
+		*val = (CK_ULONG)v;
 	return 1;
 }
 
@@ -329,7 +329,7 @@
 
 	/* Make sure this is in the rigth order */
 	assert (!msg->signature || gck_rpc_message_verify_part (msg, "u"));
-	return egg_buffer_add_uint32 (&msg->buffer, val);
+	return egg_buffer_add_uint64 (&msg->buffer, val);
 }
 
 int
@@ -389,7 +389,7 @@
 	/* Now send the data if valid */
 	if (array) {
 		for (i = 0; i < n_array; ++i)
-			egg_buffer_add_uint32 (&msg->buffer, array[i]); 
+			egg_buffer_add_uint64 (&msg->buffer, array[i]); 
 	}
 	
 	return !egg_buffer_has_error (&msg->buffer);

Modified: trunk/pkcs11/rpc-layer/gck-rpc-module.c
==============================================================================
--- trunk/pkcs11/rpc-layer/gck-rpc-module.c	(original)
+++ trunk/pkcs11/rpc-layer/gck-rpc-module.c	Sat Feb  7 23:23:29 2009
@@ -645,7 +645,7 @@
 	assert (msg);
 
 	/* Make sure this is in the right order */
-	assert (!msg->signature || gck_rpc_message_verify_part (msg, "aAu"));
+	assert (!msg->signature || gck_rpc_message_verify_part (msg, "aA"));
 	
 	/* Get the number of items. We need this value to be correct */
 	if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &num))
@@ -732,10 +732,10 @@
 		return PARSE_ERROR;
 	
 	/* Read in the code that goes along with these attributes */
-	if (!egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &num))
+	if (!gck_rpc_message_read_ulong (msg, &ret))
 		return PARSE_ERROR;
 
-	return (CK_RV)num;
+	return ret;
 }
 
 static CK_RV
@@ -791,7 +791,8 @@
 proto_read_ulong_array (GckRpcMessage *msg, CK_ULONG_PTR arr,
                         CK_ULONG_PTR len, CK_ULONG max)
 {
-	uint32_t i, num, val;
+	uint32_t i, num;
+	uint64_t val;
 	unsigned char valid;
 
 	assert (len);
@@ -823,9 +824,9 @@
 
 	/* We need to go ahead and read everything in all cases */
 	for (i = 0; i < num; ++i) {
-		egg_buffer_get_uint32 (&msg->buffer, msg->parsed, &msg->parsed, &val);
+		egg_buffer_get_uint64 (&msg->buffer, msg->parsed, &msg->parsed, &val);
 		if (arr)
-			arr[i] = val;
+			arr[i] = (CK_ULONG)val;
 	}
 
 	return egg_buffer_has_error (&msg->buffer) ? PARSE_ERROR : CKR_OK;



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