mirror of
https://github.com/QRouland/UTPass.git
synced 2026-01-10 03:26:57 +00:00
Some GIT clone improvements (error messgages ...)
This commit is contained in:
@@ -28,11 +28,13 @@ int GitJob::credentialsCB(git_cred **out, const char *url, const char *username_
|
||||
|
||||
if (!username_from_url) { // we required here that the username must be provided directly in url (maybe improve later on)
|
||||
qWarning() << "[GitJob] credentials_cb : no username provided";
|
||||
p->err = ErrorCodeCB::NoUsername;
|
||||
return (int) GIT_EUSER;
|
||||
}
|
||||
|
||||
if (p->called) {
|
||||
qWarning() << "[GitJob] credentials_cb : cb already called, probably invalid creds";
|
||||
p->err = ErrorCodeCB::InvalidCreds;
|
||||
return (int) GIT_EUSER;
|
||||
}
|
||||
p->called = true;
|
||||
@@ -45,26 +47,24 @@ int GitJob::credentialsCB(git_cred **out, const char *url, const char *username_
|
||||
qWarning() << "[GitJob] credentialsCB : callback should never be call for HTTP";
|
||||
return (int) GIT_EUSER;
|
||||
},
|
||||
[allowed_types, &out, &username_from_url](const HTTPUserPass & x)
|
||||
[allowed_types, &out, &username_from_url, &p](const HTTPUserPass & x)
|
||||
{
|
||||
qDebug() << "[GitJob] credentialsCB : HTTPUserPass ";
|
||||
if (!(allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT)) {
|
||||
qWarning() << "[GitJob] credentials_cb : allowed_types is invalid for HTTPUserPass creds";
|
||||
p->err = ErrorCodeCB::UrlTypeDoNotMatchCreds;
|
||||
return (int) GIT_EUSER;
|
||||
}
|
||||
return git_cred_userpass_plaintext_new(out, username_from_url, x.pass.toLocal8Bit().constData());
|
||||
},
|
||||
[allowed_types, &out, &username_from_url](const SSHKey & x)
|
||||
[allowed_types, &out, &username_from_url , &p](const SSHKey & x)
|
||||
{
|
||||
qDebug() << "[GitJob] credentialsCB : SSHKey ";
|
||||
if (!(allowed_types & GIT_CREDTYPE_SSH_KEY)) {
|
||||
qWarning() << "[GitJob] credentials_cb : allowed_types is invalid for SSHKey creds";
|
||||
p->err = ErrorCodeCB::UrlTypeDoNotMatchCreds;
|
||||
return (int) GIT_EUSER;
|
||||
}
|
||||
qDebug() << "[GitJob] username_from_url :" << username_from_url;
|
||||
qDebug() << "[GitJob] pub_key :" << x.pub_key.toLocal8Bit().constData();
|
||||
qDebug() << "[GitJob] priv_key :" << x.priv_key.toLocal8Bit().constData();
|
||||
qDebug() << "[GitJob] passphrase :" << x.passphrase.toLocal8Bit().constData();
|
||||
return git_cred_ssh_key_new(out, username_from_url, x.pub_key.toLocal8Bit().constData(),
|
||||
x.priv_key.toLocal8Bit().constData(), x.passphrase.toLocal8Bit().constData());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user