DWORD DsrRpcStartServer( void ) { PCSTR pszDescription = "Directory Services Setup"; ENDPOINT EndPoints[] = { { "ncacn_np", "\\\\pipe\\\\lsass" }, { NULL, NULL }, { NULL, NULL }, }; DWORD dwError = 0; BOOLEAN bRegisterTcpIp = FALSE; dwError = DsrSrvConfigShouldRegisterTcpIp(&bRegisterTcpIp); BAIL_ON_LSA_ERROR(dwError); if (bRegisterTcpIp) { EndPoints[1].pszProtocol = "ncacn_ip_tcp"; } dwError = RpcSvcBindRpcInterface(&gpDsrSrvBinding, dssetup_v0_0_s_ifspec, EndPoints, pszDescription); BAIL_ON_LSA_ERROR(dwError); error: return dwError; }
DWORD WkssRpcStartServer( void ) { PCSTR pszDescription = "Workstation Service"; ENDPOINT EndPoints[] = { { "ncacn_np", "\\\\pipe\\\\wkssvc" }, { "ncacn_np", "\\\\pipe\\\\lsass" }, { "ncalrpc", NULL }, /* endpoint is fetched from config parameter */ { NULL, NULL }, { NULL, NULL } }; DWORD dwError = 0; DWORD i = 0; PSTR pszLpcSocketPath = NULL; BOOLEAN bRegisterTcpIp = FALSE; dwError = WkssSrvConfigGetLpcSocketPath(&pszLpcSocketPath); BAIL_ON_LSA_ERROR(dwError); while (EndPoints[i].pszProtocol) { if (strcmp(EndPoints[i].pszProtocol, "ncalrpc") == 0 && pszLpcSocketPath) { EndPoints[i].pszEndpoint = pszLpcSocketPath; } i++; } dwError = WkssSrvConfigShouldRegisterTcpIp(&bRegisterTcpIp); BAIL_ON_LSA_ERROR(dwError); if (bRegisterTcpIp) { EndPoints[i++].pszProtocol = "ncacn_ip_tcp"; } dwError = RpcSvcBindRpcInterface(&gpWkssSrvBinding, wkssvc_v1_0_s_ifspec, EndPoints, pszDescription); BAIL_ON_LSA_ERROR(dwError); error: LW_SAFE_FREE_STRING(pszLpcSocketPath); return dwError; }
DWORD SamrRpcStartServer( void ) { PCSTR pszDescription = "Security Accounts Manager"; ENDPOINT EndPoints[] = { { "ncalrpc", NULL }, /* endpoint is fetched from config parameter */ { NULL, NULL }, { NULL, NULL } }; DWORD dwError = 0; DWORD i = 0; PSTR pszLpcSocketPath = NULL; BOOLEAN bRegisterTcpIp = FALSE; dwError = SamrSrvConfigGetLpcSocketPath(&pszLpcSocketPath); BAIL_ON_LSA_ERROR(dwError); while (EndPoints[i].pszProtocol) { if (strcmp(EndPoints[i].pszProtocol, "ncalrpc") == 0 && pszLpcSocketPath) { EndPoints[i].pszEndpoint = pszLpcSocketPath; } i++; } dwError = SamrSrvConfigShouldRegisterTcpIp(&bRegisterTcpIp); BAIL_ON_LSA_ERROR(dwError); if (bRegisterTcpIp) { EndPoints[i++].pszProtocol = "ncacn_ip_tcp"; } dwError = RpcSvcBindRpcInterface(&gpSamrSrvBinding, samr_v1_0_s_ifspec, EndPoints, pszDescription); BAIL_ON_LSA_ERROR(dwError); error: LW_SAFE_FREE_STRING(pszLpcSocketPath); return dwError; }