src/transports/smart.c


Log

Author Commit Date CI Message
Edward Thomson ca2eb460 2018-07-20T21:50:58 smart subtransport: free url when resetting stream Free the url field when resetting the stream to avoid leaking it.
Patrick Steinhardt 0652abaa 2018-07-20T12:56:49 Merge pull request #4702 from tiennou/fix/coverity Assorted Coverity fixes
Patrick Steinhardt 9994cd3f 2018-06-25T11:56:52 treewide: remove use of C++ style comments C++ style comment ("//") are not specified by the ISO C90 standard and thus do not conform to it. While libgit2 aims to conform to C90, we did not enforce it until now, which is why quite a lot of these non-conforming comments have snuck into our codebase. Do a tree-wide conversion of all C++ style comments to the supported C style comments to allow us enforcing strict C90 compliance in a later commit.
Etienne Samson 6ae6491e 2018-07-06T22:24:16 smart: don't dereference a NULL pkt pointer By clarifying what detect_caps returns on empty/missing packet, we can be sure there are actually refs to process. The old code could blindly dereference `first`, which might have been NULL. Reported by Coverity, CID 1393614
Etienne Samson 68c7480a 2018-07-06T20:21:25 smart: clarify error handling in git_smart__connect
Patrick Steinhardt af3088e4 2018-06-29T11:45:15 refspec: rename `git_refspec__free` to `git_refspec__dispose` Since commit 630a67366 (refspec: add public parsing api, 2018-02-07), we now have two functions `git_refspec_free` and `git_refspec__free`. The difference is that the first one will free the structure itself, while the second one will only free the structure's contents. Use our new `dispose` naming pattern for the latter function to help avoid confusion.
Edward Thomson 12232a5e 2018-06-27T17:19:37 Merge pull request #4698 from nelhage/fix-leaks Fix assorted leaks found via fuzzing
Nelson Elhage d58afb17 2018-06-24T22:28:37 git_smart__connect: free symrefs on error
Nelson Elhage cf335928 2018-06-24T22:22:40 git_smart__update_heads: free the old symref_target
Nelson Elhage 0098d746 2018-06-24T06:51:31 Fix type confusion in git_smart__connect Nothing verifies that t->refs[0] is a GIT_PKT_REF. A remote can send another packet type, ultimately resulting in a type confusion in `git_smart__detect_caps`
Patrick Steinhardt ecf4f33a 2018-02-08T11:14:48 Convert usage of `git_buf_free` to new `git_buf_dispose`
Patrick Steinhardt 0c7f49dd 2017-06-30T13:39:01 Make sure to always include "common.h" first Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
Carlos Martín Nieto 5c760960 2017-04-17T13:03:03 transport: provide a getter for the proxy options As with the callbacks, third-party implementations of smart subtransports cannot reach into the opaque struct and thus cannot know what options the user set. Add a getter for these options to copy the proxy options into something external implementors can use.
Edward Thomson 909d5494 2016-12-29T12:25:15 giterr_set: consistent error messages Error messages should be sentence fragments, and therefore: 1. Should not begin with a capital letter, 2. Should not conclude with punctuation, and 3. Should not end a sentence and begin a new one
Edward Thomson 375bb2fe 2016-04-21T11:02:31 transport: cast away constness for free
Carlos Martín Nieto b117721d 2015-07-29T21:23:56 proxy: use poxy to test our Windows proxy support
Carlos Martín Nieto 07bd3e57 2015-05-07T12:57:56 proxy: ask the user for credentials if necessary
Matt Burke d7375662 2015-09-25T10:16:16 Copy custom_headers insteach of referencing the caller's copy
Matt Burke d16c1b97 2015-09-24T10:30:37 These can be static
Matt Burke e60db3c7 2015-09-24T09:24:10 Revise custom header error messages If the header doesn't look like a header (e.g. if it doesn't have a ":" or if it has newlines), report "custom HTTP header '%s' is malformed". If the header has the same name as a header already set by libgit2 (e.g. "Host"), report "HTTP header '%s' is already set by libgit2".
Matt Burke 63cc5723 2015-09-24T09:13:05 Don't null-check
Matt Burke 098f1e6e 2015-09-24T09:09:48 Use an array of forbidden custom headers
Matt Burke 3245896b 2015-09-10T13:18:26 Add a test for custom header validation Also, *some* custom headers actually are valid.
Matt Burke 66d90e70 2015-09-10T09:14:20 More specific names
Matt Burke 8c876fa9 2015-09-10T09:11:16 Validate custom http headers
Matt Burke 276f6aa0 2015-09-08T14:00:37 Hook up the custom_headers to the http transport
Carlos Martín Nieto 47ed7e5a 2015-08-18T20:55:59 transport: provide a way to get the callbacks libgit2 implementations of smart subtransports can simply reach through the structure, but external implementors cannot. Add these two functions as a way for the smart subtransports to get the callbacks as set by the user.
Leo Yang 142e5379 2015-03-17T12:49:33 Add a custom param to git_smart_subtransport_definition The smart transport has already take the payload param. For the sub transport a payload param is useful for the implementer.
Edward Thomson 392702ee 2015-02-09T23:41:13 allocations: test for overflow of requested size Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
Carlos Martín Nieto 1b75c29e 2014-11-02T11:17:01 gitno: remove code which is no longer needed Most of the network-facing facilities have been copied to the socket and openssl streams. No code now uses these functions directly anymore, so we can now remove them.
Carlos Martín Nieto 9b940586 2014-07-04T12:45:43 Provide a callback for certificate validation If the certificate validation fails (or always in the case of ssh), let the user decide whether to allow the connection. The data structure passed to the user is the native certificate information from the underlying implementation, namely OpenSSL or WinHTTP.
Carlos Martín Nieto 9331f98a 2014-05-22T12:52:31 smart: initialize the error variable
Vicent Marti a5982644 2014-05-22T02:28:42 Merge pull request #2376 from libgit2/cmn/remote-symref Add support for the symref extension
Carlos Martín Nieto 306475eb 2014-05-20T09:55:26 remote: expose the remote's symref mappings Add a symref_target field to git_remote_head to expose the symref mappings to the user.
Carlos Martín Nieto 8156835d 2014-05-20T09:29:39 smart: store reported symrefs The protocol has a capability which allows the server to tell us which refs are symrefs, so we can e.g. know which is the default branch. This capability is different from the ones we already support, as it's not setting a flag to true, but requires us to store a list of refspec-formatted mappings. This commit does not yet expose the information in the reference listing.
Carlos Martín Nieto ac11219b 2014-05-19T16:54:19 smart: send a flush when we disconnect The git server wants to hear a flush from us when we disconnect, particularly when we want to perform a fetch but are up to date.
Russell Belfer 25e0b157 2013-12-06T15:07:57 Remove converting user error to GIT_EUSER This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
Russell Belfer dab89f9b 2013-12-04T21:22:57 Further EUSER and error propagation fixes This continues auditing all the places where GIT_EUSER is being returned and making sure to clear any existing error using the new giterr_user_cancel helper. As a result, places that relied on intercepting GIT_EUSER but having the old error preserved also needed to be cleaned up to correctly stash and then retrieve the actual error. Additionally, as I encountered places where error codes were not being propagated correctly, I tried to fix them up. A number of those fixes are included in the this commit as well.
Carlos Martín Nieto a6192d7c 2013-11-11T15:32:13 remote: update head list on push A previous commit forgot to update the head list after push as well, leading to wrong output of git_remote_ls().
Carlos Martín Nieto 359dce72 2013-11-02T00:05:32 remote: make _ls return the list directly The callback-based method of listing remote references dates back to the beginning of the network code's lifetime, when we didn't know any better. We need to keep the list around for update_tips() after disconnect() so let's make use of this to simply give the user a pointer to the array so they can write straightforward code instead of having to go through a callback.
Jameson Miller 5b188225 2013-10-02T13:45:32 Support cancellation in push operation This commit adds cancellation for the push operation. This work consists of: 1) Support cancellation during push operation - During object counting phase - During network transfer phase - Propagate GIT_EUSER error code out to caller 2) Improve cancellation support during fetch - Handle cancellation request during network transfer phase - Clear error string when cancelled during indexing 3) Fix error handling in git_smart__download_pack Cancellation during push is still only handled in the pack building and network transfer stages of push (and not during packbuilding).
Carlos Martín Nieto 67ba7d20 2013-04-15T22:53:57 Allow git_remote_ls after disconnecting from the remote Keep the data around until free, as expected by our own fetch example
Arkadiy Shapkin 10c06114 2013-03-17T04:46:46 Several warnings detected by static code analyzer fixed Implicit type conversion argument of function to size_t type Suspicious sequence of types castings: size_t -> int -> size_t Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)' Unsigned type is never < 0
Philip Kelley df93a681 2013-02-08T15:00:08 Merge the push report into the refs to avoid a 3rd network call
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Ben Straub 59bccf33 2012-12-10T11:11:01 Add a payload param to git_cred_acquire_cb Fixes #1128.
Ben Straub 10711769 2012-11-29T20:47:37 Deploy versioned git_transport structure
Philip Kelley 6762fe08 2012-11-29T08:29:26 Remove casts of return values of type void *
Philip Kelley 613d5eb9 2012-11-28T11:42:37 Push! By schu, phkelley, and congyiwu, et al
Ben Straub df705148 2012-11-27T13:15:43 API updates for remote.h Includes typedef for git_direction, and renames for GIT_DIR_[FETCH|PUSH] to GIT_DIRECTION_(\1).
Russell Belfer a8122b5d 2012-11-21T15:39:03 Fix warnings on Win64 build
Philip Kelley 091361f5 2012-11-06T08:52:03 Basic authentication for http and winhttp
Philip Kelley 41fb1ca0 2012-10-29T13:41:14 Reorganize transport architecture (squashed 3)