wincred: handle empty username/password correctly
authorJakub Bereżański <kuba@berezanscy.pl>
Mon, 30 Oct 2017 17:20:44 +0000 (18:20 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 1 Nov 2017 04:46:39 +0000 (13:46 +0900)
commit601e1e7897022b1f166c81e58c95e9afa06cac25
tree1f31d8f4f907b06e4a67ea2eaf4134598faf1c7e
parent3c90bda688afe55eb2c99a1ea1486ebc6bb48ca6
wincred: handle empty username/password correctly

Empty (length 0) usernames and/or passwords, when saved in the Windows
Credential Manager, come back as null when reading the credential.

One use case for such empty credentials is with NTLM authentication, where
empty username and password instruct libcurl to authenticate using the
credentials of the currently logged-on user (single sign-on).

When locating the relevant credentials, make empty username match null.
When outputting the credentials, handle nulls correctly.

Signed-off-by: Jakub Bereżański <kuba@berezanscy.pl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/credential/wincred/git-credential-wincred.c