]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'mc/credential-helper-www-authenticate'
authorJunio C Hamano <gitster@pobox.com>
Fri, 17 Mar 2023 21:03:10 +0000 (14:03 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 17 Mar 2023 21:03:10 +0000 (14:03 -0700)
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

1  2 
Documentation/git-credential.txt
credential.c
credential.h
git-compat-util.h
http.c
t/lib-httpd.sh
t/lib-httpd/apache.conf

Simple merge
diff --cc credential.c
index f32011343f9400a80cb9999fe75e0eeefde48146,f566c8ab195c41741f9e55e4663f013ce66dd49e..ea40a2a410bb5b7b1294ca2a77944d9f7ca6c878
@@@ -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);
 -              credential_write_item(fp, "wwwauth[]", c->wwwauth_headers.v[i],
 -                                    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);
  }
  
  static int run_credential_helper(struct credential *c,
diff --cc credential.h
index 935b28a70f16ec788e9df0126ccfb00fa86de7cd,3756a54c74dc809a59f092321b3475a3a885f037..2b5958cd431706026b243057cdb68f4274300703
@@@ -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. */
Simple merge
diff --cc http.c
Simple merge
diff --cc t/lib-httpd.sh
Simple merge
Simple merge