Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libsecret: retrieve empty password #1676

Closed
wants to merge 1 commit into from

Conversation

hickford
Copy link
Contributor

@hickford hickford commented Feb 18, 2024

cc: Patrick Steinhardt ps@pks.im

Copy link

There are issues in commit 694d070:
libsecret: retrieve empty password
Commit not signed off

@hickford
Copy link
Contributor Author

/submit

Copy link

Submitted as pull.1676.git.git.1708296694988.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-1676/hickford/libsecret-empty-v1

To fetch this version to local tag pr-git-1676/hickford/libsecret-empty-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-1676/hickford/libsecret-empty-v1

Copy link

On the Git mailing list, Patrick Steinhardt wrote (reply to this):

On Sun, Feb 18, 2024 at 10:51:34PM +0000, M Hickford via GitGitGadget wrote:
> 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
> 
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1676%2Fhickford%2Flibsecret-empty-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1676/hickford/libsecret-empty-v1
> Pull-Request: https://github.com/git/git/pull/1676
> 
>  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..d9e9e4fd524 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 = strdup("");

Shouldn't we use `g_strdup()` here, like we do everywhere else in this
credential helper?

Patrick

>  			}
>  			for (int i = 1; i < g_strv_length(parts); i++) {
>  				if (g_str_has_prefix(parts[i], "password_expiry_utc=")) {
> 
> base-commit: 3e0d3cd5c7def4808247caf168e17f2bbf47892b
> -- 
> gitgitgadget
> 

Copy link

User Patrick Steinhardt <ps@pks.im> has been added to the cc: list.

Copy link

On the Git mailing list, M Hickford wrote (reply to this):

> > +                             g_free(c->password);
> > +                             c->password = strdup("");
>
> Shouldn't we use `g_strdup()` here, like we do everywhere else in this
> credential helper?

You're right. I'll correct in patch v2.

Since 0ce02e2 (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>
@hickford
Copy link
Contributor Author

/submit

Copy link

Submitted as pull.1676.v2.git.git.1708375258296.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-1676/hickford/libsecret-empty-v2

To fetch this version to local tag pr-git-1676/hickford/libsecret-empty-v2:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-1676/hickford/libsecret-empty-v2

Copy link

This branch is now known as mh/libsecret-empty-password-fix.

Copy link

This patch series was integrated into seen via 1ee09f7.

Copy link

This patch series was integrated into seen via c8a10e8.

Copy link

This patch series was integrated into seen via e873ec9.

Copy link

This patch series was integrated into next via b2e1769.

Copy link

This patch series was integrated into seen via f06b8bb.

Copy link

There was a status update in the "New Topics" section about the branch mh/libsecret-empty-password-fix on the Git mailing list:

Credential helper based on libsecret (in contrib/) has been updated.

Will cook in 'next'.
source: <pull.1676.v2.git.git.1708375258296.gitgitgadget@gmail.com>

Copy link

This patch series was integrated into seen via 6a2472e.

Copy link

This patch series was integrated into seen via f350cd3.

Copy link

There was a status update in the "Cooking" section about the branch mh/libsecret-empty-password-fix on the Git mailing list:

Credential helper based on libsecret (in contrib/) has been updated.

Will cook in 'next'.
source: <pull.1676.v2.git.git.1708375258296.gitgitgadget@gmail.com>

Copy link

This patch series was integrated into seen via 1aaaef5.

Copy link

This patch series was integrated into seen via e6eb311.

Copy link

This patch series was integrated into seen via 3af5bf5.

Copy link

This patch series was integrated into seen via f918ecd.

Copy link

This patch series was integrated into seen via 70dadd5.

Copy link

This patch series was integrated into master via 70dadd5.

Copy link

This patch series was integrated into next via 70dadd5.

Copy link

Closed via 70dadd5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant