- Take NetworkAddr into account when a named pipe client is opened.
- Return RPC_S_SERVER_UNAVAILABLE when an attempt to create a named pipe client fails with an ERROR_BAD_NETPATH error.
This fixes the first test failure in the advapi32 service winetest.

svn path=/trunk/; revision=53630
This commit is contained in:
Eric Kohl 2011-09-07 20:11:19 +00:00
parent d78423aadc
commit 13f41d74b9

View file

@ -224,6 +224,9 @@ static RPC_STATUS rpcrt4_conn_open_pipe(RpcConnection *Connection, LPCSTR pname,
if (err == ERROR_PIPE_BUSY) {
TRACE("connection failed, error=%x\n", err);
return RPC_S_SERVER_TOO_BUSY;
} else if (err == ERROR_BAD_NETPATH) {
TRACE("connection failed, error=%x\n", err);
return RPC_S_SERVER_UNAVAILABLE;
}
if (!wait || !WaitNamedPipeA(pname, NMPWAIT_WAIT_FOREVER)) {
err = GetLastError();
@ -305,17 +308,31 @@ static RPC_STATUS rpcrt4_protseq_ncalrpc_open_endpoint(RpcServerProtseq* protseq
static RPC_STATUS rpcrt4_ncacn_np_open(RpcConnection* Connection)
{
RpcConnection_np *npc = (RpcConnection_np *) Connection;
static const char prefix[] = "\\\\.";
static const char prefix[] = "\\\\";
static const char local[] =".";
RPC_STATUS r;
LPSTR pname;
INT size;
/* already connected? */
if (npc->pipe)
return RPC_S_OK;
/* protseq=ncacn_np: named pipes */
pname = I_RpcAllocate(strlen(prefix) + strlen(Connection->Endpoint) + 1);
strcat(strcpy(pname, prefix), Connection->Endpoint);
size = strlen(prefix);
if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
size += strlen(local);
else
size += strlen(Connection->NetworkAddr);
size += strlen(Connection->Endpoint) + 1;
pname = I_RpcAllocate(size);
strcpy(pname, prefix);
if (Connection->NetworkAddr == NULL || strlen(Connection->NetworkAddr) == 0)
strcat(pname, local);
else
strcat(pname, Connection->NetworkAddr);
strcat(pname, Connection->Endpoint);
r = rpcrt4_conn_open_pipe(Connection, pname, TRUE);
I_RpcFree(pname);