- 02 7月, 2016 3 次提交
-
-
由 Jeff King 提交于
This should be part of every program, as otherwise users do not get translated error messages. However, some external commands forgot to do so (e.g., git-credential-store). This fixes them, and eliminates the repeated code in programs that did remember to use it. Signed-off-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Jeff King 提交于
Every program which links against libgit.a must call this function, or risk hitting an assert() in system_path() that checks whether we have configured argv0_path (though only when RUNTIME_PREFIX is defined, so essentially only on Windows). Looking at the diff, you can see that putting it into the common main() saves us having to do it individually in each of the external commands. But what you can't see are the cases where we _should_ have been doing so, but weren't (e.g., git-credential-store, and all of the t/helper test programs). This has been an accident-waiting-to-happen for a long time, but wasn't triggered until recently because it involves one of those programs actually calling system_path(). That happened with git-credential-store in v2.8.0 with ae5f6776 (lazily load core.sharedrepository, 2016-03-11). The program: - takes a lock file, which... - opens a tempfile, which... - calls adjust_shared_perm to fix permissions, which... - lazy-loads the config (as of ae5f6776), which... - calls system_path() to find the location of /etc/gitconfig On systems with RUNTIME_PREFIX, this means credential-store reliably hits that assert() and cannot be used. We never noticed in the test suite, because we set GIT_CONFIG_NOSYSTEM there, which skips the system_path() lookup entirely. But if we were to tweak git_config() to find /etc/gitconfig even when we aren't going to open it, then the test suite shows multiple failures (for credential-store, and for some other test helpers). I didn't include that tweak here because it's way too specific to this particular call to be worth carrying around what is essentially dead code. The implementation is fairly straightforward, with one exception: there is exactly one caller (git.c) that actually cares about the result of the function, and not the side-effect of setting up argv0_path. We can accommodate that by simply replacing the value of argv[0] in the array we hand down to cmd_main(). Signed-off-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Jeff King 提交于
There are certain startup tasks that we expect every git process to do. In some cases this is just to improve the quality of the program (e.g., setting up gettext()). In others it is a requirement for using certain functions in libgit.a (e.g., system_path() expects that you have called git_extract_argv0_path()). Most commands are builtins and are covered by the git.c version of main(). However, there are still a few external commands that use their own main(). Each of these has to remember to include the correct startup sequence, and we are not always consistent. Rather than just fix the inconsistencies, let's make this harder to get wrong by providing a common main() that can run this standard startup. We basically have two options to do this: - the compat/mingw.h file already does something like this by adding a #define that replaces the definition of main with a wrapper that calls mingw_startup(). The upside is that the code in each program doesn't need to be changed at all; it's rewritten on the fly by the preprocessor. The downside is that it may make debugging of the startup sequence a bit more confusing, as the preprocessor is quietly inserting new code. - the builtin functions are all of the form cmd_foo(), and git.c's main() calls them. This is much more explicit, which may make things more obvious to somebody reading the code. It's also more flexible (because of course we have to figure out _which_ cmd_foo() to call). The downside is that each of the builtins must define cmd_foo(), instead of just main(). This patch chooses the latter option, preferring the more explicit approach, even though it is more invasive. We introduce a new file common-main.c, with the "real" main. It expects to call cmd_main() from whatever other objects it is linked against. We link common-main.o against anything that links against libgit.a, since we know that such programs will need to do this setup. Note that common-main.o can't actually go inside libgit.a, as the linker would not pick up its main() function automatically (it has no callers). The rest of the patch is just adjusting all of the various external programs (mostly in t/helper) to use cmd_main(). I've provided a global declaration for cmd_main(), which means that all of the programs also need to match its signature. In particular, many functions need to switch to "const char **" instead of "char **" for argv. This effect ripples out to a few other variables and functions, as well. This makes the patch even more invasive, but the end result is much better. We should be treating argv strings as const anyway, and now all programs conform to the same signature (which also matches the way builtins are defined). Signed-off-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 25 5月, 2016 1 次提交
-
-
由 Elia Pinto 提交于
Permit the use of the GIT_TRACE_CURL environment variable calling the setup_curl_trace http.c helper routine. Helped-by: NTorsten Bögershausen <tboegi@web.de> Helped-by: NRamsay Jones <ramsay@ramsayjones.plus.com> Helped-by: NJunio C Hamano <gitster@pobox.com> Helped-by: NEric Sunshine <sunshine@sunshineco.com> Helped-by: NJeff King <peff@peff.net> Signed-off-by: NElia Pinto <gitter.spiros@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 14 4月, 2016 2 次提交
-
-
由 Kazuki Yamaguchi 提交于
Remove extra + 1 from resp_len, the length of the byte sequence to be Base64 encoded and passed to the server as the response. Or the response incorrectly contains an extra \0. Signed-off-by: NKazuki Yamaguchi <k@rhe.jp> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Kazuki Yamaguchi 提交于
Don't check for NOLOGIN (LOGINDISABLED) capability when imap.authMethod is specified. LOGINDISABLED capability doesn't forbid using AUTHENTICATE, so it should be allowed, or we can't connect to IMAP servers which only accepts AUTHENTICATE command. Signed-off-by: NKazuki Yamaguchi <k@rhe.jp> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 09 4月, 2016 3 次提交
-
-
由 Kazuki Yamaguchi 提交于
Use SSLv23_method always and disable SSL if needed. TLSv1_method() function is deprecated in OpenSSL 1.1.0 and the compiler emits a warning. SSLv23_method() is also deprecated, but the alternative, TLS_method(), is new in OpenSSL 1.1.0 so requires checking by configure. Stick to SSLv23_method() for now (this is aliased to TLS_method()). Signed-off-by: NKazuki Yamaguchi <k@rhe.jp> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Kazuki Yamaguchi 提交于
SSL_CTX_new() may fail with return value NULL. Signed-off-by: NKazuki Yamaguchi <k@rhe.jp> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Kazuki Yamaguchi 提交于
Fix compile errors with OpenSSL 1.1.0. HMAC_CTX is made opaque and HMAC_CTX_cleanup is removed in OpenSSL 1.1.0. But since we just want to calculate one HMAC, we can use HMAC() here, which exists since OpenSSL 0.9.6 at least. Signed-off-by: NKazuki Yamaguchi <k@rhe.jp> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 23 2月, 2016 1 次提交
-
-
由 Jeff King 提交于
We frequently allocate strings as xmalloc(len + 1), where the extra 1 is for the NUL terminator. This can be done more simply with xmallocz, which also checks for integer overflow. There's no case where switching xmalloc(n+1) to xmallocz(n) is wrong; the result is the same length, and malloc made no guarantees about what was in the buffer anyway. But in some cases, we can stop manually placing NUL at the end of the allocated buffer. But that's only safe if it's clear that the contents will always fill the buffer. In each case where this patch does so, I manually examined the control flow, and I tried to err on the side of caution. Signed-off-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 27 10月, 2015 1 次提交
-
-
由 Johannes Schindelin 提交于
This fixes the compilation on an older Linux that was used to debug test failures when upgrading Git for Windows to Git v2.3.0. Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 26 9月, 2015 1 次提交
-
-
由 Jeff King 提交于
It's a common pattern to do: foo = xmalloc(strlen(one) + strlen(two) + 1 + 1); sprintf(foo, "%s %s", one, two); (or possibly some variant with strcpy()s or a more complicated length computation). We can switch these to use xstrfmt, which is shorter, involves less error-prone manual computation, and removes many sprintf and strcpy calls which make it harder to audit the code for real buffer overflows. Signed-off-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 11 3月, 2015 1 次提交
-
-
由 Kyle J. McKay 提交于
If both USE_CURL_FOR_IMAP_SEND and NO_OPENSSL are defined do not force the user to add --curl to get a working git imap-send command. Instead automatically select --curl and warn and ignore the --no-curl option. And while we're in there, correct the warning message when --curl is requested but not supported. Signed-off-by: NKyle J. McKay <mackyle@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 07 1月, 2015 2 次提交
-
-
由 Kyle J. McKay 提交于
According to the cURL documentation for the CURLOPT_USE_SSL option, it is only used with plain text protocols that get upgraded to SSL using the STARTTLS command. The server.use_ssl variable is only set when we are using a protocol that is already SSL/TLS (i.e. imaps), so setting CURLOPT_USE_SSL when the server.use_ssl variable is set has no effect whatsoever. Instead, set CURLOPT_USE_SSL to CURLUSESSL_TRY when the server.use_ssl variable is NOT set so that cURL will attempt to upgrade the plain text connection to SSL/TLS using STARTTLS in that case. This much more closely matches the behavior of the non-cURL code path. Signed-off-by: NKyle J. McKay <mackyle@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Kyle J. McKay 提交于
When using git-imap-send to send via cURL, support setting the GIT_CURL_VERBOSE environment variable to enable cURL's verbose mode. The existing http.c code already supports this and does it by simply checking to see whether or not the environment variable exists -- it does not examine the value at all. For consistency, enable CURLOPT_VERBOSE when GIT_CURL_VERBOSE is set by using the exact same test that http.c does. Signed-off-by: NKyle J. McKay <mackyle@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 11 11月, 2014 1 次提交
-
-
由 Bernhard Reiter 提交于
Use libcurl's high-level API functions to implement git-imap-send instead of the previous low-level OpenSSL-based functions. Since version 7.30.0, libcurl's API has been able to communicate with IMAP servers. Using those high-level functions instead of the current ones would reduce imap-send.c by some 1200 lines of code. For now, the old ones are wrapped in #ifdefs, and the new functions are enabled by make if curl's version is >= 7.34.0, from which version on curl's CURLOPT_LOGIN_OPTIONS (enabling IMAP authentication) parameter has been available. The low-level functions will still be used for tunneling into the server for now. As I don't have access to that many IMAP servers, I haven't been able to test the new code with a wide variety of parameter combinations. I did test both secure and insecure (imaps:// and imap://) connections and values of "PLAIN" and "LOGIN" for the authMethod. In order to suppress a sparse warning about "using sizeof on a function", we use the same solution used in commit 9371322a ("sparse: suppress some "using sizeof on a function" warnings", 06-10-2013) which solved exactly this problem for the other commands using libcurl. Helped-by: NRamsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: NBernhard Reiter <ockham@raz.or.at> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 06 11月, 2014 1 次提交
-
-
由 Bernhard Reiter 提交于
The -v/-q options were sort-of supported but without using the parse-options API, and were not documented. Signed-off-by: NBernhard Reiter <ockham@raz.or.at> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 04 9月, 2014 1 次提交
-
-
由 Arjun Sreedharan 提交于
There are a handful more instances of this in compat/regex/ but they are borrowed code taht we do not want to touch with a change that really affects correctness, which this change is not. Signed-off-by: NArjun Sreedharan <arjun024@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 03 9月, 2014 1 次提交
-
-
由 René Scharfe 提交于
Use starts_with() instead of memcmp() to check if NUL-terminated strings match prefixes. This gets rid of some magic string length constants. Signed-off-by: NRene Scharfe <l.s.r@web.de> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 26 8月, 2014 1 次提交
-
-
由 Tony Finch 提交于
Some MUAs delete their "drafts" folder when it is empty, so git imap-send should be able to create it if necessary. This change checks that the folder exists immediately after login and tries to create it if it is missing. There was some vestigial code to handle a [TRYCREATE] response from the server when an APPEND target is missing. However this code never ran (the create and trycreate flags were never set) and when I tried to make it run I found that the code had already thrown away the contents of the message it was trying to append. Signed-off-by: NTony Finch <dot@dotat.at> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 21 8月, 2014 2 次提交
-
-
由 Bernhard Reiter 提交于
Rename the imap_folder variable to folder and make it a member of struct imap_server_conf. Signed-off-by: NBernhard Reiter <ockham@raz.or.at> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 René Scharfe 提交于
Most struct child_process variables are cleared using memset first after declaration. Provide a macro, CHILD_PROCESS_INIT, that can be used to initialize them statically instead. That's shorter, doesn't require a function call and is slightly more readable (especially given that we already have STRBUF_INIT, ARGV_ARRAY_INIT etc.). Helped-by: NJohannes Sixt <j6t@kdbg.org> Signed-off-by: NRene Scharfe <l.s.r@web.de> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 19 8月, 2014 1 次提交
-
-
由 Bernhard Reiter 提交于
Signed-off-by: NBernhard Reiter <ockham@raz.or.at> Reviewed-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 08 8月, 2014 1 次提交
-
-
由 Tanay Abhra 提交于
Use `git_config_get_*()` family instead of `git_config()` to take advantage of the config-set API which provides a cleaner control flow. Signed-off-by: NTanay Abhra <tanayabh@gmail.com> Reviewed-by: NMatthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 21 6月, 2014 1 次提交
-
-
由 Tanay Abhra 提交于
Signed-off-by: NTanay Abhra <tanayabh@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 28 5月, 2014 1 次提交
-
-
由 Brian Gesiak 提交于
xcalloc() takes two arguments: the number of elements and their size. imap_open_store() passes the arguments in reverse order, passing the size of an imap_store*, followed by the number to allocate. Rearrange them so they are in the correct order. Signed-off-by: NBrian Gesiak <modocache@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 30 4月, 2014 1 次提交
-
-
由 Dan Albert 提交于
git-imap-send was directly prompting for a password rather than using git-credential. git-send-email, on the other hand, supports git-credential. This is a necessary improvement for users that use two factor authentication, as they should not be expected to remember all of their app specific passwords. Signed-off-by: NDan Albert <danalbert@google.com> Acked-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 06 12月, 2013 1 次提交
-
-
由 Christian Couder 提交于
Leaving only the function definitions and declarations so that any new topic in flight can still make use of the old functions, replace existing uses of the prefixcmp() and suffixcmp() with new API functions. The change can be recreated by mechanically applying this: $ git grep -l -e prefixcmp -e suffixcmp -- \*.c | grep -v strbuf\\.c | xargs perl -pi -e ' s|!prefixcmp\(|starts_with\(|g; s|prefixcmp\(|!starts_with\(|g; s|!suffixcmp\(|ends_with\(|g; s|suffixcmp\(|!ends_with\(|g; ' on the result of preparatory changes in this series. Signed-off-by: NChristian Couder <chriscool@tuxfamily.org> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 30 7月, 2013 1 次提交
-
-
由 Jeremy Huddleston 提交于
Use Apple's supported functions for base64 encoding instead of the deprecated OpenSSL functions. Signed-off-by: NJeremy Huddleston <jeremyhu@apple.com> Signed-off-by: NDavid Aguilar <davvid@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 22 5月, 2013 1 次提交
-
-
由 David Aguilar 提交于
As of Mac OS X 10.7, Apple deprecated all OpenSSL functions due to OpenSSL ABI instability. Silence the warnings by using Apple's CommonCrypto HMAC replacement functions. [es: reworded commit message; check APPLE_COMMON_CRYPTO instead of abusing COMMON_DIGEST_FOR_OPENSSL] Signed-off-by: NDavid Aguilar <davvid@gmail.com> Signed-off-by: NEric Sunshine <sunshine@sunshineco.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 21 2月, 2013 1 次提交
-
-
由 Junio C Hamano 提交于
To talk with some sites that serve multiple names on a single IP address, the client needs to ask for the specific host that it wants to talk to. Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 20 2月, 2013 2 次提交
-
-
由 Oswald Buddenhagen 提交于
Check not only the common name of the certificate subject, but also check the subject alternative DNS names as well, when verifying that the certificate matches that of the host we are trying to talk to. Signed-off-by: NOswald Buddenhagen <ossi@kde.org> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Oswald Buddenhagen 提交于
We did not check a valid certificate's subject at all, and would have happily talked with a wrong host after connecting to an incorrect address and getting a valid certificate that does not belong to the host we intended to talk to. Signed-off-by: NOswald Buddenhagen <ossi@kde.org> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 19 2月, 2013 1 次提交
-
-
由 Junio C Hamano 提交于
Instead of adding an early return to the inside of the ssl_socket_connect() function for NO_OPENSSL compilation, split it into a separate stub function. No functional change, but the next change to extend ssl_socket_connect() will become easier to read this way. Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
- 16 1月, 2013 6 次提交
-
-
由 Michael Haggerty 提交于
* The first character in the string used to be special-cased to get around the fact that msg->buf[i - 1] is not defined for i == 0. Instead, keep track of the previous character in a separate variable, "lastc", initialized in such a way to let the loop handle i == 0 correctly. * Make the two loops over the string look as similar as possible to make it more obvious that the count computed in the first pass agrees with the true length of the new string written in the second pass. As a side effect, this makes it possible to use the "j" counter in place of lfnum and new_len. Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu> Reviewed-by: NJonathan Nieder <jrnieder@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Michael Haggerty 提交于
Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu> Reviewed-by: NJonathan Nieder <jrnieder@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Michael Haggerty 提交于
I suspect that the existence of both imap_store::uidvalidity and store::uidvalidity was an accident. Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu> Reviewed-by: NJonathan Nieder <jrnieder@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Michael Haggerty 提交于
In fact, all struct store instances are upcasts of struct imap_store anyway, so stop making the distinction. Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu> Reviewed-by: NJonathan Nieder <jrnieder@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Michael Haggerty 提交于
Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu> Reviewed-by: NJonathan Nieder <jrnieder@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-
由 Michael Haggerty 提交于
They are unused, and their removal means that a bunch of list-related infrastructure can be disposed of. It might be that the "NAMESPACE" response that is now skipped over in get_cmd_result() should never be sent by the server. But somebody would have to check the IMAP protocol and how we interact with the server to be sure. So for now I am leaving that branch of the "if" statement there. Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu> Reviewed-by: NJonathan Nieder <jrnieder@gmail.com> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
-