[PATCH 1/8] wincred: ignore unknown lines (do not die)
- From
Matthew John Cheetham via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Sep 13, 2022, 19:25 UTC
- Message-ID
- <6426f9c3954866b3fd9259d1a58d2c41dc42e17f.1663097156.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1352.git.1663097156.gitgitgadget@gmail.com>
From: Matthew John Cheetham <mjcheetham@outlook.com>
It is the expectation that credential helpers be liberal in what they accept and conservative in what they return, to allow for future growth and evolution of the protocol/interaction.
All of the other helpers (store, cache, osxkeychain, libsecret, gnome-keyring) except `netrc` currently ignore any credential lines that are not recognised, whereas the Windows helper (wincred) instead dies.
Fix the discrepancy and ignore unknown lines in the wincred helper.
Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com> --- contrib/credential/wincred/git-credential-wincred.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/contrib/credential/wincred/git-credential-wincred.c b/contrib/credential/wincred/git-credential-wincred.c index 5091048f9c6..ead6e267c78 100644 --- a/contrib/credential/wincred/git-credential-wincred.c +++ b/contrib/credential/wincred/git-credential-wincred.c @@ -278,8 +278,11 @@ static void read_credential(void) wusername = utf8_to_utf16_dup(v); } else if (!strcmp(buf, "password")) password = utf8_to_utf16_dup(v); - else - die("unrecognized input"); + /* + * Ignore other lines; we don't know what they mean, but + * this future-proofs us when later versions of git do + * learn new lines, and the helpers are updated to match. + */ } }
-- gitgitgadget