aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/credential-cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/credential-cache.c')
-rw-r--r--builtin/credential-cache.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/builtin/credential-cache.c b/builtin/credential-cache.c
index 78c02ad531..3db8df70a9 100644
--- a/builtin/credential-cache.c
+++ b/builtin/credential-cache.c
@@ -1,10 +1,13 @@
#include "builtin.h"
+#include "credential.h"
+#include "gettext.h"
#include "parse-options.h"
+#include "path.h"
+#include "strbuf.h"
+#include "write-or-die.h"
#ifndef NO_UNIX_SOCKETS
-#include "credential.h"
-#include "string-list.h"
#include "unix-socket.h"
#include "run-command.h"
@@ -125,6 +128,13 @@ static char *get_socket_path(void)
return socket;
}
+static void announce_capabilities(void)
+{
+ struct credential c = CREDENTIAL_INIT;
+ c.capa_authtype.request_initial = 1;
+ credential_announce_capabilities(&c, stdout);
+}
+
int cmd_credential_cache(int argc, const char **argv, const char *prefix)
{
char *socket_path = NULL;
@@ -147,6 +157,9 @@ int cmd_credential_cache(int argc, const char **argv, const char *prefix)
usage_with_options(usage, options);
op = argv[0];
+ if (!have_unix_sockets())
+ die(_("credential-cache unavailable; no unix socket support"));
+
if (!socket_path)
socket_path = get_socket_path();
if (!socket_path)
@@ -158,6 +171,8 @@ int cmd_credential_cache(int argc, const char **argv, const char *prefix)
do_cache(socket_path, op, timeout, FLAG_RELAY);
else if (!strcmp(op, "store"))
do_cache(socket_path, op, timeout, FLAG_RELAY|FLAG_SPAWN);
+ else if (!strcmp(op, "capability"))
+ announce_capabilities();
else
; /* ignore unknown operation */