{"thread":{"id":"60951","subject":"[PATCH] libsecret: retrieve empty password","startedAt":"2024-02-18T22:51:37Z","lastAt":"2024-02-19T20:41:01Z","messageCount":4,"participants":["M Hickford via GitGitGadget","Patrick Steinhardt","M Hickford"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"488895","messageId":"pull.1676.git.git.1708296694988.gitgitgadget@gmail.com","threadId":"60951","inReplyTo":null,"subject":"[PATCH] libsecret: retrieve empty password","fromName":"M Hickford via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-02-18T22:51:34Z","receivedAt":"2024-02-18T22:51:37Z","isPatch":true,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"From: M Hickford <mirth.hickford@gmail.com>\n\nSince 0ce02e2f (credential/libsecret: store new attributes, 2023-06-16)\na test that stores empty username and password fails when\nt0303-credential-external.sh is run with\nGIT_TEST_CREDENTIAL_HELPER=libsecret.\n\nRetrieve empty password carefully. This fixes test:\n\n    ok 14 - helper (libsecret) can store empty username\n\nSigned-off-by: M Hickford <mirth.hickford@gmail.com>\n---\n    libsecret: retrieve empty password\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1676%2Fhickford%2Flibsecret-empty-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1676/hickford/libsecret-empty-v1\nPull-Request: https://github.com/git/git/pull/1676\n\n contrib/credential/libsecret/git-credential-libsecret.c | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/contrib/credential/libsecret/git-credential-libsecret.c b/contrib/credential/libsecret/git-credential-libsecret.c\nindex 215a81d8bae..d9e9e4fd524 100644\n--- a/contrib/credential/libsecret/git-credential-libsecret.c\n+++ b/contrib/credential/libsecret/git-credential-libsecret.c\n@@ -164,6 +164,9 @@ static int keyring_get(struct credential *c)\n \t\t\tif (g_strv_length(parts) >= 1) {\n \t\t\t\tg_free(c->password);\n \t\t\t\tc->password = g_strdup(parts[0]);\n+\t\t\t} else {\n+\t\t\t\tg_free(c->password);\n+\t\t\t\tc->password = strdup(\"\");\n \t\t\t}\n \t\t\tfor (int i = 1; i < g_strv_length(parts); i++) {\n \t\t\t\tif (g_str_has_prefix(parts[i], \"password_expiry_utc=\")) {\n\nbase-commit: 3e0d3cd5c7def4808247caf168e17f2bbf47892b\n-- \ngitgitgadget\n"},{"id":"488903","messageId":"ZdLweyFLDtdMAq2x@tanuki","threadId":"60951","inReplyTo":"pull.1676.git.git.1708296694988.gitgitgadget@gmail.com","subject":"Re: [PATCH] libsecret: retrieve empty password","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2024-02-19T06:08:59Z","receivedAt":"2024-02-19T06:09:07Z","isPatch":true,"sender":{"key":"ps@pks.im","avatar":"https://avatars.githubusercontent.com/u/4056630?v=4"},"body":"On Sun, Feb 18, 2024 at 10:51:34PM +0000, M Hickford via GitGitGadget wrote:\n> From: M Hickford <mirth.hickford@gmail.com>\n> \n> Since 0ce02e2f (credential/libsecret: store new attributes, 2023-06-16)\n> a test that stores empty username and password fails when\n> t0303-credential-external.sh is run with\n> GIT_TEST_CREDENTIAL_HELPER=libsecret.\n> \n> Retrieve empty password carefully. This fixes test:\n> \n>     ok 14 - helper (libsecret) can store empty username\n> \n> Signed-off-by: M Hickford <mirth.hickford@gmail.com>\n> ---\n>     libsecret: retrieve empty password\n> \n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1676%2Fhickford%2Flibsecret-empty-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1676/hickford/libsecret-empty-v1\n> Pull-Request: https://github.com/git/git/pull/1676\n> \n>  contrib/credential/libsecret/git-credential-libsecret.c | 3 +++\n>  1 file changed, 3 insertions(+)\n> \n> diff --git a/contrib/credential/libsecret/git-credential-libsecret.c b/contrib/credential/libsecret/git-credential-libsecret.c\n> index 215a81d8bae..d9e9e4fd524 100644\n> --- a/contrib/credential/libsecret/git-credential-libsecret.c\n> +++ b/contrib/credential/libsecret/git-credential-libsecret.c\n> @@ -164,6 +164,9 @@ static int keyring_get(struct credential *c)\n>  \t\t\tif (g_strv_length(parts) >= 1) {\n>  \t\t\t\tg_free(c->password);\n>  \t\t\t\tc->password = g_strdup(parts[0]);\n> +\t\t\t} else {\n> +\t\t\t\tg_free(c->password);\n> +\t\t\t\tc->password = strdup(\"\");\n\nShouldn't we use `g_strdup()` here, like we do everywhere else in this\ncredential helper?\n\nPatrick\n\n>  \t\t\t}\n>  \t\t\tfor (int i = 1; i < g_strv_length(parts); i++) {\n>  \t\t\t\tif (g_str_has_prefix(parts[i], \"password_expiry_utc=\")) {\n> \n> base-commit: 3e0d3cd5c7def4808247caf168e17f2bbf47892b\n> -- \n> gitgitgadget\n> \n"},{"id":"488924","messageId":"CAGJzqsmwpHu7sMNs6C7k-V5JtpPtdYmXEp2uk-x-ZKLZ8S6jCA@mail.gmail.com","threadId":"60951","inReplyTo":"ZdLweyFLDtdMAq2x@tanuki","subject":"Re: [PATCH] libsecret: retrieve empty password","fromName":"M Hickford","fromEmail":"mirth.hickford@gmail.com","sentAt":"2024-02-19T20:00:00Z","receivedAt":"2024-02-19T20:00:44Z","isPatch":true,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"> > +                             g_free(c->password);\n> > +                             c->password = strdup(\"\");\n>\n> Shouldn't we use `g_strdup()` here, like we do everywhere else in this\n> credential helper?\n\nYou're right. I'll correct in patch v2.\n"},{"id":"488926","messageId":"pull.1676.v2.git.git.1708375258296.gitgitgadget@gmail.com","threadId":"60951","inReplyTo":"pull.1676.git.git.1708296694988.gitgitgadget@gmail.com","subject":"[PATCH v2] libsecret: retrieve empty password","fromName":"M Hickford via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2024-02-19T20:40:58Z","receivedAt":"2024-02-19T20:41:01Z","isPatch":true,"sender":{"key":"mirth.hickford@gmail.com","avatar":"https://avatars.githubusercontent.com/u/105314?v=4"},"body":"From: M Hickford <mirth.hickford@gmail.com>\n\nSince 0ce02e2f (credential/libsecret: store new attributes, 2023-06-16)\na test that stores empty username and password fails when\nt0303-credential-external.sh is run with\nGIT_TEST_CREDENTIAL_HELPER=libsecret.\n\nRetrieve empty password carefully. This fixes test:\n\n    ok 14 - helper (libsecret) can store empty username\n\nSigned-off-by: M Hickford <mirth.hickford@gmail.com>\n---\n    libsecret: retrieve empty password\n    \n    cc: Patrick Steinhardt ps@pks.im\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1676%2Fhickford%2Flibsecret-empty-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1676/hickford/libsecret-empty-v2\nPull-Request: https://github.com/git/git/pull/1676\n\nRange-diff vs v1:\n\n 1:  877bbfb72ed ! 1:  2cdcba20622 libsecret: retrieve empty password\n     @@ contrib/credential/libsecret/git-credential-libsecret.c: static int keyring_get(\n       \t\t\t\tc->password = g_strdup(parts[0]);\n      +\t\t\t} else {\n      +\t\t\t\tg_free(c->password);\n     -+\t\t\t\tc->password = strdup(\"\");\n     ++\t\t\t\tc->password = g_strdup(\"\");\n       \t\t\t}\n       \t\t\tfor (int i = 1; i < g_strv_length(parts); i++) {\n       \t\t\t\tif (g_str_has_prefix(parts[i], \"password_expiry_utc=\")) {\n\n\n contrib/credential/libsecret/git-credential-libsecret.c | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/contrib/credential/libsecret/git-credential-libsecret.c b/contrib/credential/libsecret/git-credential-libsecret.c\nindex 215a81d8bae..90034d0cf1e 100644\n--- a/contrib/credential/libsecret/git-credential-libsecret.c\n+++ b/contrib/credential/libsecret/git-credential-libsecret.c\n@@ -164,6 +164,9 @@ static int keyring_get(struct credential *c)\n \t\t\tif (g_strv_length(parts) >= 1) {\n \t\t\t\tg_free(c->password);\n \t\t\t\tc->password = g_strdup(parts[0]);\n+\t\t\t} else {\n+\t\t\t\tg_free(c->password);\n+\t\t\t\tc->password = g_strdup(\"\");\n \t\t\t}\n \t\t\tfor (int i = 1; i < g_strv_length(parts); i++) {\n \t\t\t\tif (g_str_has_prefix(parts[i], \"password_expiry_utc=\")) {\n\nbase-commit: 3e0d3cd5c7def4808247caf168e17f2bbf47892b\n-- \ngitgitgadget\n"}]}