Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
574b86b7
Commit
574b86b7
authored
May 07, 2013
by
Brad Morgan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed compilation issues when libssh2 is missing
parent
c36565c0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
2 deletions
+23
-2
include/git2/transport.h
+6
-0
src/transport.c
+11
-2
src/transports/cred.c
+2
-0
src/transports/ssh.c
+4
-0
No files found.
include/git2/transport.h
View file @
574b86b7
...
@@ -11,7 +11,9 @@
...
@@ -11,7 +11,9 @@
#include "net.h"
#include "net.h"
#include "types.h"
#include "types.h"
#ifdef GIT_SSH
#include <libssh2.h>
#include <libssh2.h>
#endif
/**
/**
* @file git2/transport.h
* @file git2/transport.h
...
@@ -47,6 +49,7 @@ typedef struct git_cred_userpass_plaintext {
...
@@ -47,6 +49,7 @@ typedef struct git_cred_userpass_plaintext {
char
*
password
;
char
*
password
;
}
git_cred_userpass_plaintext
;
}
git_cred_userpass_plaintext
;
#ifdef GIT_SSH
/* A ssh key file and passphrase */
/* A ssh key file and passphrase */
typedef
struct
git_cred_ssh_keyfile_passphrase
{
typedef
struct
git_cred_ssh_keyfile_passphrase
{
git_cred
parent
;
git_cred
parent
;
...
@@ -63,6 +66,7 @@ typedef struct git_cred_ssh_publickey {
...
@@ -63,6 +66,7 @@ typedef struct git_cred_ssh_publickey {
void
*
sign_callback
;
void
*
sign_callback
;
void
*
sign_data
;
void
*
sign_data
;
}
git_cred_ssh_publickey
;
}
git_cred_ssh_publickey
;
#endif
/**
/**
* Creates a new plain-text username and password credential object.
* Creates a new plain-text username and password credential object.
...
@@ -78,6 +82,7 @@ GIT_EXTERN(int) git_cred_userpass_plaintext_new(
...
@@ -78,6 +82,7 @@ GIT_EXTERN(int) git_cred_userpass_plaintext_new(
const
char
*
username
,
const
char
*
username
,
const
char
*
password
);
const
char
*
password
);
#ifdef GIT_SSH
/**
/**
* Creates a new ssh key file and passphrase credential object.
* Creates a new ssh key file and passphrase credential object.
* The supplied credential parameter will be internally duplicated.
* The supplied credential parameter will be internally duplicated.
...
@@ -111,6 +116,7 @@ GIT_EXTERN(int) git_cred_ssh_publickey_new(
...
@@ -111,6 +116,7 @@ GIT_EXTERN(int) git_cred_ssh_publickey_new(
size_t
publickey_len
,
size_t
publickey_len
,
LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC
((
*
sign_callback
)),
LIBSSH2_USERAUTH_PUBLICKEY_SIGN_FUNC
((
*
sign_callback
)),
void
*
sign_data
);
void
*
sign_data
);
#endif
/**
/**
* Signature of a function which acquires a credential object.
* Signature of a function which acquires a credential object.
...
...
src/transport.c
View file @
574b86b7
...
@@ -20,20 +20,25 @@ typedef struct transport_definition {
...
@@ -20,20 +20,25 @@ typedef struct transport_definition {
static
git_smart_subtransport_definition
http_subtransport_definition
=
{
git_smart_subtransport_http
,
1
};
static
git_smart_subtransport_definition
http_subtransport_definition
=
{
git_smart_subtransport_http
,
1
};
static
git_smart_subtransport_definition
git_subtransport_definition
=
{
git_smart_subtransport_git
,
0
};
static
git_smart_subtransport_definition
git_subtransport_definition
=
{
git_smart_subtransport_git
,
0
};
#ifdef GIT_SSH
static
git_smart_subtransport_definition
ssh_subtransport_definition
=
{
git_smart_subtransport_ssh
,
0
};
static
git_smart_subtransport_definition
ssh_subtransport_definition
=
{
git_smart_subtransport_ssh
,
0
};
#endif
static
transport_definition
local_transport_definition
=
{
"file://"
,
1
,
git_transport_local
,
NULL
};
static
transport_definition
local_transport_definition
=
{
"file://"
,
1
,
git_transport_local
,
NULL
};
#ifdef GIT_WIN32
#ifdef GIT_SSH
static
transport_definition
ssh_transport_definition
=
{
"ssh://"
,
1
,
git_transport_smart
,
&
ssh_subtransport_definition
};
#else
static
transport_definition
dummy_transport_definition
=
{
NULL
,
1
,
git_transport_dummy
,
NULL
};
static
transport_definition
dummy_transport_definition
=
{
NULL
,
1
,
git_transport_dummy
,
NULL
};
#endif
#endif
static
transport_definition
ssh_transport_definition
=
{
"ssh://"
,
1
,
git_transport_smart
,
&
ssh_subtransport_definition
};
static
transport_definition
transports
[]
=
{
static
transport_definition
transports
[]
=
{
{
"git://"
,
1
,
git_transport_smart
,
&
git_subtransport_definition
},
{
"git://"
,
1
,
git_transport_smart
,
&
git_subtransport_definition
},
{
"http://"
,
1
,
git_transport_smart
,
&
http_subtransport_definition
},
{
"http://"
,
1
,
git_transport_smart
,
&
http_subtransport_definition
},
{
"https://"
,
1
,
git_transport_smart
,
&
http_subtransport_definition
},
{
"https://"
,
1
,
git_transport_smart
,
&
http_subtransport_definition
},
{
"file://"
,
1
,
git_transport_local
,
NULL
},
{
"file://"
,
1
,
git_transport_local
,
NULL
},
#ifdef GIT_SSH
{
"ssh://"
,
1
,
git_transport_smart
,
&
ssh_subtransport_definition
},
{
"ssh://"
,
1
,
git_transport_smart
,
&
ssh_subtransport_definition
},
#endif
{
NULL
,
0
,
0
}
{
NULL
,
0
,
0
}
};
};
...
@@ -76,7 +81,11 @@ static int transport_find_fn(const char *url, git_transport_cb *callback, void *
...
@@ -76,7 +81,11 @@ static int transport_find_fn(const char *url, git_transport_cb *callback, void *
/* It could be a SSH remote path. Check to see if there's a :
/* It could be a SSH remote path. Check to see if there's a :
* SSH is an unsupported transport mechanism in this version of libgit2 */
* SSH is an unsupported transport mechanism in this version of libgit2 */
if
(
!
definition
&&
strrchr
(
url
,
':'
))
if
(
!
definition
&&
strrchr
(
url
,
':'
))
#ifdef GIT_SSH
definition
=
&
ssh_transport_definition
;
definition
=
&
ssh_transport_definition
;
#else
definition
=
&
dummy_transport_definition
;
#endif
/* Check to see if the path points to a file on the local file system */
/* Check to see if the path points to a file on the local file system */
if
(
!
definition
&&
git_path_exists
(
url
)
&&
git_path_isdir
(
url
))
if
(
!
definition
&&
git_path_exists
(
url
)
&&
git_path_isdir
(
url
))
...
...
src/transports/cred.c
View file @
574b86b7
...
@@ -59,6 +59,7 @@ int git_cred_userpass_plaintext_new(
...
@@ -59,6 +59,7 @@ int git_cred_userpass_plaintext_new(
return
0
;
return
0
;
}
}
#ifdef GIT_SSH
static
void
ssh_keyfile_passphrase_free
(
struct
git_cred
*
cred
)
static
void
ssh_keyfile_passphrase_free
(
struct
git_cred
*
cred
)
{
{
git_cred_ssh_keyfile_passphrase
*
c
=
(
git_cred_ssh_keyfile_passphrase
*
)
cred
;
git_cred_ssh_keyfile_passphrase
*
c
=
(
git_cred_ssh_keyfile_passphrase
*
)
cred
;
...
@@ -184,3 +185,4 @@ int git_cred_ssh_publickey_new(
...
@@ -184,3 +185,4 @@ int git_cred_ssh_publickey_new(
*
cred
=
&
c
->
parent
;
*
cred
=
&
c
->
parent
;
return
0
;
return
0
;
}
}
#endif
src/transports/ssh.c
View file @
574b86b7
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
* a Linking Exception. For full terms see the included COPYING file.
* a Linking Exception. For full terms see the included COPYING file.
*/
*/
#ifdef GIT_SSH
#include "git2.h"
#include "git2.h"
#include "buffer.h"
#include "buffer.h"
#include "netops.h"
#include "netops.h"
...
@@ -520,3 +522,5 @@ int git_smart_subtransport_ssh(git_smart_subtransport **out, git_transport *owne
...
@@ -520,3 +522,5 @@ int git_smart_subtransport_ssh(git_smart_subtransport **out, git_transport *owne
*
out
=
(
git_smart_subtransport
*
)
t
;
*
out
=
(
git_smart_subtransport
*
)
t
;
return
0
;
return
0
;
}
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment