[gnome-builder/wip/project-selector: 68/72] git: check for allowed types when instantiating credentials



commit 0c0c6acc0b11cc4d7e34c850a782888f7b09e5eb
Author: Christian Hergert <christian hergert me>
Date:   Mon Apr 6 23:20:52 2015 -0700

    git: check for allowed types when instantiating credentials

 libide/git/ide-git-remote-callbacks.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)
---
diff --git a/libide/git/ide-git-remote-callbacks.c b/libide/git/ide-git-remote-callbacks.c
index 3f91b5a..22cbafe 100644
--- a/libide/git/ide-git-remote-callbacks.c
+++ b/libide/git/ide-git-remote-callbacks.c
@@ -115,19 +115,21 @@ ide_git_remote_callbacks_real_credentials (GgitRemoteCallbacks  *callbacks,
 
   IDE_TRACE_MSG ("username=%s url=%s", username_from_url ?: "", url);
 
-#if 0
-       GGIT_CREDTYPE_SSH_KEY            = (1u << 1),
-       GGIT_CREDTYPE_SSH_CUSTOM         = (1u << 2),
-       GGIT_CREDTYPE_DEFAULT            = (1u << 3),
-       GGIT_CREDTYPE_SSH_INTERACTIVE    = (1u << 4),
-#endif
-
-#if 1
-  {
-    GgitCredSshKeyFromAgent *cred = ggit_cred_ssh_key_from_agent_new (username_from_url, error);
-    return GGIT_CRED (cred);
-  }
-#endif
+  if ((allowed_types & GGIT_CREDTYPE_SSH_KEY) != 0)
+    {
+      GgitCredSshKeyFromAgent *cred;
+
+      cred = ggit_cred_ssh_key_from_agent_new (username_from_url, error);
+      ret = GGIT_CRED (cred);
+    }
+
+  if ((allowed_types & GGIT_CREDTYPE_SSH_INTERACTIVE) != 0)
+    {
+      GgitCredSshInteractive *cred;
+
+      cred = ggit_cred_ssh_interactive_new (username_from_url, error);
+      ret = GGIT_CRED (cred);
+    }
 
   IDE_RETURN (ret);
 }


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