All of lore.kernel.org
 help / color / mirror / Atom feed
From: "M Hickford via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: M Hickford <mirth.hickford@gmail.com>,
	M Hickford <mirth.hickford@gmail.com>
Subject: [PATCH v2] libsecret: retrieve empty password
Date: Mon, 19 Feb 2024 20:40:58 +0000	[thread overview]
Message-ID: <pull.1676.v2.git.git.1708375258296.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1676.git.git.1708296694988.gitgitgadget@gmail.com>

From: M Hickford <mirth.hickford@gmail.com>

Since 0ce02e2f (credential/libsecret: store new attributes, 2023-06-16)
a test that stores empty username and password fails when
t0303-credential-external.sh is run with
GIT_TEST_CREDENTIAL_HELPER=libsecret.

Retrieve empty password carefully. This fixes test:

    ok 14 - helper (libsecret) can store empty username

Signed-off-by: M Hickford <mirth.hickford@gmail.com>
---
    libsecret: retrieve empty password
    
    cc: Patrick Steinhardt ps@pks.im

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1676%2Fhickford%2Flibsecret-empty-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1676/hickford/libsecret-empty-v2
Pull-Request: https://github.com/git/git/pull/1676

Range-diff vs v1:

 1:  877bbfb72ed ! 1:  2cdcba20622 libsecret: retrieve empty password
     @@ contrib/credential/libsecret/git-credential-libsecret.c: static int keyring_get(
       				c->password = g_strdup(parts[0]);
      +			} else {
      +				g_free(c->password);
     -+				c->password = strdup("");
     ++				c->password = g_strdup("");
       			}
       			for (int i = 1; i < g_strv_length(parts); i++) {
       				if (g_str_has_prefix(parts[i], "password_expiry_utc=")) {


 contrib/credential/libsecret/git-credential-libsecret.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/contrib/credential/libsecret/git-credential-libsecret.c b/contrib/credential/libsecret/git-credential-libsecret.c
index 215a81d8bae..90034d0cf1e 100644
--- a/contrib/credential/libsecret/git-credential-libsecret.c
+++ b/contrib/credential/libsecret/git-credential-libsecret.c
@@ -164,6 +164,9 @@ static int keyring_get(struct credential *c)
 			if (g_strv_length(parts) >= 1) {
 				g_free(c->password);
 				c->password = g_strdup(parts[0]);
+			} else {
+				g_free(c->password);
+				c->password = g_strdup("");
 			}
 			for (int i = 1; i < g_strv_length(parts); i++) {
 				if (g_str_has_prefix(parts[i], "password_expiry_utc=")) {

base-commit: 3e0d3cd5c7def4808247caf168e17f2bbf47892b
-- 
gitgitgadget

      parent reply	other threads:[~2024-02-19 20:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-18 22:51 [PATCH] libsecret: retrieve empty password M Hickford via GitGitGadget
2024-02-19  6:08 ` Patrick Steinhardt
2024-02-19 20:00   ` M Hickford
2024-02-19 20:40 ` M Hickford via GitGitGadget [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.1676.v2.git.git.1708375258296.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=mirth.hickford@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.