From: Junio C Hamano Date: Fri, 17 Mar 2023 21:03:10 +0000 (-0700) Subject: Merge branch 'mc/credential-helper-www-authenticate' X-Git-Tag: v2.41.0-rc0~161 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=92c56da09683fa3331668adec073b6769da8f0b7;p=thirdparty%2Fgit.git Merge branch 'mc/credential-helper-www-authenticate' Allow information carried on the WWW-AUthenticate header to be passed to the credential helpers. * mc/credential-helper-www-authenticate: credential: add WWW-Authenticate header to cred requests http: read HTTP WWW-Authenticate response headers t5563: add tests for basic and anoymous HTTP access --- 92c56da09683fa3331668adec073b6769da8f0b7 diff --cc credential.c index f32011343f,f566c8ab19..ea40a2a410 --- a/credential.c +++ b/credential.c @@@ -275,11 -270,9 +276,13 @@@ void credential_write(const struct cred credential_write_item(fp, "path", c->path, 0); credential_write_item(fp, "username", c->username, 0); credential_write_item(fp, "password", c->password, 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); + 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(fp, "wwwauth[]", c->wwwauth_headers.v[i], 0); } static int run_credential_helper(struct credential *c, diff --cc credential.h index 935b28a70f,3756a54c74..2b5958cd43 --- a/credential.h +++ b/credential.h @@@ -131,7 -145,7 +146,8 @@@ struct credential #define CREDENTIAL_INIT { \ .helpers = STRING_LIST_INIT_DUP, \ + .password_expiry_utc = TIME_MAX, \ + .wwwauth_headers = STRVEC_INIT, \ } /* Initialize a credential structure, setting all fields to empty. */