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



commit fac2ae8c7c949c1bc210e93e52616d9808e2f3b9
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]