winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
May 2016
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
4 participants
542 discussions
Start a n
N
ew thread
Jacek Caban : wininet: Rerite COOKIE_crackUrlSimple to use substrings.
by Alexandre Julliard
17 May '16
17 May '16
Module: wine Branch: master Commit: 8264e2de94b61d9b9c349782fc9170b124b7f2c2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8264e2de94b61d9b9c349782f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 16 22:45:57 2016 +0200 wininet: Rerite COOKIE_crackUrlSimple to use substrings. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/cookie.c | 70 +++++++++++++++++---------------------------------- 1 file changed, 23 insertions(+), 47 deletions(-) diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 4f16efd..5c25fef 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -509,44 +509,23 @@ static BOOL save_persistent_cookie(cookie_container_t *container) return CommitUrlCacheEntryW(cookie_url, cookie_file, time, time, 0, NULL, 0, txtW, 0); } -static BOOL COOKIE_crackUrlSimple(LPCWSTR lpszUrl, LPWSTR hostName, int hostNameLen, LPWSTR path, int pathLen) +static BOOL cookie_parse_url(const WCHAR *url, substr_t *host, substr_t *path) { - URL_COMPONENTSW UrlComponents; - - UrlComponents.lpszExtraInfo = NULL; - UrlComponents.lpszPassword = NULL; - UrlComponents.lpszScheme = NULL; - UrlComponents.lpszUrlPath = path; - UrlComponents.lpszUserName = NULL; - UrlComponents.lpszHostName = hostName; - UrlComponents.dwExtraInfoLength = 0; - UrlComponents.dwPasswordLength = 0; - UrlComponents.dwSchemeLength = 0; - UrlComponents.dwUserNameLength = 0; - UrlComponents.dwHostNameLength = hostNameLen; - UrlComponents.dwUrlPathLength = pathLen; - - if (!InternetCrackUrlW(lpszUrl, 0, 0, &UrlComponents)) return FALSE; + URL_COMPONENTSW comp = { sizeof(comp) }; + static const WCHAR rootW[] = {'/',0}; + + comp.dwHostNameLength = 1; + comp.dwUrlPathLength = 1; + + if(!InternetCrackUrlW(url, 0, 0, &comp) || !comp.dwHostNameLength) + return FALSE; /* discard the webpage off the end of the path */ - if (UrlComponents.dwUrlPathLength) - { - if (path[UrlComponents.dwUrlPathLength - 1] != '/') - { - WCHAR *ptr; - if ((ptr = strrchrW(path, '/'))) *(++ptr) = 0; - else - { - path[0] = '/'; - path[1] = 0; - } - } - } - else if (pathLen >= 2) - { - path[0] = '/'; - path[1] = 0; - } + while(comp.dwUrlPathLength && comp.lpszUrlPath[comp.dwUrlPathLength-1] != '/') + comp.dwUrlPathLength--; + + *host = substr(comp.lpszHostName, comp.dwHostNameLength); + *path = comp.dwUrlPathLength ? substr(comp.lpszUrlPath, comp.dwUrlPathLength) : substr(rootW, 1); return TRUE; } @@ -734,8 +713,8 @@ DWORD get_cookie_header(const WCHAR *host, const WCHAR *path, WCHAR **ret) BOOL WINAPI InternetGetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, LPWSTR lpCookieData, LPDWORD lpdwSize, DWORD flags, void *reserved) { - WCHAR host[INTERNET_MAX_HOST_NAME_LENGTH], path[INTERNET_MAX_PATH_LENGTH]; cookie_set_t cookie_set = {0}; + substr_t host, path; DWORD res; BOOL ret; @@ -750,16 +729,15 @@ BOOL WINAPI InternetGetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, return FALSE; } - host[0] = 0; - ret = COOKIE_crackUrlSimple(lpszUrl, host, sizeof(host)/sizeof(host[0]), path, sizeof(path)/sizeof(path[0])); - if (!ret || !host[0]) { + ret = cookie_parse_url(lpszUrl, &host, &path); + if (!ret) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } EnterCriticalSection(&cookie_cs); - res = get_cookie(substrz(host), substrz(path), flags, &cookie_set); + res = get_cookie(host, path, flags, &cookie_set); if(res != ERROR_SUCCESS) { LeaveCriticalSection(&cookie_cs); SetLastError(res); @@ -780,7 +758,7 @@ BOOL WINAPI InternetGetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, lpCookieData[cookie_set.string_len] = 0; } }else { - TRACE("no cookies found for %s\n", debugstr_w(host)); + TRACE("no cookies found for %s\n", debugstr_wn(host.str, host.len)); SetLastError(ERROR_NO_MORE_ITEMS); ret = FALSE; } @@ -1078,9 +1056,8 @@ DWORD set_cookie(substr_t domain, substr_t path, substr_t name, substr_t data, D DWORD WINAPI InternetSetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, LPCWSTR lpCookieData, DWORD flags, DWORD_PTR reserved) { - substr_t name, data; + substr_t host, path, name, data; BOOL ret; - WCHAR hostName[INTERNET_MAX_HOST_NAME_LENGTH], path[INTERNET_MAX_PATH_LENGTH]; TRACE("(%s, %s, %s, %x, %lx)\n", debugstr_w(lpszUrl), debugstr_w(lpszCookieName), debugstr_w(lpCookieData), flags, reserved); @@ -1094,9 +1071,8 @@ DWORD WINAPI InternetSetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, return COOKIE_STATE_UNKNOWN; } - hostName[0] = 0; - ret = COOKIE_crackUrlSimple(lpszUrl, hostName, sizeof(hostName)/sizeof(hostName[0]), path, sizeof(path)/sizeof(path[0])); - if (!ret || !hostName[0]) return COOKIE_STATE_UNKNOWN; + ret = cookie_parse_url(lpszUrl, &host, &path); + if (!ret || !host.len) return COOKIE_STATE_UNKNOWN; if (!lpszCookieName) { const WCHAR *ptr; @@ -1114,7 +1090,7 @@ DWORD WINAPI InternetSetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, data = substrz(lpCookieData); } - return set_cookie(substrz(hostName), substrz(path), name, data, flags); + return set_cookie(host, path, name, data, flags); } /***********************************************************************
1
0
0
0
Jacek Caban : wininet: Pass arguments as substrings to set_cookie.
by Alexandre Julliard
17 May '16
17 May '16
Module: wine Branch: master Commit: 18a31e49bc2af5399214612b6d7641a42a25b2f7 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=18a31e49bc2af5399214612b6…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 16 22:45:41 2016 +0200 wininet: Pass arguments as substrings to set_cookie. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/cookie.c | 237 +++++++++++++++++++++--------------------------- dlls/wininet/http.c | 10 +- dlls/wininet/internet.h | 2 +- 3 files changed, 108 insertions(+), 141 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=18a31e49bc2af53992146…
1
0
0
0
Jacek Caban : wininet: Added IsDomainLegalCookieDomainW helper with substrings as arguments.
by Alexandre Julliard
17 May '16
17 May '16
Module: wine Branch: master Commit: 8fe7be58ead58fc7114a01dc8365ad72bb86a45d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=8fe7be58ead58fc7114a01dc8…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 16 22:43:43 2016 +0200 wininet: Added IsDomainLegalCookieDomainW helper with substrings as arguments. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/cookie.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 2622712..beb3894 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -867,40 +867,25 @@ BOOL WINAPI InternetGetCookieExA(LPCSTR lpszUrl, LPCSTR lpszCookieName, */ BOOL WINAPI InternetGetCookieA(const char *url, const char *name, char *data, DWORD *size) { - TRACE("(%s, %s, %s, %p)\n", debugstr_a(url), debugstr_a(name), debugstr_a(data), size); + TRACE("(%s, %s, %p, %p)\n", debugstr_a(url), debugstr_a(name), data, size); return InternetGetCookieExA(url, name, data, size, 0, NULL); } -/*********************************************************************** - * IsDomainLegalCookieDomainW (WININET.@) - */ -BOOL WINAPI IsDomainLegalCookieDomainW( LPCWSTR s1, LPCWSTR s2 ) +static BOOL is_domain_legal_for_cookie(substr_t domain, substr_t full_domain) { - DWORD s1_len, s2_len; + const WCHAR *ptr; - FIXME("(%s, %s) semi-stub\n", debugstr_w(s1), debugstr_w(s2)); - - if (!s1 || !s2) - { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - if (s1[0] == '.' || !s1[0] || s2[0] == '.' || !s2[0]) - { + if(!domain.len || *domain.str == '.' || !full_domain.len || *full_domain.str == '.') { SetLastError(ERROR_INVALID_NAME); return FALSE; } - if(!strchrW(s1, '.') || !strchrW(s2, '.')) - return FALSE; - s1_len = strlenW(s1); - s2_len = strlenW(s2); - if (s1_len > s2_len) + if(domain.len > full_domain.len || !memchrW(domain.str, '.', domain.len) || !memchrW(full_domain.str, '.', full_domain.len)) return FALSE; - if (strncmpiW(s1, s2+s2_len-s1_len, s1_len) || (s2_len>s1_len && s2[s2_len-s1_len-1]!='.')) - { + ptr = full_domain.str + full_domain.len - domain.len; + if (strncmpiW(domain.str, ptr, domain.len) || (full_domain.len > domain.len && ptr[-1] != '.')) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } @@ -908,6 +893,21 @@ BOOL WINAPI IsDomainLegalCookieDomainW( LPCWSTR s1, LPCWSTR s2 ) return TRUE; } +/*********************************************************************** + * IsDomainLegalCookieDomainW (WININET.@) + */ +BOOL WINAPI IsDomainLegalCookieDomainW(const WCHAR *domain, const WCHAR *full_domain) +{ + FIXME("(%s, %s) semi-stub\n", debugstr_w(domain), debugstr_w(full_domain)); + + if (!domain || !full_domain) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + return is_domain_legal_for_cookie(substrz(domain), substrz(full_domain)); +} + DWORD set_cookie(const WCHAR *domain, const WCHAR *path, const WCHAR *cookie_name, const WCHAR *cookie_data, DWORD flags) { cookie_container_t *container;
1
0
0
0
Jacek Caban : wininet: Pass arguments as substrings to get_cookie.
by Alexandre Julliard
17 May '16
17 May '16
Module: wine Branch: master Commit: 4f39a2dbb30e7a65ec0a325b7a47947f0ff1707a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=4f39a2dbb30e7a65ec0a325b7…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 16 22:43:29 2016 +0200 wininet: Pass arguments as substrings to get_cookie. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/cookie.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index debf4b5..2622712 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -252,9 +252,10 @@ static void replace_cookie(cookie_container_t *container, cookie_t *new_cookie) add_cookie(container, new_cookie); } -static BOOL cookie_match_path(cookie_container_t *container, const WCHAR *path) +static BOOL cookie_match_path(cookie_container_t *container, substr_t path) { - return !strncmpiW(container->path, path, strlenW(container->path)); + size_t len = strlenW(container->path); + return path.len >= len && !strncmpiW(container->path, path.str, len); } static BOOL create_cookie_url(substr_t domain, substr_t path, WCHAR *buf, DWORD buf_len) @@ -557,44 +558,42 @@ typedef struct { unsigned string_len; } cookie_set_t; -static DWORD get_cookie(const WCHAR *host, const WCHAR *path, DWORD flags, cookie_set_t *res) +static DWORD get_cookie(substr_t host, substr_t path, DWORD flags, cookie_set_t *res) { static const WCHAR empty_path[] = { '/',0 }; const WCHAR *p; cookie_domain_t *domain; cookie_container_t *container; - unsigned len; FILETIME tm; GetSystemTimeAsFileTime(&tm); - len = strlenW(host); - p = host+len; - while(p>host && p[-1]!='.') p--; - while(p != host) { + p = host.str + host.len; + while(p > host.str && p[-1] != '.') p--; + while(p != host.str) { p--; - while(p>host && p[-1]!='.') p--; - if(p == host) break; + while(p > host.str && p[-1] != '.') p--; + if(p == host.str) break; - load_persistent_cookie(substr(p, host+len-p), substr(empty_path, 1)); + load_persistent_cookie(substr(p, host.str+host.len-p), substr(empty_path, 1)); } - p = host + len; + p = path.str + path.len; do { - load_persistent_cookie(substr(host, len), substr(path, p-path)); + load_persistent_cookie(host, substr(path.str, p-path.str)); p--; - while(p > path && p[-1] != '/') p--; - }while(p != path); + while(p > path.str && p[-1] != '/') p--; + }while(p != path.str); - domain = get_cookie_domain(substrz(host), FALSE); + domain = get_cookie_domain(host, FALSE); if(!domain) { - TRACE("Unknown host %s\n", debugstr_w(host)); + TRACE("Unknown host %s\n", debugstr_wn(host.str, host.len)); return ERROR_NO_MORE_ITEMS; } - for(domain = get_cookie_domain(substrz(host), FALSE); domain; domain = domain->parent) { + for(domain = get_cookie_domain(host, FALSE); domain; domain = domain->parent) { TRACE("Trying %s domain...\n", debugstr_w(domain->domain)); LIST_FOR_EACH_ENTRY(container, &domain->path_list, cookie_container_t, entry) { @@ -685,7 +684,7 @@ DWORD get_cookie_header(const WCHAR *host, const WCHAR *path, WCHAR **ret) EnterCriticalSection(&cookie_cs); - res = get_cookie(host, path, INTERNET_COOKIE_HTTPONLY, &cookie_set); + res = get_cookie(substrz(host), substrz(path), INTERNET_COOKIE_HTTPONLY, &cookie_set); if(res != ERROR_SUCCESS) { LeaveCriticalSection(&cookie_cs); return res; @@ -760,7 +759,7 @@ BOOL WINAPI InternetGetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName, EnterCriticalSection(&cookie_cs); - res = get_cookie(host, path, flags, &cookie_set); + res = get_cookie(substrz(host), substrz(path), flags, &cookie_set); if(res != ERROR_SUCCESS) { LeaveCriticalSection(&cookie_cs); SetLastError(res);
1
0
0
0
Jacek Caban : wininet: Pass arguments as substrings to load_persistent_cookie.
by Alexandre Julliard
17 May '16
17 May '16
Module: wine Branch: master Commit: b6f64a468dd101b989c59fd1fb942801bd2e1a3d URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b6f64a468dd101b989c59fd1f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 16 22:43:07 2016 +0200 wininet: Pass arguments as substrings to load_persistent_cookie. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/cookie.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 4e885d7..debf4b5 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -300,7 +300,7 @@ static BOOL create_cookie_url(substr_t domain, substr_t path, WCHAR *buf, DWORD return TRUE; } -static BOOL load_persistent_cookie(LPCWSTR domain, LPCWSTR path) +static BOOL load_persistent_cookie(substr_t domain, substr_t path) { INTERNET_CACHE_ENTRY_INFOW *info; cookie_container_t *cookie_container; @@ -312,7 +312,7 @@ static BOOL load_persistent_cookie(LPCWSTR domain, LPCWSTR path) WCHAR *name, *data; FILETIME expiry, create, time; - if (!create_cookie_url(substrz(domain), substrz(path), cookie_url, sizeof(cookie_url)/sizeof(cookie_url[0]))) { + if (!create_cookie_url(domain, path, cookie_url, sizeof(cookie_url)/sizeof(cookie_url[0]))) { FIXME("Failed to create cookie URL.\n"); return FALSE; } @@ -338,7 +338,7 @@ static BOOL load_persistent_cookie(LPCWSTR domain, LPCWSTR path) str[size] = 0; UnlockUrlCacheEntryStream(cookie, 0); - cookie_container = get_cookie_container(substrz(domain), substrz(path), TRUE); + cookie_container = get_cookie_container(domain, path, TRUE); if(!cookie_container) { heap_free(str); return FALSE; @@ -561,7 +561,6 @@ static DWORD get_cookie(const WCHAR *host, const WCHAR *path, DWORD flags, cooki { static const WCHAR empty_path[] = { '/',0 }; - WCHAR *ptr, subpath[INTERNET_MAX_PATH_LENGTH]; const WCHAR *p; cookie_domain_t *domain; cookie_container_t *container; @@ -578,20 +577,16 @@ static DWORD get_cookie(const WCHAR *host, const WCHAR *path, DWORD flags, cooki while(p>host && p[-1]!='.') p--; if(p == host) break; - load_persistent_cookie(p, empty_path); + load_persistent_cookie(substr(p, host+len-p), substr(empty_path, 1)); } - len = strlenW(path); - assert(len+1 < INTERNET_MAX_PATH_LENGTH); - memcpy(subpath, path, (len+1)*sizeof(WCHAR)); - ptr = subpath+len; + p = host + len; do { - *ptr = 0; - load_persistent_cookie(host, subpath); + load_persistent_cookie(substr(host, len), substr(path, p-path)); - ptr--; - while(ptr>subpath && ptr[-1]!='/') ptr--; - }while(ptr != subpath); + p--; + while(p > path && p[-1] != '/') p--; + }while(p != path); domain = get_cookie_domain(substrz(host), FALSE); if(!domain) { @@ -1041,7 +1036,7 @@ DWORD set_cookie(const WCHAR *domain, const WCHAR *path, const WCHAR *cookie_nam EnterCriticalSection(&cookie_cs); - load_persistent_cookie(domain, path); + load_persistent_cookie(substrz(domain), substrz(path)); container = get_cookie_container(substrz(domain), substrz(path), !expired); if(!container) {
1
0
0
0
Jacek Caban : wininet: Pass arguments as substrings to create_cookie_url.
by Alexandre Julliard
17 May '16
17 May '16
Module: wine Branch: master Commit: 51cacda534411bedf8a10b126181e5087f9908e1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=51cacda534411bedf8a10b126…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 16 22:42:49 2016 +0200 wininet: Pass arguments as substrings to create_cookie_url. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/cookie.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 2a3efa6..4e885d7 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -257,7 +257,7 @@ static BOOL cookie_match_path(cookie_container_t *container, const WCHAR *path) return !strncmpiW(container->path, path, strlenW(container->path)); } -static BOOL create_cookie_url(LPCWSTR domain, LPCWSTR path, WCHAR *buf, DWORD buf_len) +static BOOL create_cookie_url(substr_t domain, substr_t path, WCHAR *buf, DWORD buf_len) { static const WCHAR cookie_prefix[] = {'C','o','o','k','i','e',':'}; @@ -282,18 +282,16 @@ static BOOL create_cookie_url(LPCWSTR domain, LPCWSTR path, WCHAR *buf, DWORD bu *(buf++) = '@'; buf_len--; - len = strlenW(domain); - if(len >= buf_len) + if(domain.len >= buf_len) return FALSE; - memcpy(buf, domain, len*sizeof(WCHAR)); - buf += len; - buf_len -= len; + memcpy(buf, domain.str, domain.len*sizeof(WCHAR)); + buf += domain.len; + buf_len -= domain.len; - len = strlenW(path); - if(len >= buf_len) + if(path.len >= buf_len) return FALSE; - memcpy(buf, path, len*sizeof(WCHAR)); - buf += len; + memcpy(buf, path.str, path.len*sizeof(WCHAR)); + buf += path.len; *buf = 0; @@ -314,8 +312,10 @@ static BOOL load_persistent_cookie(LPCWSTR domain, LPCWSTR path) WCHAR *name, *data; FILETIME expiry, create, time; - if (!create_cookie_url(domain, path, cookie_url, sizeof(cookie_url)/sizeof(cookie_url[0]))) + if (!create_cookie_url(substrz(domain), substrz(path), cookie_url, sizeof(cookie_url)/sizeof(cookie_url[0]))) { + FIXME("Failed to create cookie URL.\n"); return FALSE; + } size = 0; RetrieveUrlCacheEntryStreamW(cookie_url, NULL, &size, FALSE, 0); @@ -409,8 +409,11 @@ static BOOL save_persistent_cookie(cookie_container_t *container) FILETIME time; DWORD bytes_written; - if (!create_cookie_url(container->domain->domain, container->path, cookie_url, sizeof(cookie_url)/sizeof(cookie_url[0]))) + if (!create_cookie_url(substrz(container->domain->domain), substrz(container->path), + cookie_url, sizeof(cookie_url)/sizeof(cookie_url[0]))) { + FIXME("Failed to create cookie URL.\n"); return FALSE; + } /* check if there's anything to save */ GetSystemTimeAsFileTime(&time);
1
0
0
0
Jacek Caban : wininet: Pass arguments as substrings to get_cookie_container.
by Alexandre Julliard
17 May '16
17 May '16
Module: wine Branch: master Commit: b1aa9bf8072d441170aa0d8bcddc1aa65e5e530e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b1aa9bf8072d441170aa0d8bc…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 16 22:42:33 2016 +0200 wininet: Pass arguments as substrings to get_cookie_container. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/cookie.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 6734c1f..2a3efa6 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -142,24 +142,22 @@ static cookie_domain_t *get_cookie_domain(substr_t domain, BOOL create) } } -static cookie_container_t *get_cookie_container(const WCHAR *domain, const WCHAR *path, BOOL create) +static cookie_container_t *get_cookie_container(substr_t domain, substr_t path, BOOL create) { cookie_domain_t *cookie_domain; cookie_container_t *cookie_container, *iter; - size_t path_len, len; + size_t len; - cookie_domain = get_cookie_domain(substrz(domain), create); + cookie_domain = get_cookie_domain(domain, create); if(!cookie_domain) return NULL; - path_len = strlenW(path); - LIST_FOR_EACH_ENTRY(cookie_container, &cookie_domain->path_list, cookie_container_t, entry) { len = strlenW(cookie_container->path); - if(len < path_len) + if(len < path.len) break; - if(!strcmpiW(cookie_container->path, path)) + if(path.len == strlenW(cookie_container->path) && !strncmpiW(cookie_container->path, path.str, path.len)) return cookie_container; } @@ -170,7 +168,7 @@ static cookie_container_t *get_cookie_container(const WCHAR *domain, const WCHAR if(!cookie_container) return NULL; - cookie_container->path = heap_strdupW(path); + cookie_container->path = heap_strndupW(path.str, path.len); if(!cookie_container->path) { heap_free(cookie_container); return NULL; @@ -179,9 +177,8 @@ static cookie_container_t *get_cookie_container(const WCHAR *domain, const WCHAR cookie_container->domain = cookie_domain; list_init(&cookie_container->cookie_list); - LIST_FOR_EACH_ENTRY(iter, &cookie_domain->path_list, cookie_container_t, entry) { - if(strlenW(iter->path) <= path_len) { + if(strlenW(iter->path) <= path.len) { list_add_before(&iter->entry, &cookie_container->entry); return cookie_container; } @@ -341,7 +338,7 @@ static BOOL load_persistent_cookie(LPCWSTR domain, LPCWSTR path) str[size] = 0; UnlockUrlCacheEntryStream(cookie, 0); - cookie_container = get_cookie_container(domain, path, TRUE); + cookie_container = get_cookie_container(substrz(domain), substrz(path), TRUE); if(!cookie_container) { heap_free(str); return FALSE; @@ -1043,7 +1040,7 @@ DWORD set_cookie(const WCHAR *domain, const WCHAR *path, const WCHAR *cookie_nam load_persistent_cookie(domain, path); - container = get_cookie_container(domain, path, !expired); + container = get_cookie_container(substrz(domain), substrz(path), !expired); if(!container) { heap_free(data); if (value != data) heap_free(value);
1
0
0
0
Jacek Caban : wininet: Pass domain to get_cookie_domain as a substring.
by Alexandre Julliard
17 May '16
17 May '16
Module: wine Branch: master Commit: 5b98186abfa9abe4f727807022d82695209f1d64 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=5b98186abfa9abe4f72780702…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 16 22:42:25 2016 +0200 wininet: Pass domain to get_cookie_domain as a substring. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/cookie.c | 19 ++++++++++--------- dlls/wininet/internet.h | 16 ++++++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 36346d5..6734c1f 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -92,19 +92,20 @@ static CRITICAL_SECTION_DEBUG cookie_cs_debug = static CRITICAL_SECTION cookie_cs = { &cookie_cs_debug, -1, 0, 0, 0, 0 }; static struct list domain_list = LIST_INIT(domain_list); -static cookie_domain_t *get_cookie_domain(const WCHAR *domain, BOOL create) +static cookie_domain_t *get_cookie_domain(substr_t domain, BOOL create) { - const WCHAR *ptr = domain + strlenW(domain), *ptr_end, *subdomain_ptr; + const WCHAR *ptr = domain.str + domain.len, *ptr_end, *subdomain_ptr; cookie_domain_t *iter, *current_domain, *prev_domain = NULL; struct list *current_list = &domain_list; while(1) { - for(ptr_end = ptr--; ptr > domain && *ptr != '.'; ptr--); + for(ptr_end = ptr--; ptr > domain.str && *ptr != '.'; ptr--); subdomain_ptr = *ptr == '.' ? ptr+1 : ptr; current_domain = NULL; LIST_FOR_EACH_ENTRY(iter, current_list, cookie_domain_t, entry) { - if(ptr_end-subdomain_ptr == iter->subdomain_len && !memcmp(subdomain_ptr, iter->domain, iter->subdomain_len)) { + if(ptr_end-subdomain_ptr == iter->subdomain_len + && !memcmp(subdomain_ptr, iter->domain, iter->subdomain_len*sizeof(WCHAR))) { current_domain = iter; break; } @@ -118,7 +119,7 @@ static cookie_domain_t *get_cookie_domain(const WCHAR *domain, BOOL create) if(!current_domain) return NULL; - current_domain->domain = heap_strdupW(subdomain_ptr); + current_domain->domain = heap_strndupW(subdomain_ptr, domain.str + domain.len - subdomain_ptr); if(!current_domain->domain) { heap_free(current_domain); return NULL; @@ -133,7 +134,7 @@ static cookie_domain_t *get_cookie_domain(const WCHAR *domain, BOOL create) list_add_tail(current_list, ¤t_domain->entry); } - if(ptr == domain) + if(ptr == domain.str) return current_domain; prev_domain = current_domain; @@ -147,7 +148,7 @@ static cookie_container_t *get_cookie_container(const WCHAR *domain, const WCHAR cookie_container_t *cookie_container, *iter; size_t path_len, len; - cookie_domain = get_cookie_domain(domain, create); + cookie_domain = get_cookie_domain(substrz(domain), create); if(!cookie_domain) return NULL; @@ -592,13 +593,13 @@ static DWORD get_cookie(const WCHAR *host, const WCHAR *path, DWORD flags, cooki while(ptr>subpath && ptr[-1]!='/') ptr--; }while(ptr != subpath); - domain = get_cookie_domain(host, FALSE); + domain = get_cookie_domain(substrz(host), FALSE); if(!domain) { TRACE("Unknown host %s\n", debugstr_w(host)); return ERROR_NO_MORE_ITEMS; } - for(domain = get_cookie_domain(host, FALSE); domain; domain = domain->parent) { + for(domain = get_cookie_domain(substrz(host), FALSE); domain; domain = domain->parent) { TRACE("Trying %s domain...\n", debugstr_w(domain->domain)); LIST_FOR_EACH_ENTRY(container, &domain->path_list, cookie_container_t, entry) { diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index eb3a023..7a01cdc 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -215,6 +215,22 @@ static inline char *heap_strdupWtoA(LPCWSTR str) return ret; } +typedef struct { + const WCHAR *str; + size_t len; +} substr_t; + +static inline substr_t substr(const WCHAR *str, size_t len) +{ + substr_t r = {str, len}; + return r; +} + +static inline substr_t substrz(const WCHAR *str) +{ + return substr(str, strlenW(str)); +} + static inline void WININET_find_data_WtoA(LPWIN32_FIND_DATAW dataW, LPWIN32_FIND_DATAA dataA) { dataA->dwFileAttributes = dataW->dwFileAttributes;
1
0
0
0
Jacek Caban : wininet: Fixed handing NULL buffer in InternetReadFileExW.
by Alexandre Julliard
17 May '16
17 May '16
Module: wine Branch: master Commit: f70c9ae8d147ac2f4377dae1f90eacf18d05df91 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f70c9ae8d147ac2f4377dae1f…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 16 22:42:19 2016 +0200 wininet: Fixed handing NULL buffer in InternetReadFileExW. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/internet.c | 2 +- dlls/wininet/tests/http.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 5359794..e192592 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -2280,7 +2280,7 @@ BOOL WINAPI InternetReadFileExW(HINTERNET hFile, LPINTERNET_BUFFERSW lpBuffer, TRACE("(%p %p 0x%x 0x%lx)\n", hFile, lpBuffer, dwFlags, dwContext); - if (lpBuffer->dwStructSize != sizeof(*lpBuffer)) { + if (!lpBuffer || lpBuffer->dwStructSize != sizeof(*lpBuffer)) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index b4cad7d..78cec50 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -1067,6 +1067,11 @@ static void InternetReadFileExA_test(int flags) CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTING_TO_SERVER); CLEAR_NOTIFIED(INTERNET_STATUS_CONNECTED_TO_SERVER); + rc = InternetReadFileExW(hor, NULL, 0, 0xdeadcafe); + ok(!rc && (GetLastError() == ERROR_INVALID_PARAMETER), + "InternetReadFileEx should have failed with ERROR_INVALID_PARAMETER instead of %s, %u\n", + rc ? "TRUE" : "FALSE", GetLastError()); + /* tests invalid dwStructSize */ inetbuffers.dwStructSize = sizeof(inetbuffers)+1; inetbuffers.lpcszHeader = NULL;
1
0
0
0
Jacek Caban : wininet: Fixed internet tests on win10.
by Alexandre Julliard
17 May '16
17 May '16
Module: wine Branch: master Commit: cebb5d3066d79eaabb77b5471ebc960c202b20cb URL:
http://source.winehq.org/git/wine.git/?a=commit;h=cebb5d3066d79eaabb77b5471…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Mon May 16 22:42:14 2016 +0200 wininet: Fixed internet tests on win10. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wininet/tests/internet.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dlls/wininet/tests/internet.c b/dlls/wininet/tests/internet.c index 45907e4..37490c2 100644 --- a/dlls/wininet/tests/internet.c +++ b/dlls/wininet/tests/internet.c @@ -1500,6 +1500,10 @@ static void test_InternetErrorDlg(void) continue; } break; + case ERROR_INTERNET_CHG_POST_IS_NON_SECURE: + if(res == ERROR_SUCCESS) /* win10 returns ERROR_SUCCESS */ + expected = ERROR_SUCCESS; + break; default: break; }
1
0
0
0
← Newer
1
...
31
32
33
34
35
36
37
...
55
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Results per page:
10
25
50
100
200