summaryrefslogtreecommitdiff
path: root/p11-kit/rpc-client.c
diff options
context:
space:
mode:
authorDaiki Ueno <dueno@redhat.com>2016-09-19 16:36:19 +0200
committerStef Walter <stefw@redhat.com>2016-10-05 15:13:08 +0200
commita96f354c3068edb6c8ac80ae6d9a6611651145d7 (patch)
treed8a89a7019b632699189044d59155b887ff36e0a /p11-kit/rpc-client.c
parent2fe688e8bd360ce2f364bfb6ef80e07712c9bb86 (diff)
downloadp11-kit-a96f354c3068edb6c8ac80ae6d9a6611651145d7.tar.gz
rpc: Send x-init-reserved to remote modulebefore-move
Signed-off-by: Stef Walter <stefw@redhat.com> * Fixed up indentation https://bugs.freedesktop.org/show_bug.cgi?id=80519
Diffstat (limited to 'p11-kit/rpc-client.c')
-rw-r--r--p11-kit/rpc-client.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/p11-kit/rpc-client.c b/p11-kit/rpc-client.c
index 8607bb5..c69dcfd 100644
--- a/p11-kit/rpc-client.c
+++ b/p11-kit/rpc-client.c
@@ -857,7 +857,10 @@ rpc_C_Initialize (CK_X_FUNCTION_LIST *self,
if (init_args != NULL) {
int supplied_ok;
- /* pReserved must be NULL */
+ /*
+ * pReserved is either a string or NULL. Other cases
+ * should be rejected by the caller of this function.
+ */
args = init_args;
/* ALL supplied function pointers need to have the value either NULL or non-NULL. */
@@ -919,6 +922,17 @@ rpc_C_Initialize (CK_X_FUNCTION_LIST *self,
if (ret == CKR_OK)
if (!p11_rpc_message_write_byte_array (&msg, P11_RPC_HANDSHAKE, P11_RPC_HANDSHAKE_LEN))
ret = CKR_HOST_MEMORY;
+ if (ret == CKR_OK) {
+ if (!p11_rpc_message_write_byte (&msg, reserved != NULL))
+ ret = CKR_HOST_MEMORY;
+ }
+ if (ret == CKR_OK) {
+ char *reserved_string = "";
+ if (reserved != NULL)
+ reserved_string = (char *) reserved;
+ if (!p11_rpc_message_write_byte_array (&msg, (CK_BYTE_PTR) reserved_string, strlen (reserved_string) + 1))
+ ret = CKR_HOST_MEMORY;
+ }
if (ret == CKR_OK)
ret = call_run (module, &msg);
call_done (module, &msg, ret);