summaryrefslogtreecommitdiff
path: root/pkcs11
diff options
context:
space:
mode:
authorStef Walter <stefw@gnome.org>2012-06-27 11:21:28 +0200
committerStef Walter <stefw@gnome.org>2012-06-27 11:21:28 +0200
commit7643d9fd1ca726a2465833295df7f0504221e713 (patch)
tree22c948ec363c06b593245181186dd3d75bd17f2b /pkcs11
parent09f5a69c00f5ef3e4928b6751ae8ebc86c3bfe2b (diff)
downloadgnome-keyring-7643d9fd1ca726a2465833295df7f0504221e713.tar.gz
Use GNOME_KEYRING_TEST_PROMPTER to specify prompter name
* Testing code can set GNOME_KEYRING_TEST_PROMPTER environment variable to change the prompter that is used for various prompts.
Diffstat (limited to 'pkcs11')
-rw-r--r--pkcs11/wrap-layer/gkm-wrap-prompt.c25
-rw-r--r--pkcs11/wrap-layer/gkm-wrap-prompt.h2
2 files changed, 22 insertions, 5 deletions
diff --git a/pkcs11/wrap-layer/gkm-wrap-prompt.c b/pkcs11/wrap-layer/gkm-wrap-prompt.c
index 62a3c460..d6e5a176 100644
--- a/pkcs11/wrap-layer/gkm-wrap-prompt.c
+++ b/pkcs11/wrap-layer/gkm-wrap-prompt.c
@@ -974,7 +974,7 @@ gkm_wrap_prompt_for_credential (CK_FUNCTION_LIST_PTR module, CK_SESSION_HANDLE s
self = g_object_new (GKM_TYPE_WRAP_PROMPT,
"timeout-seconds", -1,
- "bus-name", the_prompter_name,
+ "bus-name", gkm_wrap_prompt_get_prompter_name (),
NULL);
/* Build up the prompt */
@@ -1159,7 +1159,7 @@ gkm_wrap_prompt_for_init_pin (CK_FUNCTION_LIST_PTR module, CK_SESSION_HANDLE ses
self = g_object_new (GKM_TYPE_WRAP_PROMPT,
"timeout-seconds", -1,
- "bus-name", the_prompter_name,
+ "bus-name", gkm_wrap_prompt_get_prompter_name (),
NULL);
/* Build up the prompt */
@@ -1309,7 +1309,7 @@ gkm_wrap_prompt_for_set_pin (CK_FUNCTION_LIST_PTR module, CK_SESSION_HANDLE sess
self = g_object_new (GKM_TYPE_WRAP_PROMPT,
"timeout-seconds", -1,
- "bus-name", the_prompter_name,
+ "bus-name", gkm_wrap_prompt_get_prompter_name (),
NULL);
/* Build up the prompt */
@@ -1424,7 +1424,7 @@ login_prompt_for_specific (CK_FUNCTION_LIST_PTR module, CK_SESSION_HANDLE sessio
self = g_object_new (GKM_TYPE_WRAP_PROMPT,
"timeout-seconds", -1,
- "bus-name", the_prompter_name,
+ "bus-name", gkm_wrap_prompt_get_prompter_name (),
NULL);
/* Build up the prompt */
@@ -1496,7 +1496,7 @@ login_prompt_for_user (CK_FUNCTION_LIST_PTR module, CK_SESSION_HANDLE session)
self = g_object_new (GKM_TYPE_WRAP_PROMPT,
"timeout-seconds", -1,
- "bus-name", the_prompter_name,
+ "bus-name", gkm_wrap_prompt_get_prompter_name (),
NULL);
/* Build up the prompt */
@@ -1612,6 +1612,21 @@ gkm_wrap_prompt_done_login (GkmWrapPrompt *self, CK_USER_TYPE user_type, CK_RV c
}
}
+const gchar *
+gkm_wrap_prompt_get_prompter_name (void)
+{
+ const gchar *prompter_name;
+
+ if (the_prompter_name)
+ return the_prompter_name;
+
+ prompter_name = g_getenv ("GNOME_KEYRING_TEST_PROMPTER");
+ if (prompter_name)
+ return prompter_name;
+
+ return NULL;
+}
+
void
gkm_wrap_prompt_set_prompter_name (const gchar *prompter_name)
{
diff --git a/pkcs11/wrap-layer/gkm-wrap-prompt.h b/pkcs11/wrap-layer/gkm-wrap-prompt.h
index 47c419cc..2668bd00 100644
--- a/pkcs11/wrap-layer/gkm-wrap-prompt.h
+++ b/pkcs11/wrap-layer/gkm-wrap-prompt.h
@@ -28,6 +28,8 @@
typedef struct _GkmWrapPrompt GkmWrapPrompt;
+const gchar * gkm_wrap_prompt_get_prompter_name (void);
+
void gkm_wrap_prompt_set_prompter_name (const gchar *prompter_name);
GkmWrapPrompt* gkm_wrap_prompt_for_credential (CK_FUNCTION_LIST_PTR module,