aboutsummaryrefslogtreecommitdiff
path: root/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'connect.c')
-rw-r--r--connect.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/connect.c b/connect.c
index acd39d70c..108f5ab60 100644
--- a/connect.c
+++ b/connect.c
@@ -9,6 +9,7 @@
#include "url.h"
#include "string-list.h"
#include "sha1-array.h"
+#include "transport.h"
static char *server_capabilities;
static const char *parse_feature_value(const char *, const char *, int *);
@@ -254,7 +255,7 @@ static const char *prot_name(enum protocol protocol)
case PROTO_GIT:
return "git";
default:
- return "unkown protocol";
+ return "unknown protocol";
}
}
@@ -332,7 +333,7 @@ static const char *ai_name(const struct addrinfo *ai)
static char addr[NI_MAXHOST];
if (getnameinfo(ai->ai_addr, ai->ai_addrlen, addr, sizeof(addr), NULL, 0,
NI_NUMERICHOST) != 0)
- strcpy(addr, "(unknown)");
+ xsnprintf(addr, sizeof(addr), "(unknown)");
return addr;
}
@@ -694,6 +695,8 @@ struct child_process *git_connect(int fd[2], const char *url,
else
target_host = xstrdup(hostandport);
+ transport_check_allowed("git");
+
/* These underlying connection commands die() if they
* cannot connect.
*/
@@ -730,6 +733,7 @@ struct child_process *git_connect(int fd[2], const char *url,
int putty = 0, tortoiseplink = 0;
char *ssh_host = hostandport;
const char *port = NULL;
+ transport_check_allowed("ssh");
get_host_and_port(&ssh_host, &port);
if (!port)
@@ -785,6 +789,8 @@ struct child_process *git_connect(int fd[2], const char *url,
argv_array_push(&conn->args, port);
}
argv_array_push(&conn->args, ssh_host);
+ } else {
+ transport_check_allowed("file");
}
argv_array_push(&conn->args, cmd.buf);