예제 #1
0
DWORD
VmDnsRpcServerStartListen(
    VOID
    )
{
    DWORD dwError = 0;
    int status = 0;

    status = dcethread_create(
                            &gVmdnsGlobals.pRPCServerThread,
                            NULL,
                            VmDnsListenRpcServer,
                            NULL);
#ifndef _WIN32
    dwError = LwErrnoToWin32Error(status);
#else
    dwError = status;
#endif

    BAIL_ON_VMDNS_ERROR(dwError);

    while (!VmDnsRpcCheckServerIsActive())
    {
        // Wait for RPC Server to come up.
    }

error:

    return dwError;
}
예제 #2
0
파일: service.c 프로젝트: vmware/lightwave
static
DWORD
InitializeRPCServer(
    VOID
    )
{
    DWORD dwError = 0;

    dwError  = VMCAStartRpcServer();
    BAIL_ON_VMCA_ERROR(dwError);

	dwError = dcethread_create(
                &gVMCAServerGlobals.pRPCServerThread,
                NULL,
                VMCAListenRpcServer,
                NULL);
	dwError = VMCAMapDCEErrorCode(dwError);
	BAIL_ON_VMCA_ERROR(dwError);


    while (!VMCACheckRPCServerIsActive())
    {
        // Wait for RPC Server to come up.
        VMCASleep(1);
    }

error:

    return dwError;
}
예제 #3
0
static
DWORD
InitializeRPCServer(
    VOID
    )
{
    DWORD dwError = 0;

    dwError  = EventLogStartRpcServer();
    BAIL_ON_VMEVENT_ERROR(dwError);

    dwError = LwMapErrnoToLwError(
                    dcethread_create(
                            &gEventLogServerGlobals.pRPCServerThread,
                            NULL,
                            EventLogListenRpcServer,
                            NULL));
    BAIL_ON_VMEVENT_ERROR(dwError);

    while (!EventLogCheckRPCServerIsActive())
    {
        // Wait for RPC Server to come up.
    }

error:

    return dwError;
}
예제 #4
0
NTSTATUS
EVTSvcmStart(
    PLW_SVCM_INSTANCE pInstance,
    ULONG ArgCount,
    PWSTR* ppArgs,
    ULONG FdCount,
    int* pFds
    )
{
    DWORD dwError = 0;
    BOOLEAN bRegisterTcpIp = TRUE;

    dwError = EVTSetServerDefaults();
    BAIL_ON_EVT_ERROR(dwError);

    dwError = LwEvtDbCreateDB(gServerInfo.bReplaceDB);
    BAIL_ON_EVT_ERROR(dwError);

    if (gServerInfo.bReplaceDB) {
        goto cleanup;
    }

    dwError = EVTReadEventLogConfigSettings();
    if (dwError != 0)
    {
        EVT_LOG_ERROR("Failed to read eventlog configuration.  Error code: [%u]\n", dwError);
        dwError = 0;
    }

    dwError = EVTGetRegisterTcpIp(&bRegisterTcpIp);
    BAIL_ON_EVT_ERROR(dwError);

    dwError = LwEvtDbInitEventDatabase();
    BAIL_ON_EVT_ERROR(dwError);

    dwError = LwmEvtSrvStartListenThread();
    BAIL_ON_EVT_ERROR(dwError);

    dwError = EVTRegisterInterface();
    BAIL_ON_EVT_ERROR(dwError);

    if (bRegisterTcpIp)
    {
        dwError = LwMapErrnoToLwError(dcethread_create(
                                      &gNetworkThread,
                                      NULL,
                                      EVTNetworkThread,
                                      &gbExitNow));
        BAIL_ON_EVT_ERROR(dwError);

        gbRegisteredTcpIp = TRUE;
    }

cleanup:
    return LwWin32ErrorToNtStatus(dwError);

error:
    goto cleanup;
}
예제 #5
0
MU_TEST(dcethread_create, basic)
{
    dcethread* thread = NULL;

    MU_TRY_DCETHREAD( dcethread_create(&thread, NULL, basic, (void*) 0xDEADBEEF) );

    MU_ASSERT(thread != NULL);

    while (basic_result != (void*) 0xDEADBEEF)
    {
	dcethread_yield();
    }
}
예제 #6
0
int
dcethread_create_throw(dcethread** _thread, dcethread_attr* attr, void *(*start_routine)(void *), void *arg)
{
    DCETHREAD_WRAP_THROW(dcethread_create(_thread, attr, start_routine, arg));
}
예제 #7
0
DWORD
SrvSvcRpcInitialize(
    VOID
    )
{
    DWORD dwError = ERROR_SUCCESS;
    DWORD dwBindAttempts = 0;
    BOOLEAN bInLock = FALSE;
    static const DWORD dwMaxBindAttempts = 5;
    static const DWORD dwBindSleepSeconds = 5;

    SRVSVC_LOCK_MUTEX(bInLock, &gSrvsServerInfo.mutex);

    /* Binding to our RPC end-point might fail if dcerpcd is not
       yet ready when we start, so attempt it in a loop with
       a small delay between attempts */
    for (dwBindAttempts = 0; dwBindAttempts < dwMaxBindAttempts; dwBindAttempts++)
    {
        dwError = SrvSvcRegisterForRPC(
                        "Likewise Server Service",
                        &gSrvsServerInfo.pServerBinding);
        if (dwError)
        {
            SRVSVC_LOG_INFO("Failed to bind srvsvc endpoint; retrying in "
                            "%i seconds...",
                            (int) dwBindSleepSeconds);
            sleep(dwBindSleepSeconds);
        }
        else
        {
            break;
        }
    }
    /* Bail if we still haven't succeeded after several attempts */
    BAIL_ON_SRVSVC_ERROR(dwError);

    /* Now register the winreg pipe */

    for (dwBindAttempts = 0; dwBindAttempts < dwMaxBindAttempts; dwBindAttempts++)
    {
        dwError = WinRegRegisterForRPC(
                        "Likewise Registry Service",
                        &gSrvsServerInfo.pRegistryBinding);
        if (dwError)
        {
            SRVSVC_LOG_INFO("Failed to bind wkssvc endpoint; retrying in "
                            "%i seconds...",
                            (int) dwBindSleepSeconds);
            sleep(dwBindSleepSeconds);
        }
        else
        {
            break;
        }
    }
    /* Bail if we still haven't succeeded after several attempts */
    BAIL_ON_SRVSVC_ERROR(dwError);

    dwError = LwMapErrnoToLwError(dcethread_create(
                                        &gSrvsServerInfo.pRpcListenerThread,
                                        NULL,
                                        &SrvSvcListenForRPC,
                                        NULL));
    BAIL_ON_SRVSVC_ERROR(dwError);

    while (!SrvSvcRpcIsListening())
    {
    }

error:
    SRVSVC_UNLOCK_MUTEX(bInLock, &gSrvsServerInfo.mutex);

    return dwError;
}