diff options
author | Etienne Samson <tiennou7@gmail.com> | 2013-07-03 22:02:29 +0200 |
---|---|---|
committer | Etienne Samson <tiennou7@gmail.com> | 2013-07-03 22:10:05 +0200 |
commit | 219f318c051a37c05dd66687695ebec9f1a90e53 (patch) | |
tree | 7981a218a8fb77050130874e77cb8fc1e4f2c16b /src/transports/ssh.c | |
parent | 4ae29053d51968cbf49f30ae14e5405cbd9543cc (diff) | |
download | libgit2-219f318c051a37c05dd66687695ebec9f1a90e53.tar.gz |
Fix a crash if git_remote_set_cred_acquire_cb wasn't called before connecting.
Fixes #1700.
Diffstat (limited to 'src/transports/ssh.c')
-rw-r--r-- | src/transports/ssh.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/transports/ssh.c b/src/transports/ssh.c index a312c8d08..8e3657dde 100644 --- a/src/transports/ssh.c +++ b/src/transports/ssh.c @@ -345,14 +345,16 @@ static int _git_ssh_setup_conn( if (user && pass) { if (git_cred_userpass_plaintext_new(&t->cred, user, pass) < 0) goto on_error; - } else { + } else if (t->owner->cred_acquire_cb) { if (t->owner->cred_acquire_cb(&t->cred, t->owner->url, user, GIT_CREDTYPE_USERPASS_PLAINTEXT | GIT_CREDTYPE_SSH_KEYFILE_PASSPHRASE, t->owner->cred_acquire_payload) < 0) return -1; - } + } else { + goto on_error; + } assert(t->cred); if (!user) { |