summaryrefslogtreecommitdiffstats
path: root/src/virt-viewer-auth.c
diff options
context:
space:
mode:
authorJonathon Jongsma <jjongsma@redhat.com>2014-01-31 11:31:33 -0600
committerJonathon Jongsma <jjongsma@redhat.com>2014-02-13 09:09:13 -0600
commitdce19b379ad65a0d0edef6dfce19f1177eb082c6 (patch)
tree6b3647e278c8b0018ffb5417112e30d9523603a7 /src/virt-viewer-auth.c
parent0383cc4c9be9628d1f5535f5839b6538a74d7456 (diff)
downloadvirt-viewer-dce19b379ad65a0d0edef6dfce19f1177eb082c6.tar.gz
virt-viewer-dce19b379ad65a0d0edef6dfce19f1177eb082c6.tar.xz
virt-viewer-dce19b379ad65a0d0edef6dfce19f1177eb082c6.zip
Move vnc-specific auth logic to VirtViewerSessionVnc
Diffstat (limited to 'src/virt-viewer-auth.c')
-rw-r--r--src/virt-viewer-auth.c97
1 files changed, 0 insertions, 97 deletions
diff --git a/src/virt-viewer-auth.c b/src/virt-viewer-auth.c
index 79c8589..a5b6393 100644
--- a/src/virt-viewer-auth.c
+++ b/src/virt-viewer-auth.c
@@ -94,103 +94,6 @@ virt_viewer_auth_collect_credentials(GtkWindow *window,
return response == GTK_RESPONSE_OK ? 0 : -1;
}
-#ifdef HAVE_GTK_VNC
-void
-virt_viewer_auth_vnc_credentials(VirtViewerSession *session,
- GtkWindow *window,
- GtkWidget *vnc,
- GValueArray *credList,
- char *vncAddress)
-{
- char *username = NULL, *password = NULL;
- gboolean wantPassword = FALSE, wantUsername = FALSE;
- int i;
-
- DEBUG_LOG("Got VNC credential request for %d credential(s)", credList->n_values);
-
- for (i = 0 ; i < credList->n_values ; i++) {
- GValue *cred = g_value_array_get_nth(credList, i);
- switch (g_value_get_enum(cred)) {
- case VNC_DISPLAY_CREDENTIAL_USERNAME:
- wantUsername = TRUE;
- break;
- case VNC_DISPLAY_CREDENTIAL_PASSWORD:
- wantPassword = TRUE;
- break;
- case VNC_DISPLAY_CREDENTIAL_CLIENTNAME:
- break;
- default:
- DEBUG_LOG("Unsupported credential type %d", g_value_get_enum(cred));
- vnc_display_close(VNC_DISPLAY(vnc));
- goto cleanup;
- }
- }
-
- VirtViewerFile *file = virt_viewer_session_get_file(session);
- if (file != NULL) {
- if (wantUsername && virt_viewer_file_is_set(file, "username")) {
- username = virt_viewer_file_get_username(file);
- wantUsername = FALSE;
- }
- if (wantPassword && virt_viewer_file_is_set(file, "password")) {
- password = virt_viewer_file_get_password(file);
- wantPassword = FALSE;
- }
- }
-
- if (wantUsername || wantPassword) {
- int ret = virt_viewer_auth_collect_credentials(window,
- "VNC", vncAddress,
- wantUsername ? &username : NULL,
- wantPassword ? &password : NULL);
-
- if (ret < 0) {
- vnc_display_close(VNC_DISPLAY(vnc));
- goto cleanup;
- }
- }
-
- for (i = 0 ; i < credList->n_values ; i++) {
- GValue *cred = g_value_array_get_nth(credList, i);
- switch (g_value_get_enum(cred)) {
- case VNC_DISPLAY_CREDENTIAL_USERNAME:
- if (!username ||
- vnc_display_set_credential(VNC_DISPLAY(vnc),
- g_value_get_enum(cred),
- username)) {
- DEBUG_LOG("Failed to set credential type %d", g_value_get_enum(cred));
- vnc_display_close(VNC_DISPLAY(vnc));
- }
- break;
- case VNC_DISPLAY_CREDENTIAL_PASSWORD:
- if (!password ||
- vnc_display_set_credential(VNC_DISPLAY(vnc),
- g_value_get_enum(cred),
- password)) {
- DEBUG_LOG("Failed to set credential type %d", g_value_get_enum(cred));
- vnc_display_close(VNC_DISPLAY(vnc));
- }
- break;
- case VNC_DISPLAY_CREDENTIAL_CLIENTNAME:
- if (vnc_display_set_credential(VNC_DISPLAY(vnc),
- g_value_get_enum(cred),
- "libvirt")) {
- DEBUG_LOG("Failed to set credential type %d", g_value_get_enum(cred));
- vnc_display_close(VNC_DISPLAY(vnc));
- }
- break;
- default:
- DEBUG_LOG("Unsupported credential type %d", g_value_get_enum(cred));
- vnc_display_close(VNC_DISPLAY(vnc));
- }
- }
-
- cleanup:
- g_free(username);
- g_free(password);
-}
-#endif
-
/*
* Local variables:
* c-indent-level: 4