summaryrefslogtreecommitdiff
path: root/src/transports/ssh.c
Commit message (Collapse)AuthorAgeFilesLines
* ssh: store error message immediately after a failed agent callcmn/ssh-errorsCarlos Martín Nieto2014-09-041-1/+7
| | | | | | | | | | | | | | When the call to the agent fails, we must retrieve the error message just after the function call, as other calls may overwrite it. As the agent authentication is the only one which has a teardown and there does not seem to be a way to get the error message from a stored error number, this tries to introduce some small changes to store the error from the agent. Clearing the error at the beginning of the loop lets us know whether the agent has already set the libgit2 error message and we should skip it, or if we should set it.
* Merge remote-tracking branch 'upstream/master' into cmn/ssh-retryCarlos Martín Nieto2014-08-271-5/+70
|\
| * ssh: Fix unused warningVicent Marti2014-07-161-0/+1
| |
| * ssh: provide a factory function for setting ssh pathscmn/ssh-factory-for-pathsCarlos Martín Nieto2014-07-071-2/+52
| | | | | | | | | | | | | | | | | | git allows you to set which paths to use for the git server programs when connecting over ssh; and we want to provide something similar. We do this by providing a factory function which can be set as the remote's transport callback which will set the given paths upon creation.
| * Include libssh2.h before git2.h (transport.h)Jacques Germishuys2014-07-031-2/+4
| |
| * ssh: libssh2_channel_write() behaves like send()cmn/ssh-send-everythingCarlos Martín Nieto2014-07-021-1/+12
| | | | | | | | | | | | | | | | | | | | When the stream writing function was written, it assume that libssh2_channel_write() would always write all of the data to the wire. This is only true for the first 32k of data, which it tries to fit into one ssh packet. Since it can perform short writes, call it in a loop like we do for send(), advancing the buffer offset.
* | ssh: make sure to ask for a username and use the same oneCarlos Martín Nieto2014-06-261-34/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to know which authentication methods are supported/allowed by the ssh server, we need to send a NONE auth request, which needs a username associated with it. Most ssh server implementations do not allow switching the username between authentication attempts, which means we cannot use a dummy username and then switch. There are two ways around this. The first is to use a different connection, which an earlier commit implements, but this increases how long it takes to get set up, and without knowing the right username, we cannot guarantee that the list we get in response is the right one. The second is what's implemented here: if there is no username specified in the url, ask for it first. We can then ask for the list of auth methods and use the user's credentials in the same connection.
* | ssh: request credentials again on authentication failureCarlos Martín Nieto2014-06-261-26/+60
| | | | | | | | | | Instead of completely giving up on the first failure, ask for credentials as long as we fail to authenticate.
* | ssh: propagate the error code from the auth callbackCarlos Martín Nieto2014-06-171-13/+12
| | | | | | | | We need to be able to get a GIT_EUSER back through the outermost call.
* | ssh: detect authentication methodsCarlos Martín Nieto2014-06-171-6/+77
|/ | | | | | | | Before calling the credentials callback, ask the sever which authentication methods it supports and report that to the user, instead of simply reporting everything that the transport supports. In case of an error, we do fall back to listing all of them.
* transports: allow the creds callback to say it doesn't existCarlos Martín Nieto2014-04-221-12/+20
| | | | | | | | Allow the credentials callback to return GIT_PASSTHROUGH to make the transports code behave as though none was set. This should make it easier for bindings to behave closer to the C code when there is no credentials callback set at their level.
* Make git_cred_ssh_custom_new() naming more consistentJacques Germishuys2014-04-181-1/+1
|
* Introduce git_cred_ssh_interactive_new()Jacques Germishuys2014-04-181-0/+22
| | | | This allows for keyboard-interactive based SSH authentication
* cred: tighten username rulesCarlos Martín Nieto2014-04-181-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | The ssh-specific credentials allow the username to be missing. The idea being that the ssh transport will then use the username provided in the url, if it's available. There are two main issues with this. The credential callback already knows what username was provided by the url and needs to figure out whether it wants to ask the user for it or it can reuse it, so passing NULL as the username means the credential callback is suspicious. The username provided in the url is not in fact used by the transport. The only time it even considers it is for the user/pass credential, which asserts the existence of a username in its constructor. For the ssh-specific ones, it passes in the username stored in the credential, which is NULL. The libssh2 macro we use runs strlen() against this value (which is no different from what we would be doing ourselves), so we then crash. As the documentation doesn't suggest to leave out the username, assert the need for a username in the code, which removes this buggy behavior and removes implicit state. git_cred_has_username() becomes a blacklist of credential types that do not have a username. The only one at the moment is the 'default' one, which is meant to call up some Microsoft magic.
* - BUGFIX #2133 (@fourplusone) in smart_protocol.cMiha2014-02-251-1/+2
| | | | | | - added MSVC cmake definitions to disable warnings - general.c is rewritten so it is ansi-c compatible and compiles ok on microsoft windows - some MSVC reported warning fixes
* ssh: add support for ssh-agent authenticationAlessandro Ghedini2013-11-201-2/+52
|
* Fix ssh.c compileBen Straub2013-11-041-2/+3
|
* Use http_parser_parse_url to parse urlsBen Straub2013-11-041-1/+0
|
* Prevent another segfault from bad URLBen Straub2013-10-311-5/+6
|
* Rename the ssh credentialsCarlos Martín Nieto2013-10-231-6/+6
| | | | | | The names from libssh2 are somewhat obtuse for us. We can simplify the usual key/passphrase credential's name, as well as make clearer what the custom signature function is.
* Allowed credential types should be a bitfieldEdward Thomson2013-10-211-1/+2
|
* Whitespace.Etienne Samson2013-09-161-1/+1
|
* Add a wrapper to provide the libssh2 error messageEtienne Samson2013-09-161-13/+21
|
* Test for repo before removing leading colonIsaac Kearse2013-09-101-1/+1
|
* Trim leading colon from ssh repository pathIsaac Kearse2013-09-081-0/+1
|
* Commit 7affc2f7 removed var initializationRussell Belfer2013-08-141-0/+1
| | | | | | That commit accidentally removed the initialization of the "start" variable giving undefined results for the host extraction from the url input.
* Include username in each credential typeCarlos Martín Nieto2013-08-121-10/+12
| | | | | | | | Key-based authentication also needs an username, so include it in each one. Also stop assuming a default username of "git" in the ssh transport which has no business making such a decision.
* Bring SSH error reporting up to base standardsRussell Belfer2013-07-101-79/+72
| | | | | | | The SSH error checking and reporting could still be further improved by using the libssh2 native methods to get error info, but at least this ensures that all error codes are checked and translated into libgit2 error messages.
* Merge branch 'ssh-cred-fix' of tiennou/libgit2Russell Belfer2013-07-101-25/+35
|\ | | | | | | | | Conflicts: src/transports/ssh.c
| * Tab indent.Etienne Samson2013-07-101-90/+92
| |
| * Add some missing error messages.Etienne Samson2013-07-101-9/+16
| |
| * Fix a probable leak.Etienne Samson2013-07-031-1/+1
| |
| * Fix a crash if git_remote_set_cred_acquire_cb wasn't called before connecting.Etienne Samson2013-07-031-2/+4
| | | | | | | | Fixes #1700.
* | Make SSH APIs present even without SSH supportRussell Belfer2013-07-091-86/+95
|/ | | | | | The SSH APIs will just return an error code and state that the library was built without SSH support if they are called in that case.
* Added GITERR_CHECK_ALLOCBrad Morgan2013-05-151-0/+1
|
* Added error checkBrad Morgan2013-05-151-1/+2
|
* CleanupBrad Morgan2013-05-151-12/+6
|
* Changed to use libssh2_channel_execBrad Morgan2013-05-091-6/+3
|
* RenamingBrad Morgan2013-05-091-8/+8
|
* Fixed compilation issues when libssh2 is missingBrad Morgan2013-05-071-0/+4
|
* Added SSH public key authenticationBrad Morgan2013-05-071-0/+12
|
* CleanupBrad Morgan2013-05-051-7/+5
|
* RenamingBrad Morgan2013-05-051-6/+6
|
* RefactoringBrad Morgan2013-05-051-27/+66
|
* CleanupBrad Morgan2013-05-051-1/+1
|
* Added username and password auth for sshBrad Morgan2013-05-051-17/+41
|
* Added support for ssh:// urlsBrad Morgan2013-05-051-21/+45
|
* RefactoringBrad Morgan2013-05-051-59/+43
|
* Added ssh stream cleanupBrad Morgan2013-05-051-1/+10
|
* CleanupBrad Morgan2013-05-051-17/+7
|