2003-06-21 01:26:56 +02:00
|
|
|
/*
|
|
|
|
* Wininet - cookie handling stuff
|
|
|
|
*
|
|
|
|
* Copyright 2002 TransGaming Technologies Inc.
|
|
|
|
*
|
|
|
|
* David Hammerton
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2003-06-21 01:26:56 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
2004-09-03 20:30:28 +02:00
|
|
|
#include "wine/port.h"
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2008-12-09 11:33:25 +01:00
|
|
|
#if defined(__MINGW32__) || defined (_MSC_VER)
|
|
|
|
#include <ws2tcpip.h>
|
|
|
|
#endif
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2003-06-21 01:26:56 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2012-12-27 17:54:19 +01:00
|
|
|
#include <assert.h>
|
2003-08-08 23:07:23 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
2003-06-21 01:26:56 +02:00
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "wininet.h"
|
|
|
|
#include "winerror.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
#include "internet.h"
|
|
|
|
|
|
|
|
#define RESPONSE_TIMEOUT 30 /* FROM internet.c */
|
|
|
|
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(wininet);
|
|
|
|
|
|
|
|
/* FIXME
|
2005-01-26 22:09:04 +01:00
|
|
|
* Cookies could use A LOT OF MEMORY. We need some kind of memory management here!
|
2003-06-21 01:26:56 +02:00
|
|
|
*/
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
struct _cookie_domain_t;
|
|
|
|
struct _cookie_container_t;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
typedef struct _cookie_t {
|
2004-07-21 21:36:53 +02:00
|
|
|
struct list entry;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
struct _cookie_container_t *container;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
WCHAR *name;
|
|
|
|
WCHAR *data;
|
2012-10-01 14:20:35 +02:00
|
|
|
DWORD flags;
|
2009-02-18 15:32:26 +01:00
|
|
|
FILETIME expiry;
|
2012-10-01 14:20:35 +02:00
|
|
|
FILETIME create;
|
2014-07-14 15:21:38 +02:00
|
|
|
} cookie_t;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
typedef struct _cookie_container_t {
|
2004-07-21 21:36:53 +02:00
|
|
|
struct list entry;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
WCHAR *path;
|
|
|
|
struct _cookie_domain_t *domain;
|
|
|
|
|
2004-07-21 21:36:53 +02:00
|
|
|
struct list cookie_list;
|
2014-07-14 15:21:38 +02:00
|
|
|
} cookie_container_t;
|
|
|
|
|
|
|
|
typedef struct _cookie_domain_t {
|
|
|
|
struct list entry;
|
|
|
|
|
|
|
|
WCHAR *domain;
|
|
|
|
unsigned subdomain_len;
|
|
|
|
|
|
|
|
struct _cookie_domain_t *parent;
|
|
|
|
struct list subdomain_list;
|
|
|
|
|
|
|
|
/* List of stored paths sorted by length of the path. */
|
|
|
|
struct list path_list;
|
|
|
|
} cookie_domain_t;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2012-10-01 14:23:10 +02:00
|
|
|
static CRITICAL_SECTION cookie_cs;
|
|
|
|
static CRITICAL_SECTION_DEBUG cookie_cs_debug =
|
|
|
|
{
|
|
|
|
0, 0, &cookie_cs,
|
|
|
|
{ &cookie_cs_debug.ProcessLocksList, &cookie_cs_debug.ProcessLocksList },
|
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": cookie_cs") }
|
|
|
|
};
|
|
|
|
static CRITICAL_SECTION cookie_cs = { &cookie_cs_debug, -1, 0, 0, 0, 0 };
|
2004-07-21 21:36:53 +02:00
|
|
|
static struct list domain_list = LIST_INIT(domain_list);
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
static cookie_domain_t *get_cookie_domain(const WCHAR *domain, BOOL create)
|
|
|
|
{
|
|
|
|
const WCHAR *ptr = domain + strlenW(domain), *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--);
|
|
|
|
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)) {
|
|
|
|
current_domain = iter;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!current_domain) {
|
|
|
|
if(!create)
|
|
|
|
return prev_domain;
|
|
|
|
|
|
|
|
current_domain = heap_alloc(sizeof(*current_domain));
|
|
|
|
if(!current_domain)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
current_domain->domain = heap_strdupW(subdomain_ptr);
|
|
|
|
if(!current_domain->domain) {
|
|
|
|
heap_free(current_domain);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
current_domain->subdomain_len = ptr_end-subdomain_ptr;
|
|
|
|
|
|
|
|
current_domain->parent = prev_domain;
|
|
|
|
list_init(¤t_domain->path_list);
|
|
|
|
list_init(¤t_domain->subdomain_list);
|
|
|
|
|
|
|
|
list_add_tail(current_list, ¤t_domain->entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ptr == domain)
|
|
|
|
return current_domain;
|
|
|
|
|
|
|
|
prev_domain = current_domain;
|
|
|
|
current_list = ¤t_domain->subdomain_list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static cookie_container_t *get_cookie_container(const WCHAR *domain, const WCHAR *path, BOOL create)
|
|
|
|
{
|
|
|
|
cookie_domain_t *cookie_domain;
|
|
|
|
cookie_container_t *cookie_container, *iter;
|
|
|
|
size_t path_len, len;
|
|
|
|
|
|
|
|
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)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if(!strcmpiW(cookie_container->path, path))
|
|
|
|
return cookie_container;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!create)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
cookie_container = heap_alloc(sizeof(*cookie_container));
|
|
|
|
if(!cookie_container)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
cookie_container->path = heap_strdupW(path);
|
|
|
|
if(!cookie_container->path) {
|
|
|
|
heap_free(cookie_container);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
|
|
|
list_add_before(&iter->entry, &cookie_container->entry);
|
|
|
|
return cookie_container;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
list_add_tail(&cookie_domain->path_list, &cookie_container->entry);
|
|
|
|
return cookie_container;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void delete_cookie(cookie_t *cookie)
|
|
|
|
{
|
|
|
|
list_remove(&cookie->entry);
|
|
|
|
|
|
|
|
heap_free(cookie->name);
|
|
|
|
heap_free(cookie->data);
|
|
|
|
heap_free(cookie);
|
|
|
|
}
|
|
|
|
|
|
|
|
static cookie_t *alloc_cookie(const WCHAR *name, const WCHAR *data, FILETIME expiry, FILETIME create_time, DWORD flags)
|
|
|
|
{
|
|
|
|
cookie_t *new_cookie;
|
|
|
|
|
|
|
|
new_cookie = heap_alloc(sizeof(*new_cookie));
|
|
|
|
if(!new_cookie)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
new_cookie->expiry = expiry;
|
|
|
|
new_cookie->create = create_time;
|
|
|
|
new_cookie->flags = flags;
|
|
|
|
list_init(&new_cookie->entry);
|
|
|
|
|
|
|
|
new_cookie->name = heap_strdupW(name);
|
|
|
|
new_cookie->data = heap_strdupW(data);
|
|
|
|
if((name && !new_cookie->name) || (data && !new_cookie->data)) {
|
|
|
|
delete_cookie(new_cookie);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new_cookie;
|
|
|
|
}
|
|
|
|
|
|
|
|
static cookie_t *find_cookie(cookie_container_t *container, const WCHAR *name)
|
|
|
|
{
|
|
|
|
cookie_t *iter;
|
|
|
|
|
|
|
|
LIST_FOR_EACH_ENTRY(iter, &container->cookie_list, cookie_t, entry) {
|
|
|
|
if(!strcmpiW(iter->name, name))
|
|
|
|
return iter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_cookie(cookie_container_t *container, cookie_t *new_cookie)
|
|
|
|
{
|
|
|
|
TRACE("Adding %s=%s to %s %s\n", debugstr_w(new_cookie->name), debugstr_w(new_cookie->data),
|
|
|
|
debugstr_w(container->domain->domain), debugstr_w(container->path));
|
|
|
|
|
|
|
|
list_add_tail(&container->cookie_list, &new_cookie->entry);
|
|
|
|
new_cookie->container = container;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void replace_cookie(cookie_container_t *container, cookie_t *new_cookie)
|
|
|
|
{
|
|
|
|
cookie_t *old_cookie;
|
|
|
|
|
|
|
|
old_cookie = find_cookie(container, new_cookie->name);
|
|
|
|
if(old_cookie)
|
|
|
|
delete_cookie(old_cookie);
|
|
|
|
|
|
|
|
add_cookie(container, new_cookie);
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL cookie_match_path(cookie_container_t *container, const WCHAR *path)
|
|
|
|
{
|
|
|
|
return !strncmpiW(container->path, path, strlenW(container->path));
|
|
|
|
}
|
2012-10-01 14:21:59 +02:00
|
|
|
|
|
|
|
static BOOL create_cookie_url(LPCWSTR domain, LPCWSTR path, WCHAR *buf, DWORD buf_len)
|
|
|
|
{
|
|
|
|
static const WCHAR cookie_prefix[] = {'C','o','o','k','i','e',':'};
|
|
|
|
|
|
|
|
WCHAR *p;
|
|
|
|
DWORD len;
|
|
|
|
|
|
|
|
if(buf_len < sizeof(cookie_prefix)/sizeof(WCHAR))
|
|
|
|
return FALSE;
|
|
|
|
memcpy(buf, cookie_prefix, sizeof(cookie_prefix));
|
|
|
|
buf += sizeof(cookie_prefix)/sizeof(WCHAR);
|
|
|
|
buf_len -= sizeof(cookie_prefix)/sizeof(WCHAR);
|
|
|
|
p = buf;
|
|
|
|
|
|
|
|
len = buf_len;
|
|
|
|
if(!GetUserNameW(buf, &len))
|
|
|
|
return FALSE;
|
|
|
|
buf += len-1;
|
|
|
|
buf_len -= len-1;
|
|
|
|
|
|
|
|
if(!buf_len)
|
|
|
|
return FALSE;
|
|
|
|
*(buf++) = '@';
|
|
|
|
buf_len--;
|
|
|
|
|
|
|
|
len = strlenW(domain);
|
|
|
|
if(len >= buf_len)
|
|
|
|
return FALSE;
|
|
|
|
memcpy(buf, domain, len*sizeof(WCHAR));
|
|
|
|
buf += len;
|
|
|
|
buf_len -= len;
|
|
|
|
|
|
|
|
len = strlenW(path);
|
|
|
|
if(len >= buf_len)
|
|
|
|
return FALSE;
|
|
|
|
memcpy(buf, path, len*sizeof(WCHAR));
|
|
|
|
buf += len;
|
|
|
|
|
|
|
|
*buf = 0;
|
|
|
|
|
|
|
|
for(; *p; p++)
|
|
|
|
*p = tolowerW(*p);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL load_persistent_cookie(LPCWSTR domain, LPCWSTR path)
|
|
|
|
{
|
|
|
|
INTERNET_CACHE_ENTRY_INFOW *info;
|
2014-07-14 15:21:38 +02:00
|
|
|
cookie_container_t *cookie_container;
|
|
|
|
cookie_t *new_cookie;
|
2012-10-01 14:21:59 +02:00
|
|
|
WCHAR cookie_url[MAX_PATH];
|
|
|
|
HANDLE cookie;
|
|
|
|
char *str = NULL, *pbeg, *pend;
|
|
|
|
DWORD size, flags;
|
|
|
|
WCHAR *name, *data;
|
|
|
|
FILETIME expiry, create, time;
|
|
|
|
|
|
|
|
if (!create_cookie_url(domain, path, cookie_url, sizeof(cookie_url)/sizeof(cookie_url[0])))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
size = 0;
|
|
|
|
RetrieveUrlCacheEntryStreamW(cookie_url, NULL, &size, FALSE, 0);
|
|
|
|
if(GetLastError() != ERROR_INSUFFICIENT_BUFFER)
|
|
|
|
return TRUE;
|
|
|
|
info = heap_alloc(size);
|
|
|
|
if(!info)
|
|
|
|
return FALSE;
|
|
|
|
cookie = RetrieveUrlCacheEntryStreamW(cookie_url, info, &size, FALSE, 0);
|
|
|
|
size = info->dwSizeLow;
|
|
|
|
heap_free(info);
|
|
|
|
if(!cookie)
|
|
|
|
return FALSE;
|
|
|
|
|
2012-12-21 17:06:33 +01:00
|
|
|
if(!(str = heap_alloc(size+1)) || !ReadUrlCacheEntryStream(cookie, 0, str, &size, 0)) {
|
2012-10-01 14:21:59 +02:00
|
|
|
UnlockUrlCacheEntryStream(cookie, 0);
|
|
|
|
heap_free(str);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2012-12-21 17:06:33 +01:00
|
|
|
str[size] = 0;
|
2012-10-01 14:21:59 +02:00
|
|
|
UnlockUrlCacheEntryStream(cookie, 0);
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
cookie_container = get_cookie_container(domain, path, TRUE);
|
|
|
|
if(!cookie_container)
|
2012-10-01 14:21:59 +02:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
GetSystemTimeAsFileTime(&time);
|
|
|
|
for(pbeg=str; pbeg && *pbeg; name=data=NULL) {
|
|
|
|
pend = strchr(pbeg, '\n');
|
|
|
|
if(!pend)
|
|
|
|
break;
|
|
|
|
*pend = 0;
|
|
|
|
name = heap_strdupAtoW(pbeg);
|
|
|
|
|
|
|
|
pbeg = pend+1;
|
|
|
|
pend = strchr(pbeg, '\n');
|
|
|
|
if(!pend)
|
|
|
|
break;
|
|
|
|
*pend = 0;
|
|
|
|
data = heap_strdupAtoW(pbeg);
|
|
|
|
|
|
|
|
pbeg = pend+1;
|
|
|
|
pbeg = strchr(pend+1, '\n');
|
|
|
|
if(!pbeg)
|
|
|
|
break;
|
|
|
|
sscanf(pbeg, "%u %u %u %u %u", &flags, &expiry.dwLowDateTime, &expiry.dwHighDateTime,
|
|
|
|
&create.dwLowDateTime, &create.dwHighDateTime);
|
|
|
|
|
|
|
|
/* skip "*\n" */
|
|
|
|
pbeg = strchr(pbeg, '*');
|
|
|
|
if(pbeg) {
|
|
|
|
pbeg++;
|
|
|
|
if(*pbeg)
|
|
|
|
pbeg++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!name || !data)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if(CompareFileTime(&time, &expiry) <= 0) {
|
2014-07-14 15:21:38 +02:00
|
|
|
new_cookie = alloc_cookie(NULL, NULL, expiry, create, flags);
|
|
|
|
if(!new_cookie)
|
|
|
|
break;
|
|
|
|
|
|
|
|
new_cookie->name = name;
|
|
|
|
new_cookie->data = data;
|
|
|
|
|
|
|
|
replace_cookie(cookie_container, new_cookie);
|
|
|
|
}else {
|
|
|
|
heap_free(name);
|
|
|
|
heap_free(data);
|
2012-10-01 14:21:59 +02:00
|
|
|
}
|
|
|
|
}
|
2013-04-01 13:11:57 +02:00
|
|
|
heap_free(str);
|
2012-10-01 14:21:59 +02:00
|
|
|
heap_free(name);
|
|
|
|
heap_free(data);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
static BOOL save_persistent_cookie(cookie_container_t *container)
|
2012-10-01 14:21:59 +02:00
|
|
|
{
|
|
|
|
static const WCHAR txtW[] = {'t','x','t',0};
|
|
|
|
|
|
|
|
WCHAR cookie_url[MAX_PATH], cookie_file[MAX_PATH];
|
|
|
|
HANDLE cookie_handle;
|
2014-07-14 15:21:38 +02:00
|
|
|
cookie_t *cookie_container = NULL, *cookie_iter;
|
2012-10-01 14:21:59 +02:00
|
|
|
BOOL do_save = FALSE;
|
|
|
|
char buf[64], *dyn_buf;
|
|
|
|
FILETIME time;
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
if (!create_cookie_url(container->domain->domain, container->path, cookie_url, sizeof(cookie_url)/sizeof(cookie_url[0])))
|
2012-10-01 14:21:59 +02:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* check if there's anything to save */
|
|
|
|
GetSystemTimeAsFileTime(&time);
|
2014-07-14 15:21:38 +02:00
|
|
|
LIST_FOR_EACH_ENTRY_SAFE(cookie_container, cookie_iter, &container->cookie_list, cookie_t, entry)
|
2012-10-01 14:21:59 +02:00
|
|
|
{
|
|
|
|
if((cookie_container->expiry.dwLowDateTime || cookie_container->expiry.dwHighDateTime)
|
|
|
|
&& CompareFileTime(&time, &cookie_container->expiry) > 0) {
|
2014-07-14 15:21:38 +02:00
|
|
|
delete_cookie(cookie_container);
|
2012-10-01 14:21:59 +02:00
|
|
|
continue;
|
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2012-10-01 14:21:59 +02:00
|
|
|
if(!(cookie_container->flags & INTERNET_COOKIE_IS_SESSION)) {
|
|
|
|
do_save = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!do_save) {
|
|
|
|
DeleteUrlCacheEntryW(cookie_url);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!CreateUrlCacheEntryW(cookie_url, 0, txtW, cookie_file, 0))
|
|
|
|
return FALSE;
|
|
|
|
cookie_handle = CreateFileW(cookie_file, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
|
|
|
|
if(cookie_handle == INVALID_HANDLE_VALUE) {
|
|
|
|
DeleteFileW(cookie_file);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(cookie_container, &container->cookie_list, cookie_t, entry)
|
2012-10-01 14:21:59 +02:00
|
|
|
{
|
|
|
|
if(cookie_container->flags & INTERNET_COOKIE_IS_SESSION)
|
|
|
|
continue;
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
dyn_buf = heap_strdupWtoA(cookie_container->name);
|
2012-10-01 14:21:59 +02:00
|
|
|
if(!dyn_buf || !WriteFile(cookie_handle, dyn_buf, strlen(dyn_buf), NULL, NULL)) {
|
|
|
|
heap_free(dyn_buf);
|
|
|
|
do_save = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
heap_free(dyn_buf);
|
|
|
|
if(!WriteFile(cookie_handle, "\n", 1, NULL, NULL)) {
|
|
|
|
do_save = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
dyn_buf = heap_strdupWtoA(cookie_container->data);
|
2012-10-01 14:21:59 +02:00
|
|
|
if(!dyn_buf || !WriteFile(cookie_handle, dyn_buf, strlen(dyn_buf), NULL, NULL)) {
|
|
|
|
heap_free(dyn_buf);
|
|
|
|
do_save = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
heap_free(dyn_buf);
|
|
|
|
if(!WriteFile(cookie_handle, "\n", 1, NULL, NULL)) {
|
|
|
|
do_save = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
dyn_buf = heap_strdupWtoA(container->domain->domain);
|
2012-10-01 14:21:59 +02:00
|
|
|
if(!dyn_buf || !WriteFile(cookie_handle, dyn_buf, strlen(dyn_buf), NULL, NULL)) {
|
|
|
|
heap_free(dyn_buf);
|
|
|
|
do_save = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
heap_free(dyn_buf);
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
dyn_buf = heap_strdupWtoA(container->path);
|
2012-10-01 14:21:59 +02:00
|
|
|
if(!dyn_buf || !WriteFile(cookie_handle, dyn_buf, strlen(dyn_buf), NULL, NULL)) {
|
|
|
|
heap_free(dyn_buf);
|
|
|
|
do_save = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
heap_free(dyn_buf);
|
|
|
|
|
|
|
|
sprintf(buf, "\n%u\n%u\n%u\n%u\n%u\n*\n", cookie_container->flags,
|
|
|
|
cookie_container->expiry.dwLowDateTime, cookie_container->expiry.dwHighDateTime,
|
|
|
|
cookie_container->create.dwLowDateTime, cookie_container->create.dwHighDateTime);
|
|
|
|
if(!WriteFile(cookie_handle, buf, strlen(buf), NULL, NULL)) {
|
|
|
|
do_save = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CloseHandle(cookie_handle);
|
|
|
|
if(!do_save) {
|
|
|
|
ERR("error saving cookie file\n");
|
|
|
|
DeleteFileW(cookie_file);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset(&time, 0, sizeof(time));
|
|
|
|
return CommitUrlCacheEntryW(cookie_url, cookie_file, time, time, 0, NULL, 0, txtW, 0);
|
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2007-11-14 13:15:16 +01:00
|
|
|
static BOOL COOKIE_crackUrlSimple(LPCWSTR lpszUrl, LPWSTR hostName, int hostNameLen, LPWSTR path, int pathLen)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2004-03-30 22:38:08 +02:00
|
|
|
URL_COMPONENTSW UrlComponents;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
|
|
|
UrlComponents.lpszExtraInfo = NULL;
|
|
|
|
UrlComponents.lpszPassword = NULL;
|
|
|
|
UrlComponents.lpszScheme = NULL;
|
|
|
|
UrlComponents.lpszUrlPath = path;
|
|
|
|
UrlComponents.lpszUserName = NULL;
|
|
|
|
UrlComponents.lpszHostName = hostName;
|
2007-11-08 18:09:36 +01:00
|
|
|
UrlComponents.dwExtraInfoLength = 0;
|
|
|
|
UrlComponents.dwPasswordLength = 0;
|
|
|
|
UrlComponents.dwSchemeLength = 0;
|
|
|
|
UrlComponents.dwUserNameLength = 0;
|
2004-07-21 21:36:53 +02:00
|
|
|
UrlComponents.dwHostNameLength = hostNameLen;
|
|
|
|
UrlComponents.dwUrlPathLength = pathLen;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2009-10-26 09:56:04 +01:00
|
|
|
if (!InternetCrackUrlW(lpszUrl, 0, 0, &UrlComponents)) return FALSE;
|
2009-02-17 17:28:54 +01:00
|
|
|
|
|
|
|
/* discard the webpage off the end of the path */
|
2009-10-26 09:56:04 +01:00
|
|
|
if (UrlComponents.dwUrlPathLength)
|
2009-02-17 17:28:54 +01:00
|
|
|
{
|
2009-10-26 09:56:04 +01:00
|
|
|
if (path[UrlComponents.dwUrlPathLength - 1] != '/')
|
2009-02-17 17:28:54 +01:00
|
|
|
{
|
2009-10-26 09:56:04 +01:00
|
|
|
WCHAR *ptr;
|
|
|
|
if ((ptr = strrchrW(path, '/'))) *(++ptr) = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
path[0] = '/';
|
|
|
|
path[1] = 0;
|
|
|
|
}
|
2009-02-17 17:28:54 +01:00
|
|
|
}
|
|
|
|
}
|
2009-10-26 09:56:04 +01:00
|
|
|
else if (pathLen >= 2)
|
|
|
|
{
|
|
|
|
path[0] = '/';
|
|
|
|
path[1] = 0;
|
|
|
|
}
|
|
|
|
return TRUE;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
2014-07-04 14:45:34 +02:00
|
|
|
DWORD get_cookie(const WCHAR *host, const WCHAR *path, WCHAR *cookie_data, DWORD *size, DWORD flags)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2013-04-24 15:43:31 +02:00
|
|
|
static const WCHAR empty_path[] = { '/',0 };
|
|
|
|
|
2012-12-27 17:54:19 +01:00
|
|
|
unsigned cnt = 0, len, name_len, domain_count = 0, cookie_count = 0;
|
2013-04-24 15:43:31 +02:00
|
|
|
WCHAR *ptr, subpath[INTERNET_MAX_PATH_LENGTH];
|
|
|
|
const WCHAR *p;
|
2014-07-14 15:21:38 +02:00
|
|
|
cookie_domain_t *domain;
|
|
|
|
cookie_container_t *container;
|
2009-02-18 15:32:26 +01:00
|
|
|
FILETIME tm;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
GetSystemTimeAsFileTime(&tm);
|
2006-06-02 12:49:27 +02:00
|
|
|
|
2012-10-01 14:23:10 +02:00
|
|
|
EnterCriticalSection(&cookie_cs);
|
|
|
|
|
2013-04-24 15:43:31 +02:00
|
|
|
len = strlenW(host);
|
|
|
|
p = host+len;
|
|
|
|
while(p>host && p[-1]!='.') p--;
|
|
|
|
while(p != host) {
|
|
|
|
p--;
|
|
|
|
while(p>host && p[-1]!='.') p--;
|
|
|
|
if(p == host) break;
|
|
|
|
|
|
|
|
load_persistent_cookie(p, empty_path);
|
|
|
|
}
|
2012-10-01 14:21:59 +02:00
|
|
|
|
2013-04-24 15:43:31 +02:00
|
|
|
len = strlenW(path);
|
|
|
|
assert(len+1 < INTERNET_MAX_PATH_LENGTH);
|
|
|
|
memcpy(subpath, path, (len+1)*sizeof(WCHAR));
|
|
|
|
ptr = subpath+len;
|
|
|
|
do {
|
|
|
|
*ptr = 0;
|
|
|
|
load_persistent_cookie(host, subpath);
|
|
|
|
|
|
|
|
ptr--;
|
|
|
|
while(ptr>subpath && ptr[-1]!='/') ptr--;
|
|
|
|
}while(ptr != subpath);
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
domain = get_cookie_domain(host, FALSE);
|
|
|
|
if(!domain) {
|
|
|
|
TRACE("Unknown host %s\n", debugstr_w(host));
|
|
|
|
LeaveCriticalSection(&cookie_cs);
|
|
|
|
return ERROR_NO_MORE_ITEMS;
|
|
|
|
}
|
|
|
|
|
2013-04-24 15:43:31 +02:00
|
|
|
ptr = cookie_data;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
for(domain = get_cookie_domain(host, FALSE); domain; domain = domain->parent) {
|
|
|
|
TRACE("Trying %s domain...\n", debugstr_w(domain->domain));
|
2009-02-18 15:32:26 +01:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
LIST_FOR_EACH_ENTRY(container, &domain->path_list, cookie_container_t, entry) {
|
|
|
|
struct list *cursor, *cursor2;
|
2012-10-01 14:21:59 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
TRACE("path %s\n", debugstr_w(container->path));
|
2011-05-19 16:11:10 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
if(!cookie_match_path(container, path))
|
2011-05-19 16:11:10 +02:00
|
|
|
continue;
|
2009-02-18 15:32:26 +01:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
domain_count++;
|
|
|
|
TRACE("found domain %p\n", domain->domain);
|
2014-07-04 14:45:34 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
LIST_FOR_EACH_SAFE(cursor, cursor2, &container->cookie_list) {
|
|
|
|
cookie_t *cookie_iter = LIST_ENTRY(cursor, cookie_t, entry);
|
2007-11-14 13:15:29 +01:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
/* check for expiry */
|
|
|
|
if((cookie_iter->expiry.dwLowDateTime != 0 || cookie_iter->expiry.dwHighDateTime != 0)
|
|
|
|
&& CompareFileTime(&tm, &cookie_iter->expiry) > 0) {
|
|
|
|
TRACE("Found expired cookie. deleting\n");
|
|
|
|
delete_cookie(cookie_iter);
|
|
|
|
continue;
|
|
|
|
}
|
2012-12-27 17:54:19 +01:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
if((cookie_iter->flags & INTERNET_COOKIE_HTTPONLY) && !(flags & INTERNET_COOKIE_HTTPONLY))
|
|
|
|
continue;
|
2012-12-27 17:54:19 +01:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
if (cookie_count)
|
|
|
|
cnt += 2; /* '; ' */
|
|
|
|
cnt += name_len = strlenW(cookie_iter->name);
|
|
|
|
if ((len = strlenW(cookie_iter->data))) {
|
|
|
|
cnt += 1; /* = */
|
|
|
|
cnt += len;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(ptr) {
|
|
|
|
if(*size > cnt) {
|
|
|
|
if(cookie_count) {
|
|
|
|
*ptr++ = ';';
|
|
|
|
*ptr++ = ' ';
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(ptr, cookie_iter->name, name_len*sizeof(WCHAR));
|
|
|
|
ptr += name_len;
|
2012-12-27 17:54:19 +01:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
if(len) {
|
|
|
|
*ptr++ = '=';
|
|
|
|
memcpy(ptr, cookie_iter->data, len*sizeof(WCHAR));
|
|
|
|
ptr += len;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(cookie_data+cnt == ptr);
|
|
|
|
TRACE("Cookie: %s\n", debugstr_wn(cookie_data, cnt));
|
|
|
|
}else {
|
|
|
|
/* Stop writing data, just compute the size */
|
|
|
|
ptr = NULL;
|
|
|
|
}
|
2012-12-27 17:54:19 +01:00
|
|
|
}
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
cookie_count++;
|
|
|
|
}
|
2004-07-21 21:36:53 +02:00
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
2006-03-09 16:20:24 +01:00
|
|
|
|
2012-10-01 14:23:10 +02:00
|
|
|
LeaveCriticalSection(&cookie_cs);
|
|
|
|
|
2012-12-27 17:54:19 +01:00
|
|
|
if(ptr)
|
|
|
|
*ptr = 0;
|
|
|
|
|
|
|
|
if (!cnt) {
|
2011-05-19 16:11:10 +02:00
|
|
|
TRACE("no cookies found for %s\n", debugstr_w(host));
|
2012-12-27 17:54:19 +01:00
|
|
|
return ERROR_NO_MORE_ITEMS;
|
2006-03-09 16:20:24 +01:00
|
|
|
}
|
|
|
|
|
2012-12-27 17:54:19 +01:00
|
|
|
if(!cookie_data || !ptr) {
|
2011-05-19 16:11:10 +02:00
|
|
|
*size = (cnt + 1) * sizeof(WCHAR);
|
|
|
|
TRACE("returning %u\n", *size);
|
2012-12-27 17:54:19 +01:00
|
|
|
return cookie_data ? ERROR_INSUFFICIENT_BUFFER : ERROR_SUCCESS;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
*size = cnt + 1;
|
|
|
|
|
|
|
|
TRACE("Returning %u (from %u domains): %s\n", cnt, domain_count, debugstr_w(cookie_data));
|
2012-12-27 17:54:19 +01:00
|
|
|
return ERROR_SUCCESS;
|
2011-05-19 16:11:10 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
2014-07-03 16:31:23 +02:00
|
|
|
* InternetGetCookieExW (WININET.@)
|
2011-05-19 16:11:10 +02:00
|
|
|
*
|
|
|
|
* Retrieve cookie from the specified url
|
|
|
|
*
|
|
|
|
* It should be noted that on windows the lpszCookieName parameter is "not implemented".
|
|
|
|
* So it won't be implemented here.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2014-07-03 16:31:23 +02:00
|
|
|
BOOL WINAPI InternetGetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
|
|
|
LPWSTR lpCookieData, LPDWORD lpdwSize, DWORD flags, void *reserved)
|
2011-05-19 16:11:10 +02:00
|
|
|
{
|
|
|
|
WCHAR host[INTERNET_MAX_HOST_NAME_LENGTH], path[INTERNET_MAX_PATH_LENGTH];
|
2012-12-27 17:54:19 +01:00
|
|
|
DWORD res;
|
2011-05-19 16:11:10 +02:00
|
|
|
BOOL ret;
|
|
|
|
|
2014-07-03 16:31:23 +02:00
|
|
|
TRACE("(%s, %s, %p, %p, %x, %p)\n", debugstr_w(lpszUrl),debugstr_w(lpszCookieName), lpCookieData, lpdwSize, flags, reserved);
|
|
|
|
|
|
|
|
if (flags)
|
|
|
|
FIXME("flags 0x%08x not supported\n", flags);
|
2011-05-19 16:11:10 +02:00
|
|
|
|
|
|
|
if (!lpszUrl)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2011-05-19 16:11:10 +02:00
|
|
|
host[0] = 0;
|
|
|
|
ret = COOKIE_crackUrlSimple(lpszUrl, host, sizeof(host)/sizeof(host[0]), path, sizeof(path)/sizeof(path[0]));
|
2012-09-04 17:08:06 +02:00
|
|
|
if (!ret || !host[0]) {
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2014-07-04 14:45:34 +02:00
|
|
|
res = get_cookie(host, path, lpCookieData, lpdwSize, flags);
|
2012-12-27 17:54:19 +01:00
|
|
|
if(res != ERROR_SUCCESS)
|
|
|
|
SetLastError(res);
|
|
|
|
return res == ERROR_SUCCESS;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
2014-07-03 16:31:23 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetCookieW (WININET.@)
|
|
|
|
*
|
|
|
|
* Retrieve cookie for the specified URL.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetGetCookieW(const WCHAR *url, const WCHAR *name, WCHAR *data, DWORD *size)
|
|
|
|
{
|
|
|
|
TRACE("(%s, %s, %s, %p)\n", debugstr_w(url), debugstr_w(name), debugstr_w(data), size);
|
|
|
|
|
|
|
|
return InternetGetCookieExW(url, name, data, size, 0, NULL);
|
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2014-07-03 16:31:12 +02:00
|
|
|
* InternetGetCookieExA (WININET.@)
|
2003-06-21 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Retrieve cookie from the specified url
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2014-07-03 16:31:12 +02:00
|
|
|
BOOL WINAPI InternetGetCookieExA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
|
|
|
|
LPSTR lpCookieData, LPDWORD lpdwSize, DWORD flags, void *reserved)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2012-12-03 15:01:08 +01:00
|
|
|
WCHAR *url, *name;
|
2012-12-27 17:54:29 +01:00
|
|
|
DWORD len, size;
|
2004-03-30 22:38:08 +02:00
|
|
|
BOOL r;
|
|
|
|
|
2014-07-03 16:31:12 +02:00
|
|
|
TRACE("(%s %s %p %p(%u) %x %p)\n", debugstr_a(lpszUrl), debugstr_a(lpszCookieName),
|
|
|
|
lpCookieData, lpdwSize, lpdwSize ? *lpdwSize : 0, flags, reserved);
|
2004-03-30 22:38:08 +02:00
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
url = heap_strdupAtoW(lpszUrl);
|
|
|
|
name = heap_strdupAtoW(lpszCookieName);
|
2004-03-30 22:38:08 +02:00
|
|
|
|
2014-07-03 16:31:12 +02:00
|
|
|
r = InternetGetCookieExW( url, name, NULL, &len, flags, reserved );
|
2004-03-30 22:38:08 +02:00
|
|
|
if( r )
|
|
|
|
{
|
2012-12-03 15:01:08 +01:00
|
|
|
WCHAR *szCookieData;
|
|
|
|
|
2011-04-21 13:39:03 +02:00
|
|
|
szCookieData = heap_alloc(len * sizeof(WCHAR));
|
2004-03-30 22:38:08 +02:00
|
|
|
if( !szCookieData )
|
2007-10-11 23:00:17 +02:00
|
|
|
{
|
|
|
|
r = FALSE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-07-03 16:31:12 +02:00
|
|
|
r = InternetGetCookieExW( url, name, szCookieData, &len, flags, reserved );
|
2004-03-30 22:38:08 +02:00
|
|
|
|
2012-12-27 17:54:29 +01:00
|
|
|
if(r) {
|
|
|
|
size = WideCharToMultiByte( CP_ACP, 0, szCookieData, len, NULL, 0, NULL, NULL);
|
|
|
|
if(lpCookieData) {
|
|
|
|
if(*lpdwSize >= size) {
|
|
|
|
WideCharToMultiByte( CP_ACP, 0, szCookieData, len, lpCookieData, *lpdwSize, NULL, NULL);
|
|
|
|
}else {
|
|
|
|
SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
|
|
|
r = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*lpdwSize = size;
|
|
|
|
}
|
2012-12-03 15:01:08 +01:00
|
|
|
|
|
|
|
heap_free( szCookieData );
|
2007-10-11 23:00:17 +02:00
|
|
|
}
|
2004-03-30 22:38:08 +02:00
|
|
|
}
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free( name );
|
|
|
|
heap_free( url );
|
2004-03-30 22:38:08 +02:00
|
|
|
return r;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
2014-07-03 16:31:12 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetCookieA (WININET.@)
|
|
|
|
*
|
|
|
|
* See InternetGetCookieW.
|
|
|
|
*/
|
|
|
|
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);
|
|
|
|
|
|
|
|
return InternetGetCookieExA(url, name, data, size, 0, NULL);
|
|
|
|
}
|
2012-10-01 14:22:57 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* IsDomainLegalCookieDomainW (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI IsDomainLegalCookieDomainW( LPCWSTR s1, LPCWSTR s2 )
|
|
|
|
{
|
|
|
|
DWORD s1_len, s2_len;
|
|
|
|
|
|
|
|
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])
|
|
|
|
{
|
|
|
|
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)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (strncmpiW(s1, s2+s2_len-s1_len, s1_len) || (s2_len>s1_len && s2[s2_len-s1_len-1]!='.'))
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2014-07-04 14:45:26 +02:00
|
|
|
DWORD set_cookie(const WCHAR *domain, const WCHAR *path, const WCHAR *cookie_name, const WCHAR *cookie_data, DWORD flags)
|
2007-11-14 13:15:16 +01:00
|
|
|
{
|
2014-07-14 15:21:38 +02:00
|
|
|
cookie_container_t *container;
|
|
|
|
cookie_t *thisCookie;
|
2009-04-24 14:59:08 +02:00
|
|
|
LPWSTR data, value;
|
2009-02-17 17:28:46 +01:00
|
|
|
WCHAR *ptr;
|
2012-10-01 14:21:59 +02:00
|
|
|
FILETIME expiry, create;
|
|
|
|
BOOL expired = FALSE, update_persistent = FALSE;
|
2014-07-04 14:45:26 +02:00
|
|
|
DWORD cookie_flags = 0;
|
2009-02-17 17:28:46 +01:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
TRACE("%s %s %s=%s %x\n", debugstr_w(domain), debugstr_w(path), debugstr_w(cookie_name), debugstr_w(cookie_data), flags);
|
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
value = data = heap_strdupW(cookie_data);
|
|
|
|
if (!data)
|
2009-06-24 19:31:34 +02:00
|
|
|
{
|
2010-07-01 20:02:01 +02:00
|
|
|
ERR("could not allocate the cookie data buffer\n");
|
2014-07-04 14:45:17 +02:00
|
|
|
return COOKIE_STATE_UNKNOWN;
|
2009-06-24 19:31:34 +02:00
|
|
|
}
|
|
|
|
|
2009-02-18 15:32:26 +01:00
|
|
|
memset(&expiry,0,sizeof(expiry));
|
2012-10-01 14:21:59 +02:00
|
|
|
GetSystemTimeAsFileTime(&create);
|
2009-02-17 17:28:46 +01:00
|
|
|
|
2009-04-20 14:47:23 +02:00
|
|
|
/* lots of information can be parsed out of the cookie value */
|
2009-02-17 17:28:46 +01:00
|
|
|
|
|
|
|
ptr = data;
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
static const WCHAR szDomain[] = {'d','o','m','a','i','n','=',0};
|
|
|
|
static const WCHAR szPath[] = {'p','a','t','h','=',0};
|
|
|
|
static const WCHAR szExpires[] = {'e','x','p','i','r','e','s','=',0};
|
|
|
|
static const WCHAR szSecure[] = {'s','e','c','u','r','e',0};
|
|
|
|
static const WCHAR szHttpOnly[] = {'h','t','t','p','o','n','l','y',0};
|
|
|
|
|
|
|
|
if (!(ptr = strchrW(ptr,';'))) break;
|
|
|
|
*ptr++ = 0;
|
2009-04-24 14:59:08 +02:00
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
if (value != data) heap_free(value);
|
2011-04-21 13:39:03 +02:00
|
|
|
value = heap_alloc((ptr - data) * sizeof(WCHAR));
|
2009-06-24 19:31:34 +02:00
|
|
|
if (value == NULL)
|
|
|
|
{
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(data);
|
2010-07-01 20:02:01 +02:00
|
|
|
ERR("could not allocate the cookie value buffer\n");
|
2014-07-04 14:45:17 +02:00
|
|
|
return COOKIE_STATE_UNKNOWN;
|
2009-06-24 19:31:34 +02:00
|
|
|
}
|
2009-04-24 14:59:08 +02:00
|
|
|
strcpyW(value, data);
|
|
|
|
|
2009-02-17 17:28:46 +01:00
|
|
|
while (*ptr == ' ') ptr++; /* whitespace */
|
|
|
|
|
|
|
|
if (strncmpiW(ptr, szDomain, 7) == 0)
|
|
|
|
{
|
2012-10-01 14:22:57 +02:00
|
|
|
WCHAR *end_ptr;
|
|
|
|
|
|
|
|
ptr += sizeof(szDomain)/sizeof(szDomain[0])-1;
|
|
|
|
if(*ptr == '.')
|
|
|
|
ptr++;
|
|
|
|
end_ptr = strchrW(ptr, ';');
|
|
|
|
if(end_ptr)
|
|
|
|
*end_ptr = 0;
|
|
|
|
|
|
|
|
if(!IsDomainLegalCookieDomainW(ptr, domain))
|
|
|
|
{
|
|
|
|
if(value != data)
|
|
|
|
heap_free(value);
|
|
|
|
heap_free(data);
|
2014-07-04 14:45:17 +02:00
|
|
|
return COOKIE_STATE_UNKNOWN;
|
2012-10-01 14:22:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(end_ptr)
|
|
|
|
*end_ptr = ';';
|
|
|
|
|
2009-02-17 17:28:46 +01:00
|
|
|
domain = ptr;
|
|
|
|
TRACE("Parsing new domain %s\n",debugstr_w(domain));
|
|
|
|
}
|
|
|
|
else if (strncmpiW(ptr, szPath, 5) == 0)
|
|
|
|
{
|
|
|
|
ptr+=strlenW(szPath);
|
|
|
|
path = ptr;
|
|
|
|
TRACE("Parsing new path %s\n",debugstr_w(path));
|
|
|
|
}
|
|
|
|
else if (strncmpiW(ptr, szExpires, 8) == 0)
|
2009-02-18 15:32:26 +01:00
|
|
|
{
|
|
|
|
SYSTEMTIME st;
|
|
|
|
ptr+=strlenW(szExpires);
|
|
|
|
if (InternetTimeToSystemTimeW(ptr, &st, 0))
|
|
|
|
{
|
|
|
|
SystemTimeToFileTime(&st, &expiry);
|
|
|
|
|
2012-10-01 14:21:59 +02:00
|
|
|
if (CompareFileTime(&create,&expiry) > 0)
|
2009-02-18 15:32:26 +01:00
|
|
|
{
|
|
|
|
TRACE("Cookie already expired.\n");
|
|
|
|
expired = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-17 17:28:46 +01:00
|
|
|
else if (strncmpiW(ptr, szSecure, 6) == 0)
|
2009-04-24 14:59:08 +02:00
|
|
|
{
|
2009-02-17 17:28:46 +01:00
|
|
|
FIXME("secure not handled (%s)\n",debugstr_w(ptr));
|
2009-04-24 14:59:08 +02:00
|
|
|
ptr += strlenW(szSecure);
|
|
|
|
}
|
2009-02-17 17:28:46 +01:00
|
|
|
else if (strncmpiW(ptr, szHttpOnly, 8) == 0)
|
2009-04-24 14:59:08 +02:00
|
|
|
{
|
2014-07-04 14:45:26 +02:00
|
|
|
if(!(flags & INTERNET_COOKIE_HTTPONLY)) {
|
|
|
|
WARN("HTTP only cookie added without INTERNET_COOKIE_HTTPONLY flag\n");
|
|
|
|
heap_free(data);
|
|
|
|
if (value != data) heap_free(value);
|
|
|
|
SetLastError(ERROR_INVALID_OPERATION);
|
|
|
|
return COOKIE_STATE_REJECT;
|
|
|
|
}
|
|
|
|
|
|
|
|
cookie_flags |= INTERNET_COOKIE_HTTPONLY;
|
2009-04-24 14:59:08 +02:00
|
|
|
ptr += strlenW(szHttpOnly);
|
|
|
|
}
|
|
|
|
else if (*ptr)
|
|
|
|
{
|
2009-02-17 17:28:46 +01:00
|
|
|
FIXME("Unknown additional option %s\n",debugstr_w(ptr));
|
2009-04-24 14:59:08 +02:00
|
|
|
break;
|
|
|
|
}
|
2009-02-17 17:28:46 +01:00
|
|
|
}
|
2007-11-14 13:15:16 +01:00
|
|
|
|
2012-10-01 14:23:10 +02:00
|
|
|
EnterCriticalSection(&cookie_cs);
|
|
|
|
|
2012-10-01 14:21:59 +02:00
|
|
|
load_persistent_cookie(domain, path);
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
container = get_cookie_container(domain, path, !expired);
|
|
|
|
if(!container) {
|
|
|
|
heap_free(data);
|
|
|
|
if (value != data) heap_free(value);
|
|
|
|
LeaveCriticalSection(&cookie_cs);
|
|
|
|
return COOKIE_STATE_ACCEPT;
|
2009-02-18 15:32:26 +01:00
|
|
|
}
|
2007-11-14 13:15:16 +01:00
|
|
|
|
2012-10-01 14:21:59 +02:00
|
|
|
if(!expiry.dwLowDateTime && !expiry.dwHighDateTime)
|
2014-07-04 14:45:26 +02:00
|
|
|
cookie_flags |= INTERNET_COOKIE_IS_SESSION;
|
2012-10-01 14:21:59 +02:00
|
|
|
else
|
|
|
|
update_persistent = TRUE;
|
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
if ((thisCookie = find_cookie(container, cookie_name)))
|
2012-10-01 14:21:59 +02:00
|
|
|
{
|
2014-07-11 12:20:31 +02:00
|
|
|
if ((thisCookie->flags & INTERNET_COOKIE_HTTPONLY) && !(flags & INTERNET_COOKIE_HTTPONLY)) {
|
|
|
|
WARN("An attempt to override httponly cookie\n");
|
|
|
|
SetLastError(ERROR_INVALID_OPERATION);
|
|
|
|
heap_free(data);
|
|
|
|
if (value != data) heap_free(value);
|
|
|
|
return COOKIE_STATE_REJECT;
|
|
|
|
}
|
|
|
|
|
2012-10-01 14:21:59 +02:00
|
|
|
if (!(thisCookie->flags & INTERNET_COOKIE_IS_SESSION))
|
|
|
|
update_persistent = TRUE;
|
2014-07-14 15:21:38 +02:00
|
|
|
delete_cookie(thisCookie);
|
2012-10-01 14:21:59 +02:00
|
|
|
}
|
2007-11-14 13:15:16 +01:00
|
|
|
|
2009-02-17 17:29:03 +01:00
|
|
|
TRACE("setting cookie %s=%s for domain %s path %s\n", debugstr_w(cookie_name),
|
2014-07-14 15:21:38 +02:00
|
|
|
debugstr_w(value), debugstr_w(container->domain->domain),debugstr_w(container->path));
|
2007-11-14 13:15:16 +01:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
if (!expired) {
|
|
|
|
cookie_t *new_cookie;
|
|
|
|
|
|
|
|
new_cookie = alloc_cookie(cookie_name, value, expiry, create, cookie_flags);
|
|
|
|
if(!new_cookie) {
|
|
|
|
heap_free(data);
|
|
|
|
if (value != data) heap_free(value);
|
|
|
|
LeaveCriticalSection(&cookie_cs);
|
|
|
|
return COOKIE_STATE_UNKNOWN;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_cookie(container, new_cookie);
|
2009-02-17 17:28:46 +01:00
|
|
|
}
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(data);
|
|
|
|
if (value != data) heap_free(value);
|
2012-10-01 14:23:10 +02:00
|
|
|
|
2014-07-14 15:21:38 +02:00
|
|
|
if (!update_persistent || save_persistent_cookie(container))
|
2012-10-01 14:23:10 +02:00
|
|
|
{
|
|
|
|
LeaveCriticalSection(&cookie_cs);
|
2014-07-04 14:45:17 +02:00
|
|
|
return COOKIE_STATE_ACCEPT;
|
2012-10-01 14:23:10 +02:00
|
|
|
}
|
|
|
|
LeaveCriticalSection(&cookie_cs);
|
2014-07-04 14:45:17 +02:00
|
|
|
return COOKIE_STATE_UNKNOWN;
|
2007-11-14 13:15:16 +01:00
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2014-07-04 14:45:17 +02:00
|
|
|
* InternetSetCookieExW (WININET.@)
|
2003-06-21 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Sets cookie for the specified url
|
|
|
|
*/
|
2014-07-04 14:45:17 +02:00
|
|
|
DWORD WINAPI InternetSetCookieExW(LPCWSTR lpszUrl, LPCWSTR lpszCookieName,
|
|
|
|
LPCWSTR lpCookieData, DWORD flags, DWORD_PTR reserved)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2007-11-14 13:15:16 +01:00
|
|
|
BOOL ret;
|
2011-08-22 21:30:55 +02:00
|
|
|
WCHAR hostName[INTERNET_MAX_HOST_NAME_LENGTH], path[INTERNET_MAX_PATH_LENGTH];
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2014-07-04 14:45:17 +02:00
|
|
|
TRACE("(%s, %s, %s, %x, %lx)\n", debugstr_w(lpszUrl), debugstr_w(lpszCookieName),
|
|
|
|
debugstr_w(lpCookieData), flags, reserved);
|
|
|
|
|
2014-07-04 14:45:26 +02:00
|
|
|
if (flags & ~INTERNET_COOKIE_HTTPONLY)
|
2014-07-04 14:45:17 +02:00
|
|
|
FIXME("flags %x not supported\n", flags);
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2007-11-14 13:15:16 +01:00
|
|
|
if (!lpszUrl || !lpCookieData)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2006-06-02 12:49:09 +02:00
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
2014-07-04 14:45:17 +02:00
|
|
|
return COOKIE_STATE_UNKNOWN;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
2007-11-14 13:15:16 +01:00
|
|
|
|
2009-10-26 09:56:04 +01:00
|
|
|
hostName[0] = 0;
|
2007-11-14 13:15:16 +01:00
|
|
|
ret = COOKIE_crackUrlSimple(lpszUrl, hostName, sizeof(hostName)/sizeof(hostName[0]), path, sizeof(path)/sizeof(path[0]));
|
2014-07-04 14:45:17 +02:00
|
|
|
if (!ret || !hostName[0]) return COOKIE_STATE_UNKNOWN;
|
2007-11-14 13:15:16 +01:00
|
|
|
|
2003-06-21 01:26:56 +02:00
|
|
|
if (!lpszCookieName)
|
|
|
|
{
|
2007-11-14 13:15:16 +01:00
|
|
|
WCHAR *cookie, *data;
|
2014-07-04 14:45:17 +02:00
|
|
|
DWORD res;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
cookie = heap_strdupW(lpCookieData);
|
|
|
|
if (!cookie)
|
2007-11-14 13:15:16 +01:00
|
|
|
{
|
|
|
|
SetLastError(ERROR_OUTOFMEMORY);
|
2014-07-04 14:45:17 +02:00
|
|
|
return COOKIE_STATE_UNKNOWN;
|
2007-11-14 13:15:16 +01:00
|
|
|
}
|
2004-07-21 21:36:53 +02:00
|
|
|
|
2007-11-14 13:15:16 +01:00
|
|
|
/* some apps (or is it us??) try to add a cookie with no cookie name, but
|
|
|
|
* the cookie data in the form of name[=data].
|
|
|
|
*/
|
2009-07-19 18:09:10 +02:00
|
|
|
if (!(data = strchrW(cookie, '='))) data = cookie + strlenW(cookie);
|
2009-02-17 17:28:46 +01:00
|
|
|
else *data++ = 0;
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2014-07-04 14:45:26 +02:00
|
|
|
res = set_cookie(hostName, path, cookie, data, flags);
|
2003-06-21 01:26:56 +02:00
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free(cookie);
|
2014-07-04 14:45:17 +02:00
|
|
|
return res;
|
2007-11-14 13:15:16 +01:00
|
|
|
}
|
2014-07-04 14:45:26 +02:00
|
|
|
return set_cookie(hostName, path, lpszCookieName, lpCookieData, flags);
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
|
|
|
|
2014-07-04 14:45:17 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetCookieW (WININET.@)
|
|
|
|
*
|
|
|
|
* Sets a cookie for the specified URL.
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetSetCookieW(const WCHAR *url, const WCHAR *name, const WCHAR *data)
|
|
|
|
{
|
|
|
|
TRACE("(%s, %s, %s)\n", debugstr_w(url), debugstr_w(name), debugstr_w(data));
|
|
|
|
|
|
|
|
return InternetSetCookieExW(url, name, data, 0, 0) == COOKIE_STATE_ACCEPT;
|
|
|
|
}
|
2003-06-21 01:26:56 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2004-03-30 22:38:08 +02:00
|
|
|
* InternetSetCookieA (WININET.@)
|
2003-06-21 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Sets cookie for the specified url
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2004-03-30 22:38:08 +02:00
|
|
|
BOOL WINAPI InternetSetCookieA(LPCSTR lpszUrl, LPCSTR lpszCookieName,
|
|
|
|
LPCSTR lpCookieData)
|
2003-06-21 01:26:56 +02:00
|
|
|
{
|
2009-07-19 18:09:10 +02:00
|
|
|
LPWSTR data, url, name;
|
2004-03-30 22:38:08 +02:00
|
|
|
BOOL r;
|
|
|
|
|
|
|
|
TRACE("(%s,%s,%s)\n", debugstr_a(lpszUrl),
|
|
|
|
debugstr_a(lpszCookieName), debugstr_a(lpCookieData));
|
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
url = heap_strdupAtoW(lpszUrl);
|
|
|
|
name = heap_strdupAtoW(lpszCookieName);
|
|
|
|
data = heap_strdupAtoW(lpCookieData);
|
2004-03-30 22:38:08 +02:00
|
|
|
|
2009-07-19 18:09:10 +02:00
|
|
|
r = InternetSetCookieW( url, name, data );
|
2004-03-30 22:38:08 +02:00
|
|
|
|
2011-06-01 11:50:53 +02:00
|
|
|
heap_free( data );
|
|
|
|
heap_free( name );
|
|
|
|
heap_free( url );
|
2004-03-30 22:38:08 +02:00
|
|
|
return r;
|
2003-06-21 01:26:56 +02:00
|
|
|
}
|
2006-03-14 15:35:52 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetCookieExA (WININET.@)
|
|
|
|
*
|
|
|
|
* See InternetSetCookieExW.
|
|
|
|
*/
|
|
|
|
DWORD WINAPI InternetSetCookieExA( LPCSTR lpszURL, LPCSTR lpszCookieName, LPCSTR lpszCookieData,
|
|
|
|
DWORD dwFlags, DWORD_PTR dwReserved)
|
|
|
|
{
|
2014-07-04 14:45:01 +02:00
|
|
|
WCHAR *data, *url, *name;
|
|
|
|
DWORD r;
|
2008-05-09 15:16:05 +02:00
|
|
|
|
2014-07-04 14:45:01 +02:00
|
|
|
TRACE("(%s, %s, %s, %x, %lx)\n", debugstr_a(lpszURL), debugstr_a(lpszCookieName),
|
|
|
|
debugstr_a(lpszCookieData), dwFlags, dwReserved);
|
|
|
|
|
|
|
|
url = heap_strdupAtoW(lpszURL);
|
|
|
|
name = heap_strdupAtoW(lpszCookieName);
|
|
|
|
data = heap_strdupAtoW(lpszCookieData);
|
|
|
|
|
|
|
|
r = InternetSetCookieExW(url, name, data, dwFlags, dwReserved);
|
|
|
|
|
|
|
|
heap_free( data );
|
|
|
|
heap_free( name );
|
|
|
|
heap_free( url );
|
|
|
|
return r;
|
2006-03-14 15:35:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetClearAllPerSiteCookieDecisions (WININET.@)
|
|
|
|
*
|
|
|
|
* Clears all per-site decisions about cookies.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetClearAllPerSiteCookieDecisions( VOID )
|
|
|
|
{
|
|
|
|
FIXME("stub\n");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetEnumPerSiteCookieDecisionA (WININET.@)
|
|
|
|
*
|
|
|
|
* See InternetEnumPerSiteCookieDecisionW.
|
|
|
|
*/
|
2008-06-29 16:02:07 +02:00
|
|
|
BOOL WINAPI InternetEnumPerSiteCookieDecisionA( LPSTR pszSiteName, ULONG *pcSiteNameSize,
|
|
|
|
ULONG *pdwDecision, ULONG dwIndex )
|
2006-03-14 15:35:52 +01:00
|
|
|
{
|
2008-06-29 16:02:07 +02:00
|
|
|
FIXME("(%s, %p, %p, 0x%08x) stub\n",
|
2006-03-14 15:35:52 +01:00
|
|
|
debugstr_a(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetEnumPerSiteCookieDecisionW (WININET.@)
|
|
|
|
*
|
|
|
|
* Enumerates all per-site decisions about cookies.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* TRUE on success
|
|
|
|
* FALSE on failure
|
|
|
|
*
|
|
|
|
*/
|
2008-06-29 16:02:07 +02:00
|
|
|
BOOL WINAPI InternetEnumPerSiteCookieDecisionW( LPWSTR pszSiteName, ULONG *pcSiteNameSize,
|
|
|
|
ULONG *pdwDecision, ULONG dwIndex )
|
2006-03-14 15:35:52 +01:00
|
|
|
{
|
2008-06-29 16:02:07 +02:00
|
|
|
FIXME("(%s, %p, %p, 0x%08x) stub\n",
|
2006-03-14 15:35:52 +01:00
|
|
|
debugstr_w(pszSiteName), pcSiteNameSize, pdwDecision, dwIndex);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetPerSiteCookieDecisionA (WININET.@)
|
|
|
|
*/
|
2008-06-29 16:02:07 +02:00
|
|
|
BOOL WINAPI InternetGetPerSiteCookieDecisionA( LPCSTR pwchHostName, ULONG *pResult )
|
2006-03-14 15:35:52 +01:00
|
|
|
{
|
|
|
|
FIXME("(%s, %p) stub\n", debugstr_a(pwchHostName), pResult);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetGetPerSiteCookieDecisionW (WININET.@)
|
|
|
|
*/
|
2008-06-29 16:02:07 +02:00
|
|
|
BOOL WINAPI InternetGetPerSiteCookieDecisionW( LPCWSTR pwchHostName, ULONG *pResult )
|
2006-03-14 15:35:52 +01:00
|
|
|
{
|
|
|
|
FIXME("(%s, %p) stub\n", debugstr_w(pwchHostName), pResult);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetPerSiteCookieDecisionA (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetSetPerSiteCookieDecisionA( LPCSTR pchHostName, DWORD dwDecision )
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("(%s, 0x%08x) stub\n", debugstr_a(pchHostName), dwDecision);
|
2006-03-14 15:35:52 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* InternetSetPerSiteCookieDecisionW (WININET.@)
|
|
|
|
*/
|
|
|
|
BOOL WINAPI InternetSetPerSiteCookieDecisionW( LPCWSTR pchHostName, DWORD dwDecision )
|
|
|
|
{
|
2006-10-05 13:18:56 +02:00
|
|
|
FIXME("(%s, 0x%08x) stub\n", debugstr_w(pchHostName), dwDecision);
|
2006-03-14 15:35:52 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
2012-10-01 14:23:10 +02:00
|
|
|
|
|
|
|
void free_cookie(void)
|
|
|
|
{
|
|
|
|
DeleteCriticalSection(&cookie_cs);
|
|
|
|
}
|