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
6b36945d
Commit
6b36945d
authored
Aug 20, 2015
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3388 from libgit2/cmn/smart-callbacks
transport: provide a way to get the callbacks
parents
88201608
57af0b92
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
0 deletions
+55
-0
include/git2/sys/transport.h
+22
-0
include/git2/transport.h
+11
-0
src/transports/cred.c
+8
-0
src/transports/smart.c
+14
-0
No files found.
include/git2/sys/transport.h
View file @
6b36945d
...
...
@@ -211,6 +211,28 @@ GIT_EXTERN(int) git_transport_smart(
git_remote
*
owner
,
/* (git_smart_subtransport_definition *) */
void
*
payload
);
/**
* Call the certificate check for this transport.
*
* @param transport a smart transport
* @param cert the certificate to pass to the caller
* @param valid whether we believe the certificate is valid
* @param hostname the hostname we connected to
* @return the return value of the callback
*/
GIT_EXTERN
(
int
)
git_transport_smart_certificate_check
(
git_transport
*
transport
,
git_cert
*
cert
,
int
valid
,
const
char
*
hostname
);
/**
* Call the credentials callback for this transport
*
* @param out the pointer where the creds are to be stored
* @param transport a smart transport
* @param user the user we saw on the url (if any)
* @param methods available methods for authentication
* @return the return value of the callback
*/
GIT_EXTERN
(
int
)
git_transport_smart_credentials
(
git_cred
**
out
,
git_transport
*
transport
,
const
char
*
user
,
int
methods
);
/*
*** End of base transport interface ***
*** Begin interface for subtransports for the smart transport ***
...
...
include/git2/transport.h
View file @
6b36945d
...
...
@@ -307,6 +307,17 @@ GIT_EXTERN(int) git_cred_ssh_key_memory_new(
const
char
*
privatekey
,
const
char
*
passphrase
);
/**
* Free a credential.
*
* This is only necessary if you own the object; that is, if you are a
* transport.
*
* @param cred the object to free
*/
GIT_EXTERN
(
void
)
git_cred_free
(
git_cred
*
cred
);
/**
* Signature of a function which acquires a credential object.
*
...
...
src/transports/cred.c
View file @
6b36945d
...
...
@@ -378,3 +378,11 @@ int git_cred_username_new(git_cred **cred, const char *username)
*
cred
=
(
git_cred
*
)
c
;
return
0
;
}
void
git_cred_free
(
git_cred
*
cred
)
{
if
(
!
cred
)
return
;
cred
->
free
(
cred
);
}
src/transports/smart.c
View file @
6b36945d
...
...
@@ -372,6 +372,20 @@ static int ref_name_cmp(const void *a, const void *b)
return
strcmp
(
ref_a
->
head
.
name
,
ref_b
->
head
.
name
);
}
int
git_transport_smart_certificate_check
(
git_transport
*
transport
,
git_cert
*
cert
,
int
valid
,
const
char
*
hostname
)
{
transport_smart
*
t
=
(
transport_smart
*
)
transport
;
return
t
->
certificate_check_cb
(
cert
,
valid
,
hostname
,
t
->
message_cb_payload
);
}
int
git_transport_smart_credentials
(
git_cred
**
out
,
git_transport
*
transport
,
const
char
*
user
,
int
methods
)
{
transport_smart
*
t
=
(
transport_smart
*
)
transport
;
return
t
->
cred_acquire_cb
(
out
,
t
->
url
,
user
,
methods
,
t
->
cred_acquire_payload
);
}
int
git_transport_smart
(
git_transport
**
out
,
git_remote
*
owner
,
void
*
param
)
{
transport_smart
*
t
;
...
...
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