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
dfd6cb97
Commit
dfd6cb97
authored
Aug 03, 2022
by
Shaun Ren
Committed by
Alexandre Julliard
Aug 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Detect when a message contains a fault in read_envelope_start.
Signed-off-by:
Shaun Ren
<
sren@codeweavers.com
>
parent
42980ed2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
2 deletions
+68
-2
msg.c
dlls/webservices/msg.c
+33
-1
msg.c
dlls/webservices/tests/msg.c
+20
-1
webservices.h
include/webservices.h
+15
-0
No files found.
dlls/webservices/msg.c
View file @
dfd6cb97
...
...
@@ -42,6 +42,10 @@ static const struct prop_desc msg_props[] =
{
sizeof
(
WS_XML_READER
*
),
TRUE
},
/* WS_MESSAGE_PROPERTY_BODY_READER */
{
sizeof
(
WS_XML_WRITER
*
),
TRUE
},
/* WS_MESSAGE_PROPERTY_BODY_WRITER */
{
sizeof
(
BOOL
),
TRUE
},
/* WS_MESSAGE_PROPERTY_IS_ADDRESSED */
{
sizeof
(
WS_HEAP_PROPERTIES
),
TRUE
},
/* WS_MESSAGE_PROPERTY_HEAP_PROPERTIES */
{
sizeof
(
WS_XML_READER_PROPERTIES
),
TRUE
},
/* WS_MESSAGE_PROPERTY_XML_READER_PROPERTIES */
{
sizeof
(
WS_XML_WRITER_PROPERTIES
),
TRUE
},
/* WS_MESSAGE_PROPERTY_XML_WRITER_PROPERTIES */
{
sizeof
(
BOOL
),
FALSE
},
/* WS_MESSAGE_PROPERTY_IS_FAULT */
};
struct
header
...
...
@@ -122,6 +126,7 @@ static void free_header( struct header *header )
static
void
reset_msg
(
struct
msg
*
msg
)
{
BOOL
isfault
=
FALSE
;
ULONG
i
;
msg
->
state
=
WS_MESSAGE_STATE_EMPTY
;
...
...
@@ -150,6 +155,8 @@ static void reset_msg( struct msg *msg )
memset
(
&
msg
->
ctx_send
,
0
,
sizeof
(
msg
->
ctx_send
)
);
memset
(
&
msg
->
ctx_receive
,
0
,
sizeof
(
msg
->
ctx_receive
)
);
prop_set
(
msg
->
prop
,
msg
->
prop_count
,
WS_MESSAGE_PROPERTY_IS_FAULT
,
&
isfault
,
sizeof
(
isfault
)
);
}
static
void
free_msg
(
struct
msg
*
msg
)
...
...
@@ -375,6 +382,13 @@ HRESULT WINAPI WsGetMessageProperty( WS_MESSAGE *handle, WS_MESSAGE_PROPERTY_ID
else
*
(
BOOL
*
)
buf
=
msg
->
is_addressed
;
break
;
case
WS_MESSAGE_PROPERTY_HEAP_PROPERTIES
:
case
WS_MESSAGE_PROPERTY_XML_READER_PROPERTIES
:
case
WS_MESSAGE_PROPERTY_XML_WRITER_PROPERTIES
:
FIXME
(
"property %u not supported
\n
"
,
id
);
hr
=
E_NOTIMPL
;
break
;
default:
hr
=
prop_get
(
msg
->
prop
,
msg
->
prop_count
,
id
,
buf
,
size
);
}
...
...
@@ -877,6 +891,18 @@ static BOOL match_current_element( WS_XML_READER *reader, const WS_XML_STRING *l
return
WsXmlStringEquals
(
elem
->
localName
,
localname
,
NULL
)
==
S_OK
;
}
static
BOOL
match_current_element_with_ns
(
WS_XML_READER
*
reader
,
const
WS_XML_STRING
*
localname
,
const
WS_XML_STRING
*
ns
)
{
const
WS_XML_NODE
*
node
;
const
WS_XML_ELEMENT_NODE
*
elem
;
if
(
WsGetReaderNode
(
reader
,
&
node
,
NULL
)
!=
S_OK
)
return
FALSE
;
if
(
node
->
nodeType
!=
WS_XML_NODE_TYPE_ELEMENT
)
return
FALSE
;
elem
=
(
const
WS_XML_ELEMENT_NODE
*
)
node
;
return
WsXmlStringEquals
(
elem
->
localName
,
localname
,
NULL
)
==
S_OK
&&
WsXmlStringEquals
(
elem
->
ns
,
ns
,
NULL
)
==
S_OK
;
}
static
HRESULT
read_message_id
(
WS_XML_READER
*
reader
,
GUID
*
ret
)
{
const
WS_XML_NODE
*
node
;
...
...
@@ -914,6 +940,9 @@ static HRESULT read_envelope_start( struct msg *msg, WS_XML_READER *reader )
{
static
const
WS_XML_STRING
envelope
=
{
8
,
(
BYTE
*
)
"Envelope"
},
body
=
{
4
,
(
BYTE
*
)
"Body"
};
static
const
WS_XML_STRING
header
=
{
6
,
(
BYTE
*
)
"Header"
},
msgid
=
{
9
,
(
BYTE
*
)
"MessageID"
};
static
const
WS_XML_STRING
fault
=
{
5
,
(
BYTE
*
)
"Fault"
};
const
WS_XML_STRING
*
ns_env
=
get_env_namespace
(
msg
->
version_env
);
BOOL
isfault
;
HRESULT
hr
;
if
((
hr
=
WsReadNode
(
reader
,
NULL
))
!=
S_OK
)
return
hr
;
...
...
@@ -930,7 +959,10 @@ static HRESULT read_envelope_start( struct msg *msg, WS_XML_READER *reader )
}
}
if
(
!
match_current_element
(
reader
,
&
body
))
return
WS_E_INVALID_FORMAT
;
return
WsReadNode
(
reader
,
NULL
);
if
((
hr
=
WsReadNode
(
reader
,
NULL
))
!=
S_OK
)
return
hr
;
isfault
=
match_current_element_with_ns
(
reader
,
&
fault
,
ns_env
);
return
prop_set
(
msg
->
prop
,
msg
->
prop_count
,
WS_MESSAGE_PROPERTY_IS_FAULT
,
&
isfault
,
sizeof
(
isfault
)
);
}
/**************************************************************************
...
...
dlls/webservices/tests/msg.c
View file @
dfd6cb97
...
...
@@ -1071,10 +1071,14 @@ static void test_WsReadEnvelopeStart(void)
{
static
const
char
xml
[]
=
"<s:Envelope xmlns:s=
\"
http://schemas.xmlsoap.org/soap/envelope/
\"
><s:Body/></s:Envelope>"
;
WS_MESSAGE
*
msg
,
*
msg2
;
static
const
char
faultxml
[]
=
"<s:Envelope xmlns:s=
\"
http://schemas.xmlsoap.org/soap/envelope/
\"
><s:Body>"
"<s:Fault/></s:Body></s:Envelope>"
;
WS_MESSAGE
*
msg
,
*
msg2
,
*
msg3
;
WS_XML_READER
*
reader
;
WS_MESSAGE_STATE
state
;
const
WS_XML_NODE
*
node
;
BOOL
isfault
;
HRESULT
hr
;
hr
=
WsReadEnvelopeStart
(
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
...
...
@@ -1127,8 +1131,23 @@ static void test_WsReadEnvelopeStart(void)
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
node
->
nodeType
==
WS_XML_NODE_TYPE_EOF
,
"got %u
\n
"
,
node
->
nodeType
);
hr
=
WsCreateMessage
(
WS_ENVELOPE_VERSION_SOAP_1_1
,
WS_ADDRESSING_VERSION_0_9
,
NULL
,
0
,
&
msg3
,
NULL
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
hr
=
set_input
(
reader
,
faultxml
,
strlen
(
faultxml
)
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
hr
=
WsReadEnvelopeStart
(
msg3
,
reader
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
isfault
=
FALSE
;
hr
=
WsGetMessageProperty
(
msg3
,
WS_MESSAGE_PROPERTY_IS_FAULT
,
&
isfault
,
sizeof
(
isfault
),
NULL
);
ok
(
hr
==
S_OK
,
"got %#lx
\n
"
,
hr
);
ok
(
isfault
,
"isfault == FALSE
\n
"
);
WsFreeMessage
(
msg
);
WsFreeMessage
(
msg2
);
WsFreeMessage
(
msg3
);
WsFreeReader
(
reader
);
}
...
...
include/webservices.h
View file @
dfd6cb97
...
...
@@ -113,6 +113,11 @@ typedef struct _WS_HEAP_PROPERTY {
ULONG
valueSize
;
}
WS_HEAP_PROPERTY
;
typedef
struct
_WS_HEAP_PROPERTIES
{
WS_HEAP_PROPERTY
*
properties
;
ULONG
propertyCount
;
}
WS_HEAP_PROPERTIES
;
typedef
ULONG
WS_XML_BUFFER_PROPERTY_ID
;
typedef
struct
_WS_XML_BUFFER_PROPERTY
{
...
...
@@ -145,6 +150,11 @@ typedef struct _WS_XML_READER_PROPERTY {
ULONG
valueSize
;
}
WS_XML_READER_PROPERTY
;
typedef
struct
_WS_XML_READER_PROPERTIES
{
WS_XML_READER_PROPERTY
*
properties
;
ULONG
propertyCount
;
}
WS_XML_READER_PROPERTIES
;
typedef
enum
{
WS_XML_WRITER_PROPERTY_MAX_DEPTH
,
WS_XML_WRITER_PROPERTY_ALLOW_FRAGMENT
,
...
...
@@ -173,6 +183,11 @@ typedef struct _WS_XML_WRITER_PROPERTY {
ULONG
valueSize
;
}
WS_XML_WRITER_PROPERTY
;
typedef
struct
_WS_XML_WRITER_PROPERTIES
{
WS_XML_WRITER_PROPERTY
*
properties
;
ULONG
propertyCount
;
}
WS_XML_WRITER_PROPERTIES
;
typedef
struct
_WS_BYTES
{
ULONG
length
;
BYTE
*
bytes
;
...
...
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