From: Johannes Schindelin Date: Tue, 29 Oct 2024 23:27:52 +0000 (+0100) Subject: Sync with 2.40.4 X-Git-Tag: v2.47.2~1^2~1^2~1^2~1^2~1^2~1^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=676cddebf94fab8defe704b2f58c5b59912bb40c;p=thirdparty%2Fgit.git Sync with 2.40.4 * maint-2.40: Git 2.40.4 credential: disallow Carriage Returns in the protocol by default credential: sanitize the user prompt credential_format(): also encode [:] t7300: work around platform-specific behaviour with long paths on MinGW compat/regex: fix argument order to calloc(3) mingw: drop bogus (and unneeded) declaration of `_pgmptr` ci: remove 'Upload failed tests' directories' step from linux32 jobs --- 676cddebf94fab8defe704b2f58c5b59912bb40c diff --cc credential.c index 023b59d571,b76a730901..70119cdae6 --- a/credential.c +++ b/credential.c @@@ -8,9 -6,8 +8,9 @@@ #include "url.h" #include "prompt.h" #include "sigchain.h" +#include "strbuf.h" #include "urlmatch.h" --#include "git-compat-util.h" ++#include "environment.h" void credential_init(struct credential *c) { @@@ -280,19 -283,16 +293,19 @@@ static void credential_write_item(cons void credential_write(const struct credential *c, FILE *fp) { - credential_write_item(fp, "protocol", c->protocol, 1); - credential_write_item(fp, "host", c->host, 1); - credential_write_item(fp, "path", c->path, 0); - credential_write_item(fp, "username", c->username, 0); - credential_write_item(fp, "password", c->password, 0); - credential_write_item(fp, "oauth_refresh_token", c->oauth_refresh_token, 0); + credential_write_item(c, fp, "protocol", c->protocol, 1); + credential_write_item(c, fp, "host", c->host, 1); + credential_write_item(c, fp, "path", c->path, 0); + credential_write_item(c, fp, "username", c->username, 0); + credential_write_item(c, fp, "password", c->password, 0); ++ credential_write_item(c, fp, "oauth_refresh_token", c->oauth_refresh_token, 0); if (c->password_expiry_utc != TIME_MAX) { char *s = xstrfmt("%"PRItime, c->password_expiry_utc); - credential_write_item(fp, "password_expiry_utc", s, 0); + credential_write_item(c, fp, "password_expiry_utc", s, 0); free(s); } + for (size_t i = 0; i < c->wwwauth_headers.nr; i++) - credential_write_item(fp, "wwwauth[]", c->wwwauth_headers.v[i], 0); ++ credential_write_item(c, fp, "wwwauth[]", c->wwwauth_headers.v[i], 0); } static int run_credential_helper(struct credential *c, diff --cc credential.h index b8e2936d1d,2c0b39a925..d35764c7bb --- a/credential.h +++ b/credential.h @@@ -148,7 -134,8 +150,9 @@@ struct credential #define CREDENTIAL_INIT { \ .helpers = STRING_LIST_INIT_DUP, \ .password_expiry_utc = TIME_MAX, \ + .wwwauth_headers = STRVEC_INIT, \ + .sanitize_prompt = 1, \ + .protect_protocol = 1, \ } /* Initialize a credential structure, setting all fields to empty. */