webservices: Validate the handle in channel functions.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c06f2d4f5b
commit
41da198a6e
|
@ -188,6 +188,7 @@ HRESULT WINAPI WsGetChannelProperty( WS_CHANNEL *handle, WS_CHANNEL_PROPERTY_ID
|
|||
TRACE( "%p %u %p %u %p\n", handle, id, buf, size, error );
|
||||
if (error) FIXME( "ignoring error parameter\n" );
|
||||
|
||||
if (!handle) return E_INVALIDARG;
|
||||
return prop_get( channel->prop, channel->prop_count, id, buf, size );
|
||||
}
|
||||
|
||||
|
@ -202,6 +203,7 @@ HRESULT WINAPI WsSetChannelProperty( WS_CHANNEL *handle, WS_CHANNEL_PROPERTY_ID
|
|||
TRACE( "%p %u %p %u\n", handle, id, value, size );
|
||||
if (error) FIXME( "ignoring error parameter\n" );
|
||||
|
||||
if (!handle) return E_INVALIDARG;
|
||||
return prop_set( channel->prop, channel->prop_count, id, value, size );
|
||||
}
|
||||
|
||||
|
@ -223,7 +225,7 @@ HRESULT WINAPI WsOpenChannel( WS_CHANNEL *handle, const WS_ENDPOINT_ADDRESS *end
|
|||
if (error) FIXME( "ignoring error parameter\n" );
|
||||
if (ctx) FIXME( "ignoring ctx parameter\n" );
|
||||
|
||||
if (!endpoint) return E_INVALIDARG;
|
||||
if (!handle || !endpoint) return E_INVALIDARG;
|
||||
if (channel->state != WS_CHANNEL_STATE_CREATED) return WS_E_INVALID_OPERATION;
|
||||
|
||||
return open_channel( channel, endpoint );
|
||||
|
@ -246,5 +248,6 @@ HRESULT WINAPI WsCloseChannel( WS_CHANNEL *handle, const WS_ASYNC_CONTEXT *ctx,
|
|||
if (error) FIXME( "ignoring error parameter\n" );
|
||||
if (ctx) FIXME( "ignoring ctx parameter\n" );
|
||||
|
||||
if (!handle) return E_INVALIDARG;
|
||||
return close_channel( channel );
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ static void test_WsCreateChannel(void)
|
|||
WS_CHANNEL_STATE state;
|
||||
ULONG size, value;
|
||||
|
||||
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, NULL, NULL ) ;
|
||||
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, NULL, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
channel = NULL;
|
||||
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, &channel, NULL ) ;
|
||||
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, &channel, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( channel != NULL, "channel not set\n" );
|
||||
|
||||
|
@ -64,14 +64,14 @@ static void test_WsOpenChannel(void)
|
|||
WS_CHANNEL *channel;
|
||||
WS_ENDPOINT_ADDRESS addr;
|
||||
|
||||
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, &channel, NULL ) ;
|
||||
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, &channel, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
hr = WsCloseChannel( channel, NULL, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
WsFreeChannel( channel );
|
||||
|
||||
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, &channel, NULL ) ;
|
||||
hr = WsCreateChannel( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, 0, NULL, &channel, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
hr = WsOpenChannel( channel, NULL, NULL, NULL );
|
||||
|
@ -82,6 +82,9 @@ static void test_WsOpenChannel(void)
|
|||
addr.headers = NULL;
|
||||
addr.extensions = NULL;
|
||||
addr.identity = NULL;
|
||||
hr = WsOpenChannel( NULL, &addr, NULL, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
hr = WsOpenChannel( channel, &addr, NULL, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
|
@ -93,6 +96,10 @@ static void test_WsOpenChannel(void)
|
|||
|
||||
hr = WsCloseChannel( channel, NULL, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
hr = WsCloseChannel( NULL, NULL, NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
WsFreeChannel( channel );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue