mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:33:01 +00:00
[RPCRT4] Import Wine commit 01290cd by Colin and Christoph: Implement RpcBindingServerFromClient and populate NetworkAddr for each transport.
svn path=/trunk/; revision=73006
This commit is contained in:
parent
708359754c
commit
c0e27b85ab
2 changed files with 49 additions and 5 deletions
|
@ -1619,10 +1619,24 @@ RpcBindingInqAuthClientExW( RPC_BINDING_HANDLE ClientBinding, RPC_AUTHZ_HANDLE *
|
||||||
* RpcBindingServerFromClient (RPCRT4.@)
|
* RpcBindingServerFromClient (RPCRT4.@)
|
||||||
*/
|
*/
|
||||||
RPCRTAPI RPC_STATUS RPC_ENTRY
|
RPCRTAPI RPC_STATUS RPC_ENTRY
|
||||||
RpcBindingServerFromClient( RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE *ServerBinding )
|
RpcBindingServerFromClient(RPC_BINDING_HANDLE ClientBinding, RPC_BINDING_HANDLE* ServerBinding)
|
||||||
{
|
{
|
||||||
FIXME("%p %p: stub\n", ClientBinding, ServerBinding);
|
RpcBinding* bind = ClientBinding;
|
||||||
return RPC_S_INVALID_BINDING;
|
RpcBinding* NewBinding;
|
||||||
|
|
||||||
|
if (!bind)
|
||||||
|
bind = I_RpcGetCurrentCallHandle();
|
||||||
|
|
||||||
|
if (!bind->server)
|
||||||
|
return RPC_S_INVALID_BINDING;
|
||||||
|
|
||||||
|
RPCRT4_AllocBinding(&NewBinding, TRUE);
|
||||||
|
NewBinding->Protseq = RPCRT4_strdupA(bind->Protseq);
|
||||||
|
NewBinding->NetworkAddr = RPCRT4_strdupA(bind->NetworkAddr);
|
||||||
|
|
||||||
|
*ServerBinding = NewBinding;
|
||||||
|
|
||||||
|
return RPC_S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
|
@ -444,6 +444,7 @@ static void rpcrt4_conn_np_handoff(RpcConnection_np *old_npc, RpcConnection_np *
|
||||||
|
|
||||||
static RPC_STATUS rpcrt4_ncacn_np_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
|
static RPC_STATUS rpcrt4_ncacn_np_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
|
||||||
{
|
{
|
||||||
|
DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
|
||||||
RPC_STATUS status;
|
RPC_STATUS status;
|
||||||
LPSTR pname;
|
LPSTR pname;
|
||||||
static const char prefix[] = "\\\\.";
|
static const char prefix[] = "\\\\.";
|
||||||
|
@ -455,6 +456,16 @@ static RPC_STATUS rpcrt4_ncacn_np_handoff(RpcConnection *old_conn, RpcConnection
|
||||||
status = rpcrt4_conn_create_pipe(old_conn, pname);
|
status = rpcrt4_conn_create_pipe(old_conn, pname);
|
||||||
I_RpcFree(pname);
|
I_RpcFree(pname);
|
||||||
|
|
||||||
|
/* Store the local computer name as the NetworkAddr for ncacn_np as long as
|
||||||
|
* we don't support named pipes over the network. */
|
||||||
|
FIXME("Using local computer name as NetworkAddr\n");
|
||||||
|
new_conn->NetworkAddr = HeapAlloc(GetProcessHeap(), 0, len);
|
||||||
|
if (!GetComputerNameA(new_conn->NetworkAddr, &len))
|
||||||
|
{
|
||||||
|
ERR("Failed to retrieve the computer name, error %u\n", GetLastError());
|
||||||
|
return RPC_S_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,6 +498,7 @@ static RPC_STATUS rpcrt4_ncalrpc_np_is_server_listening(const char *endpoint)
|
||||||
|
|
||||||
static RPC_STATUS rpcrt4_ncalrpc_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
|
static RPC_STATUS rpcrt4_ncalrpc_handoff(RpcConnection *old_conn, RpcConnection *new_conn)
|
||||||
{
|
{
|
||||||
|
DWORD len = MAX_COMPUTERNAME_LENGTH + 1;
|
||||||
RPC_STATUS status;
|
RPC_STATUS status;
|
||||||
LPSTR pname;
|
LPSTR pname;
|
||||||
static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
|
static const char prefix[] = "\\\\.\\pipe\\lrpc\\";
|
||||||
|
@ -500,6 +512,14 @@ static RPC_STATUS rpcrt4_ncalrpc_handoff(RpcConnection *old_conn, RpcConnection
|
||||||
status = rpcrt4_conn_create_pipe(old_conn, pname);
|
status = rpcrt4_conn_create_pipe(old_conn, pname);
|
||||||
I_RpcFree(pname);
|
I_RpcFree(pname);
|
||||||
|
|
||||||
|
/* Store the local computer name as the NetworkAddr for ncalrpc. */
|
||||||
|
new_conn->NetworkAddr = HeapAlloc(GetProcessHeap(), 0, len);
|
||||||
|
if (!GetComputerNameA(new_conn->NetworkAddr, &len))
|
||||||
|
{
|
||||||
|
ERR("Failed to retrieve the computer name, error %u\n", GetLastError());
|
||||||
|
return RPC_S_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1549,10 +1569,20 @@ static RPC_STATUS rpcrt4_conn_tcp_handoff(RpcConnection *old_conn, RpcConnection
|
||||||
ERR("Failed to accept a TCP connection: error %d\n", ret);
|
ERR("Failed to accept a TCP connection: error %d\n", ret);
|
||||||
return RPC_S_OUT_OF_RESOURCES;
|
return RPC_S_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
nonblocking = 1;
|
nonblocking = 1;
|
||||||
ioctlsocket(ret, FIONBIO, &nonblocking);
|
ioctlsocket(ret, FIONBIO, &nonblocking);
|
||||||
client->sock = ret;
|
client->sock = ret;
|
||||||
TRACE("Accepted a new TCP connection\n");
|
|
||||||
|
client->common.NetworkAddr = HeapAlloc(GetProcessHeap(), 0, INET6_ADDRSTRLEN);
|
||||||
|
ret = getnameinfo((struct sockaddr*)&address, addrsize, client->common.NetworkAddr, INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST);
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
ERR("Failed to retrieve the IP address, error %d\n", ret);
|
||||||
|
return RPC_S_OUT_OF_RESOURCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACE("Accepted a new TCP connection from %s\n", client->common.NetworkAddr);
|
||||||
return RPC_S_OK;
|
return RPC_S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue