Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a958c27c
Commit
a958c27c
authored
Dec 18, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Dec 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cryptui: Validate OID in add purpose dialog.
parent
a0ae811e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
1 deletion
+91
-1
cryptui_En.rc
dlls/cryptui/cryptui_En.rc
+2
-0
cryptuires.h
dlls/cryptui/cryptuires.h
+2
-0
main.c
dlls/cryptui/main.c
+87
-1
No files found.
dlls/cryptui/cryptui_En.rc
View file @
a958c27c
...
...
@@ -59,6 +59,8 @@ STRINGTABLE DISCARDABLE
IDS_PROP_FRIENDLY_NAME "Friendly name"
IDS_PROP_DESCRIPTION "Description"
IDS_CERTIFICATE_PROPERTIES "Certificate Properties"
IDS_CERTIFICATE_PURPOSE_ERROR "Please enter an OID in the form 1.2.3.4"
IDS_CERTIFICATE_PURPOSE_EXISTS "The OID you entered already exists."
IDS_PURPOSE_SERVER_AUTH "Ensures the identify of a remote computer"
IDS_PURPOSE_CLIENT_AUTH "Proves your identity to a remote computer"
IDS_PURPOSE_CODE_SIGNING "Ensures software came from software publisher\nProtects software from alteration after publication"
...
...
dlls/cryptui/cryptuires.h
View file @
a958c27c
...
...
@@ -56,6 +56,8 @@
#define IDS_PROP_FRIENDLY_NAME 1036
#define IDS_PROP_DESCRIPTION 1037
#define IDS_CERTIFICATE_PROPERTIES 1038
#define IDS_CERTIFICATE_PURPOSE_ERROR 1039
#define IDS_CERTIFICATE_PURPOSE_EXISTS 1040
#define IDS_PURPOSE_SERVER_AUTH 1100
#define IDS_PURPOSE_CLIENT_AUTH 1101
...
...
dlls/cryptui/main.c
View file @
a958c27c
...
...
@@ -1593,6 +1593,72 @@ static void add_purpose(HWND hwnd, LPCSTR oid)
}
}
static
BOOL
is_valid_oid
(
LPCSTR
oid
)
{
BOOL
ret
;
if
(
oid
[
0
]
!=
'0'
&&
oid
[
0
]
!=
'1'
&&
oid
[
0
]
!=
'2'
)
ret
=
FALSE
;
else
if
(
oid
[
1
]
!=
'.'
)
ret
=
FALSE
;
else
if
(
!
oid
[
2
])
ret
=
FALSE
;
else
{
const
char
*
ptr
;
BOOL
expectNum
=
TRUE
;
for
(
ptr
=
oid
+
2
,
ret
=
TRUE
;
ret
&&
*
ptr
;
ptr
++
)
{
if
(
expectNum
)
{
if
(
!
isdigit
(
*
ptr
))
ret
=
FALSE
;
else
if
(
*
(
ptr
+
1
)
==
'.'
)
expectNum
=
FALSE
;
}
else
{
if
(
*
ptr
!=
'.'
)
ret
=
FALSE
;
else
if
(
!
(
*
(
ptr
+
1
)))
ret
=
FALSE
;
else
expectNum
=
TRUE
;
}
}
}
return
ret
;
}
static
BOOL
is_oid_in_list
(
HWND
hwnd
,
LPCSTR
oid
)
{
HWND
lv
=
GetDlgItem
(
hwnd
,
IDC_CERTIFICATE_USAGES
);
PCCRYPT_OID_INFO
oidInfo
=
CryptFindOIDInfo
(
CRYPT_OID_INFO_OID_KEY
,
(
void
*
)
oid
,
CRYPT_ENHKEY_USAGE_OID_GROUP_ID
);
BOOL
ret
=
FALSE
;
if
(
oidInfo
)
{
LVFINDINFOW
findInfo
;
findInfo
.
flags
=
LVFI_PARAM
;
findInfo
.
lParam
=
(
LPARAM
)
oidInfo
;
if
(
SendMessageW
(
lv
,
LVM_FINDITEMW
,
-
1
,
(
LPARAM
)
&
findInfo
)
!=
-
1
)
ret
=
TRUE
;
}
else
{
LVFINDINFOA
findInfo
;
findInfo
.
flags
=
LVFI_STRING
;
findInfo
.
psz
=
oid
;
if
(
SendMessageW
(
lv
,
LVM_FINDITEMA
,
-
1
,
(
LPARAM
)
&
findInfo
)
!=
-
1
)
ret
=
TRUE
;
}
return
ret
;
}
#define MAX_PURPOSE 255
static
LRESULT
CALLBACK
add_purpose_dlg_proc
(
HWND
hwnd
,
UINT
msg
,
...
...
@@ -1636,11 +1702,31 @@ static LRESULT CALLBACK add_purpose_dlg_proc(HWND hwnd, UINT msg,
EndDialog
(
hwnd
,
IDCANCEL
);
ret
=
TRUE
;
}
else
if
(
!
is_valid_oid
(
buf
))
{
WCHAR
title
[
MAX_STRING_LEN
],
error
[
MAX_STRING_LEN
];
LoadStringW
(
hInstance
,
IDS_CERTIFICATE_PURPOSE_ERROR
,
error
,
sizeof
(
error
)
/
sizeof
(
error
[
0
]));
LoadStringW
(
hInstance
,
IDS_CERTIFICATE_PROPERTIES
,
title
,
sizeof
(
title
)
/
sizeof
(
title
[
0
]));
MessageBoxW
(
hwnd
,
error
,
title
,
MB_ICONERROR
|
MB_OK
);
}
else
if
(
is_oid_in_list
(
(
HWND
)
GetWindowLongPtrW
(
hwnd
,
DWLP_USER
),
buf
))
{
WCHAR
title
[
MAX_STRING_LEN
],
error
[
MAX_STRING_LEN
];
LoadStringW
(
hInstance
,
IDS_CERTIFICATE_PURPOSE_EXISTS
,
error
,
sizeof
(
error
)
/
sizeof
(
error
[
0
]));
LoadStringW
(
hInstance
,
IDS_CERTIFICATE_PROPERTIES
,
title
,
sizeof
(
title
)
/
sizeof
(
title
[
0
]));
MessageBoxW
(
hwnd
,
error
,
title
,
MB_ICONEXCLAMATION
|
MB_OK
);
}
else
{
HWND
parent
=
(
HWND
)
GetWindowLongPtrW
(
hwnd
,
DWLP_USER
);
FIXME
(
"validate %s
\n
"
,
debugstr_a
(
buf
));
add_purpose
(
parent
,
buf
);
EndDialog
(
hwnd
,
wp
);
ret
=
TRUE
;
...
...
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