improve-wincred-compatibility
Get series with b4
b4 am [email protected]Versions newest first
- v2 Latest2 patches 8 repliesIn review
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | wincred: accept CRLF on stdin to simplify console usagecontrib/ | +5 | 0 replies | |
| 2/2 | wincred: improve compatibility with windows versionscontrib/ | +70 | 1 reply |
Reviews trailers per patch
None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Erik Faye-Lund |
|---|---|
| Series | A-b |
| 1/2 | |
| 2/2 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 0/2] improve-wincred-compatibility
Changes since initial version (see attached diff for details):
- split in two patches
- removed unused variables
- improved the dll error message
- changed ?: to if else
- added comments
Also available here:
https://github.com/kblees/git/tree/kb/improve-wincred-compatibility-v2
git pull git://github.com/kblees/git.git kb/improve-wincred-compatibility-v2
Karsten Blees (2):
wincred: accept CRLF on stdin to simplify console usage
wincred: improve compatibility with windows versions
.../credential/wincred/git-credential-wincred.c | 206 ++++++++------------- 1 file changed, 75 insertions(+), 131 deletions(-)
Quoted 1 line
git diff kb/improve-wincred-compatibility..kb/improve-wincred-compatibility-v2
contrib/credential/wincred/git-credential-wincred.c +27 -10
@@ -66,7 +66,7 @@ typedef BOOL (WINAPI *CredEnumerateWT)(LPCWSTR, DWORD, DWORD *, typedef VOID (WINAPI *CredFreeT)(PVOID); typedef BOOL (WINAPI *CredDeleteWT)(LPCWSTR, DWORD, DWORD); -static HMODULE advapi, credui; +static HMODULE advapi;static CredWriteWT CredWriteW;static CredEnumerateWT CredEnumerateW;static CredFreeT CredFree;
@@ -77,7 +77,7 @@ static void load_cred_funcs(void)/* load DLLs */ advapi =LoadLibrary ("advapi32.dll" );if (!advapi) -die ("failed to load DLLs" ); +die ("failed to load advapi32.dll" );/* get function pointers */ CredWriteW = (CredWriteWT )GetProcAddress (advapi,"CredWriteW" );
@@ -107,14 +107,34 @@ static void write_item(const char *what, LPCWSTR wbuf, int wlen)free (buf); } +/* +* Match an (optional) expected string and a delimiter in the target string, +* consuming the matched text by updating the target pointer. +*/ static int match_part (LPCWSTR *ptarget,LPCWSTR want,LPCWSTR delim) { -LPCWSTR start = *ptarget; -LPCWSTR end = *delim ?wcsstr (start, delim) : start +wcslen (start); -int len = end ? end - start :wcslen (start); +LPCWSTR delim_pos, start = *ptarget; +int len; + +/* find start of delimiter (or end-of-string if delim is empty) */ +if (*delim) + delim_pos =wcsstr (start, delim); +else + delim_pos = start +wcslen (start); + +/* +* match text up to delimiter, or end of string (e.g. the '/' after +* host is optional if not followed by a path) +*/ +if (delim_pos) + len = delim_pos - start; +else + len =wcslen (start); +/* update ptarget if we either found a delimiter or need a match */ -if (end || want) - *ptarget = end ? end +wcslen (delim) : start + len; +if (delim_pos || want) + *ptarget = delim_pos ? delim_pos +wcslen (delim) : start + len; +return !want || (!wcsncmp (want, start, len) && !want[len]); }
@@ -157,9 +177,6 @@ static void get_credential(void)static void store_credential (void ) {CREDENTIALW cred; -BYTE *auth_buf; -DWORD auth_buf_size =0 ; -CREDENTIAL_ATTRIBUTEW attrs[CRED_MAX_ATTRIBUTES ];if (!wusername || !password)return ;
Signature · 12 lines
*** Please reply-to-all at all times *** *** (do not pretend to know who is subscribed and who is not) *** *** Please avoid top-posting. *** The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free. You received this message because you are subscribed to the Google Groups "msysGit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, and view previous threads, visit this group at http://groups.google.com/group/msysgit?hl=en_US?hl=en