Commit 219f318c by Etienne Samson

Fix a crash if git_remote_set_cred_acquire_cb wasn't called before connecting.

Fixes #1700.
parent 4ae29053
...@@ -345,14 +345,16 @@ static int _git_ssh_setup_conn( ...@@ -345,14 +345,16 @@ static int _git_ssh_setup_conn(
if (user && pass) { if (user && pass) {
if (git_cred_userpass_plaintext_new(&t->cred, user, pass) < 0) if (git_cred_userpass_plaintext_new(&t->cred, user, pass) < 0)
goto on_error; goto on_error;
} else { } else if (t->owner->cred_acquire_cb) {
if (t->owner->cred_acquire_cb(&t->cred, if (t->owner->cred_acquire_cb(&t->cred,
t->owner->url, t->owner->url,
user, user,
GIT_CREDTYPE_USERPASS_PLAINTEXT | GIT_CREDTYPE_SSH_KEYFILE_PASSPHRASE, GIT_CREDTYPE_USERPASS_PLAINTEXT | GIT_CREDTYPE_SSH_KEYFILE_PASSPHRASE,
t->owner->cred_acquire_payload) < 0) t->owner->cred_acquire_payload) < 0)
return -1; return -1;
} } else {
goto on_error;
}
assert(t->cred); assert(t->cred);
if (!user) { if (!user) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment