Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Zsolt Vadász
wine
Commits
e0dfbd6a
Commit
e0dfbd6a
authored
13 years ago
by
Thomas Mullaly
Committed by
Alexandre Julliard
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
urlmon: Improved GetSecurityId's support for file url's.
parent
98488722
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/urlmon/sec_mgr.c
+66
-53
66 additions, 53 deletions
dlls/urlmon/sec_mgr.c
dlls/urlmon/tests/sec_mgr.c
+5
-1
5 additions, 1 deletion
dlls/urlmon/tests/sec_mgr.c
with
71 additions
and
54 deletions
dlls/urlmon/sec_mgr.c
+
66
−
53
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
);
}
...
...
This diff is collapsed.
Click to expand it.
dlls/urlmon/tests/sec_mgr.c
+
5
−
1
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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment