summaryrefslogtreecommitdiff
path: root/src/transports
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-10-28 07:04:58 -0700
committerVicent Martí <vicent@github.com>2013-10-28 07:04:58 -0700
commit5565f3cda864892277cc6b7d1f4967497514db65 (patch)
tree81307b279c4406fb5496156549446436fae0d795 /src/transports
parent8f4a8b096ba35a2af3f9c51dad7e0402790b58ac (diff)
parent70a8c78f3618d70cf6de0961e4e3884a003a1ff0 (diff)
downloadlibgit2-5565f3cda864892277cc6b7d1f4967497514db65.tar.gz
Merge pull request #1904 from libgit2/cmn/ssh-naming
Rename the ssh credentials
Diffstat (limited to 'src/transports')
-rw-r--r--src/transports/cred.c38
-rw-r--r--src/transports/ssh.c12
2 files changed, 25 insertions, 25 deletions
diff --git a/src/transports/cred.c b/src/transports/cred.c
index 79b17e88d..cc7fdab4b 100644
--- a/src/transports/cred.c
+++ b/src/transports/cred.c
@@ -19,13 +19,13 @@ int git_cred_has_username(git_cred *cred)
ret = !!c->username;
break;
}
- case GIT_CREDTYPE_SSH_KEYFILE_PASSPHRASE: {
- git_cred_ssh_keyfile_passphrase *c = (git_cred_ssh_keyfile_passphrase *)cred;
+ case GIT_CREDTYPE_SSH_KEY: {
+ git_cred_ssh_key *c = (git_cred_ssh_key *)cred;
ret = !!c->username;
break;
}
- case GIT_CREDTYPE_SSH_PUBLICKEY: {
- git_cred_ssh_publickey *c = (git_cred_ssh_publickey *)cred;
+ case GIT_CREDTYPE_SSH_CUSTOM: {
+ git_cred_ssh_custom *c = (git_cred_ssh_custom *)cred;
ret = !!c->username;
break;
}
@@ -84,10 +84,10 @@ int git_cred_userpass_plaintext_new(
return 0;
}
-static void ssh_keyfile_passphrase_free(struct git_cred *cred)
+static void ssh_key_free(struct git_cred *cred)
{
- git_cred_ssh_keyfile_passphrase *c =
- (git_cred_ssh_keyfile_passphrase *)cred;
+ git_cred_ssh_key *c =
+ (git_cred_ssh_key *)cred;
git__free(c->username);
git__free(c->publickey);
@@ -104,9 +104,9 @@ static void ssh_keyfile_passphrase_free(struct git_cred *cred)
git__free(c);
}
-static void ssh_publickey_free(struct git_cred *cred)
+static void ssh_custom_free(struct git_cred *cred)
{
- git_cred_ssh_publickey *c = (git_cred_ssh_publickey *)cred;
+ git_cred_ssh_custom *c = (git_cred_ssh_custom *)cred;
git__free(c->username);
git__free(c->publickey);
@@ -115,22 +115,22 @@ static void ssh_publickey_free(struct git_cred *cred)
git__free(c);
}
-int git_cred_ssh_keyfile_passphrase_new(
+int git_cred_ssh_key_new(
git_cred **cred,
const char *username,
const char *publickey,
const char *privatekey,
const char *passphrase)
{
- git_cred_ssh_keyfile_passphrase *c;
+ git_cred_ssh_key *c;
assert(cred && privatekey);
- c = git__calloc(1, sizeof(git_cred_ssh_keyfile_passphrase));
+ c = git__calloc(1, sizeof(git_cred_ssh_key));
GITERR_CHECK_ALLOC(c);
- c->parent.credtype = GIT_CREDTYPE_SSH_KEYFILE_PASSPHRASE;
- c->parent.free = ssh_keyfile_passphrase_free;
+ c->parent.credtype = GIT_CREDTYPE_SSH_KEY;
+ c->parent.free = ssh_key_free;
if (username) {
c->username = git__strdup(username);
@@ -154,7 +154,7 @@ int git_cred_ssh_keyfile_passphrase_new(
return 0;
}
-int git_cred_ssh_publickey_new(
+int git_cred_ssh_custom_new(
git_cred **cred,
const char *username,
const char *publickey,
@@ -162,15 +162,15 @@ int git_cred_ssh_publickey_new(
git_cred_sign_callback sign_callback,
void *sign_data)
{
- git_cred_ssh_publickey *c;
+ git_cred_ssh_custom *c;
assert(cred);
- c = git__calloc(1, sizeof(git_cred_ssh_publickey));
+ c = git__calloc(1, sizeof(git_cred_ssh_custom));
GITERR_CHECK_ALLOC(c);
- c->parent.credtype = GIT_CREDTYPE_SSH_PUBLICKEY;
- c->parent.free = ssh_publickey_free;
+ c->parent.credtype = GIT_CREDTYPE_SSH_CUSTOM;
+ c->parent.free = ssh_custom_free;
if (username) {
c->username = git__strdup(username);
diff --git a/src/transports/ssh.c b/src/transports/ssh.c
index 647211f63..6ce673d5e 100644
--- a/src/transports/ssh.c
+++ b/src/transports/ssh.c
@@ -249,15 +249,15 @@ static int _git_ssh_authenticate_session(
rc = libssh2_userauth_password(session, user, c->password);
break;
}
- case GIT_CREDTYPE_SSH_KEYFILE_PASSPHRASE: {
- git_cred_ssh_keyfile_passphrase *c = (git_cred_ssh_keyfile_passphrase *)cred;
+ case GIT_CREDTYPE_SSH_KEY: {
+ git_cred_ssh_key *c = (git_cred_ssh_key *)cred;
user = c->username ? c->username : user;
rc = libssh2_userauth_publickey_fromfile(
session, c->username, c->publickey, c->privatekey, c->passphrase);
break;
}
- case GIT_CREDTYPE_SSH_PUBLICKEY: {
- git_cred_ssh_publickey *c = (git_cred_ssh_publickey *)cred;
+ case GIT_CREDTYPE_SSH_CUSTOM: {
+ git_cred_ssh_custom *c = (git_cred_ssh_custom *)cred;
user = c->username ? c->username : user;
rc = libssh2_userauth_publickey(
@@ -349,8 +349,8 @@ static int _git_ssh_setup_conn(
if (t->owner->cred_acquire_cb(
&t->cred, t->owner->url, user,
GIT_CREDTYPE_USERPASS_PLAINTEXT |
- GIT_CREDTYPE_SSH_KEYFILE_PASSPHRASE |
- GIT_CREDTYPE_SSH_PUBLICKEY,
+ GIT_CREDTYPE_SSH_KEY |
+ GIT_CREDTYPE_SSH_CUSTOM,
t->owner->cred_acquire_payload) < 0)
goto on_error;