rpcrt4: Check for null endpoint in RpcServerUseProtseqEpExW

Nikolay Sivov bunglehead at gmail.com
Fri Feb 6 05:05:47 CST 2009


Rob Shearman wrote:
> 2009/2/5 Nikolay Sivov <bunglehead at gmail.com>:
>   
>> Changelog:
>>    - Check for null endpoint in RpcServerUseProtseqEpExW.
>>      Installed IE8 RC1 crashes on this call, parameter set is specified in
>>      test case.
>>
>> >From 89f889b2c7a754302b599884577b4eba22b3d235 Mon Sep 17 00:00:00 2001
>> From: Nikolay Sivov <bunglehead at gmail.com>
>> Date: Thu, 5 Feb 2009 22:03:48 +0300
>> Subject: Check for null endpoint in RpcServerUseProtseqEpExW
>>
>> ---
>>  dlls/rpcrt4/rpc_server.c |    6 ++++--
>>  dlls/rpcrt4/tests/rpc.c  |   15 +++++++++++++++
>>  2 files changed, 19 insertions(+), 2 deletions(-)
>>
>> diff --git a/dlls/rpcrt4/rpc_server.c b/dlls/rpcrt4/rpc_server.c
>> index b6e058a..e9bed42 100644
>> --- a/dlls/rpcrt4/rpc_server.c
>> +++ b/dlls/rpcrt4/rpc_server.c
>> @@ -775,8 +775,10 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( RPC_WSTR Protseq, UINT MaxCalls, RPC
>>     return status;
>>
>>   EndpointA = RPCRT4_strdupWtoA(Endpoint);
>> -  status = RPCRT4_use_protseq(ps, EndpointA);
>> -  RPCRT4_strfree(EndpointA);
>> +  if (EndpointA) {
>> +      status = RPCRT4_use_protseq(ps, EndpointA);
>> +      RPCRT4_strfree(EndpointA);
>> +  }
>>     
>
> This isn't correct, I'm afraid. The protseq open function should
> generate an endpoint name to use. For example, the ncacn_ip_tcp code
> should select a random available TCP port.
>
>   
>>   return status;
>>  }
>>
>> diff --git a/dlls/rpcrt4/tests/rpc.c b/dlls/rpcrt4/tests/rpc.c
>> index bf538e4..b815acc 100644
>> --- a/dlls/rpcrt4/tests/rpc.c
>> +++ b/dlls/rpcrt4/tests/rpc.c
>> @@ -830,6 +830,20 @@ static void test_UuidCreate(void)
>>     }
>>  }
>>
>> +static void test_RpcServerUseProtseqEpEx(void)
>> +{
>> +    RPC_STATUS status;
>> +    RPC_POLICY policy;
>> +    static WCHAR protW[] = {'n','c','a','l','r','p','c',0};
>> +
>> +    policy.Length        = sizeof( policy );
>> +    policy.EndpointFlags = 0;
>> +    policy.NICFlags      = 0;
>> +
>> +    status = RpcServerUseProtseqEpExW(protW, 10, NULL, NULL, &policy);
>> +    ok(status == RPC_S_OK, "Expected RPC_S_OK, got %d\n", status);
>> +}
>>     
>
> This is a good start, but you should also test the bindings created as
> a result of doing this and then you will probably discover that the
> fix to RpcServerUseProtseqEpExW isn't quite correct.
>
>
>   
>>  START_TEST( rpc )
>>  {
>>     static unsigned char ncacn_np[] = "ncacn_np";
>> @@ -849,4 +863,5 @@ START_TEST( rpc )
>>     test_endpoint_mapper(ncalrpc, NULL, lrpc_endpoint);
>>     test_RpcStringBindingFromBinding();
>>     test_UuidCreate();
>> +    test_RpcServerUseProtseqEpEx();
>>  }
>>     
>
>   
Ok, I'll try to find out.
Rob, could you suggest a good documentation source on RPC? I'm not 
experienced in it.
Thanks.



More information about the wine-devel mailing list