Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e0dfbd6a
Commit
e0dfbd6a
authored
Aug 31, 2011
by
Thomas Mullaly
Committed by
Alexandre Julliard
Sep 05, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
urlmon: Improved GetSecurityId's support for file url's.
parent
98488722
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
54 deletions
+71
-54
sec_mgr.c
dlls/urlmon/sec_mgr.c
+66
-53
sec_mgr.c
dlls/urlmon/tests/sec_mgr.c
+5
-1
No files found.
dlls/urlmon/sec_mgr.c
View file @
e0dfbd6a
...
...
@@ -652,6 +652,69 @@ static HRESULT get_action_policy(DWORD zone, DWORD action, BYTE *policy, DWORD s
return
hres
;
}
static
HRESULT
get_security_id
(
LPCWSTR
url
,
BYTE
*
secid
,
DWORD
*
secid_len
)
{
LPWSTR
secur_url
,
ptr
,
ptr2
;
DWORD
zone
,
len
;
HRESULT
hres
;
static
const
WCHAR
wszFile
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
};
hres
=
map_url_to_zone
(
url
,
&
zone
,
&
secur_url
);
if
(
FAILED
(
hres
))
return
hres
==
0x80041001
?
E_INVALIDARG
:
hres
;
/* file protocol is a special case */
if
(
strlenW
(
secur_url
)
>=
sizeof
(
wszFile
)
/
sizeof
(
WCHAR
)
&&
!
memcmp
(
secur_url
,
wszFile
,
sizeof
(
wszFile
)))
{
WCHAR
path
[
MAX_PATH
];
len
=
sizeof
(
path
)
/
sizeof
(
WCHAR
);
hres
=
CoInternetParseUrl
(
secur_url
,
PARSE_PATH_FROM_URL
,
0
,
path
,
len
,
&
len
,
0
);
if
(
hres
==
S_OK
&&
!
PathIsNetworkPathW
(
path
))
{
static
const
BYTE
secidFile
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
};
CoTaskMemFree
(
secur_url
);
if
(
*
secid_len
<
sizeof
(
secidFile
)
+
sizeof
(
zone
))
return
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
);
memcpy
(
secid
,
secidFile
,
sizeof
(
secidFile
));
*
(
DWORD
*
)(
secid
+
sizeof
(
secidFile
))
=
zone
;
*
secid_len
=
sizeof
(
secidFile
)
+
sizeof
(
zone
);
return
S_OK
;
}
}
ptr
=
strchrW
(
secur_url
,
':'
);
ptr2
=
++
ptr
;
while
(
*
ptr2
==
'/'
)
ptr2
++
;
if
(
ptr2
!=
ptr
)
memmove
(
ptr
,
ptr2
,
(
strlenW
(
ptr2
)
+
1
)
*
sizeof
(
WCHAR
));
ptr
=
strchrW
(
ptr
,
'/'
);
if
(
ptr
)
*
ptr
=
0
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
secur_url
,
-
1
,
NULL
,
0
,
NULL
,
NULL
)
-
1
;
if
(
len
+
sizeof
(
DWORD
)
>
*
secid_len
)
{
CoTaskMemFree
(
secur_url
);
return
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
);
}
WideCharToMultiByte
(
CP_ACP
,
0
,
secur_url
,
-
1
,
(
LPSTR
)
secid
,
len
,
NULL
,
NULL
);
CoTaskMemFree
(
secur_url
);
*
(
DWORD
*
)(
secid
+
len
)
=
zone
;
*
secid_len
=
len
+
sizeof
(
DWORD
);
return
S_OK
;
}
/***********************************************************************
* InternetSecurityManager implementation
*
...
...
@@ -817,16 +880,13 @@ static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManagerEx2 *
LPCWSTR
pwszUrl
,
BYTE
*
pbSecurityId
,
DWORD
*
pcbSecurityId
,
DWORD_PTR
dwReserved
)
{
SecManagerImpl
*
This
=
impl_from_IInternetSecurityManagerEx2
(
iface
);
LPWSTR
url
,
ptr
,
ptr2
;
DWORD
zone
,
len
;
HRESULT
hres
;
static
const
WCHAR
wszFile
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
};
TRACE
(
"(%p)->(%s %p %p %08lx)
\n
"
,
iface
,
debugstr_w
(
pwszUrl
),
pbSecurityId
,
pcbSecurityId
,
dwReserved
);
if
(
This
->
custom_manager
)
{
HRESULT
hres
;
hres
=
IInternetSecurityManager_GetSecurityId
(
This
->
custom_manager
,
pwszUrl
,
pbSecurityId
,
pcbSecurityId
,
dwReserved
);
if
(
hres
!=
INET_E_DEFAULT_ACTION
)
...
...
@@ -839,54 +899,7 @@ static HRESULT WINAPI SecManagerImpl_GetSecurityId(IInternetSecurityManagerEx2 *
if
(
dwReserved
)
FIXME
(
"dwReserved is not supported
\n
"
);
hres
=
map_url_to_zone
(
pwszUrl
,
&
zone
,
&
url
);
if
(
FAILED
(
hres
))
return
hres
==
0x80041001
?
E_INVALIDARG
:
hres
;
/* file protocol is a special case */
if
(
strlenW
(
url
)
>=
sizeof
(
wszFile
)
/
sizeof
(
WCHAR
)
&&
!
memcmp
(
url
,
wszFile
,
sizeof
(
wszFile
))
&&
strchrW
(
url
,
'\\'
))
{
static
const
BYTE
secidFile
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
};
CoTaskMemFree
(
url
);
if
(
*
pcbSecurityId
<
sizeof
(
secidFile
)
+
sizeof
(
zone
))
return
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
);
memcpy
(
pbSecurityId
,
secidFile
,
sizeof
(
secidFile
));
*
(
DWORD
*
)(
pbSecurityId
+
sizeof
(
secidFile
))
=
zone
;
*
pcbSecurityId
=
sizeof
(
secidFile
)
+
sizeof
(
zone
);
return
S_OK
;
}
ptr
=
strchrW
(
url
,
':'
);
ptr2
=
++
ptr
;
while
(
*
ptr2
==
'/'
)
ptr2
++
;
if
(
ptr2
!=
ptr
)
memmove
(
ptr
,
ptr2
,
(
strlenW
(
ptr2
)
+
1
)
*
sizeof
(
WCHAR
));
ptr
=
strchrW
(
ptr
,
'/'
);
if
(
ptr
)
*
ptr
=
0
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
url
,
-
1
,
NULL
,
0
,
NULL
,
NULL
)
-
1
;
if
(
len
+
sizeof
(
DWORD
)
>
*
pcbSecurityId
)
{
CoTaskMemFree
(
url
);
return
HRESULT_FROM_WIN32
(
ERROR_INSUFFICIENT_BUFFER
);
}
WideCharToMultiByte
(
CP_ACP
,
0
,
url
,
-
1
,
(
LPSTR
)
pbSecurityId
,
len
,
NULL
,
NULL
);
CoTaskMemFree
(
url
);
*
(
DWORD
*
)(
pbSecurityId
+
len
)
=
zone
;
*
pcbSecurityId
=
len
+
sizeof
(
DWORD
);
return
S_OK
;
return
get_security_id
(
pwszUrl
,
pbSecurityId
,
pcbSecurityId
);
}
...
...
dlls/urlmon/tests/sec_mgr.c
View file @
e0dfbd6a
...
...
@@ -94,6 +94,8 @@ static const WCHAR url9[] = {'h','t','t','p',':','/','/','w','w','w','.','z','o'
'.'
,
'w'
,
'i'
,
'n'
,
'e'
,
't'
,
'e'
,
's'
,
't'
,
'/'
,
's'
,
'i'
,
't'
,
'e'
,
'/'
,
'a'
,
'b'
,
'o'
,
'u'
,
't'
,
0
};
static
const
WCHAR
url10
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
'/'
,
'/'
,
's'
,
'o'
,
'm'
,
'e'
,
'%'
,
'2'
,
'0'
,
'f'
,
'i'
,
'l'
,
'e'
,
'.'
,
'j'
,
'p'
,
'g'
,
0
};
static
const
WCHAR
url11
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
'/'
,
'/'
,
'c'
,
':'
,
'/'
,
'I'
,
'n'
,
'd'
,
'e'
,
'x'
,
'.'
,
'h'
,
't'
,
'm'
,
0
};
static
const
WCHAR
url12
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
'/'
,
'/'
,
'/'
,
'c'
,
':'
,
'/'
,
'I'
,
'n'
,
'd'
,
'e'
,
'x'
,
'.'
,
'h'
,
't'
,
'm'
,
0
};
static
const
WCHAR
url4e
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
':'
,
's'
,
'o'
,
'm'
,
'e'
,
' '
,
'f'
,
'i'
,
'l'
,
'e'
,
'.'
,
'j'
,
'p'
,
'g'
,
0
};
...
...
@@ -140,7 +142,9 @@ static struct secmgr_test {
{
url3
,
0
,
S_OK
,
sizeof
(
secid1
),
secid1
,
S_OK
},
{
url5
,
3
,
S_OK
,
sizeof
(
secid5
),
secid5
,
S_OK
},
{
url6
,
3
,
S_OK
,
sizeof
(
secid6
),
secid6
,
S_OK
},
{
url7
,
3
,
S_OK
,
sizeof
(
secid7
),
secid7
,
S_OK
}
{
url7
,
3
,
S_OK
,
sizeof
(
secid7
),
secid7
,
S_OK
},
{
url11
,
0
,
S_OK
,
sizeof
(
secid1
),
secid1
,
S_OK
},
{
url12
,
0
,
S_OK
,
sizeof
(
secid1
),
secid1
,
S_OK
}
};
static
int
strcmp_w
(
const
WCHAR
*
str1
,
const
WCHAR
*
str2
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment