Esempio n. 1
0
static
VOID
VmDirPagedSearchCacheRecordFree(
    PVDIR_PAGED_SEARCH_RECORD pSearchRecord
    )
{
    PVOID pvData = NULL;
    BOOLEAN bInLock = FALSE;

    if (pSearchRecord == NULL)
    {
        return;
    }

    VMDIR_LOCK_MUTEX(bInLock, gPagedSearchCache.mutex);
    (VOID)LwRtlHashTableRemove(gPagedSearchCache.pHashTbl, &pSearchRecord->Node);
    VMDIR_UNLOCK_MUTEX(bInLock, gPagedSearchCache.mutex);

    VmDirFreeStringA(pSearchRecord->pszGuid);

    DeleteFilter(pSearchRecord->pFilter);

    while (dequePop(pSearchRecord->pQueue, (PVOID*)&pvData) == 0)
    {
        VmDirFreeMemory(pvData);
    }
    dequeFree(pSearchRecord->pQueue);

    VmDirFreeMutex(pSearchRecord->mutex);
    VmDirFreeCondition(pSearchRecord->pDataAvailable);

    VmDirSrvThrFree(pSearchRecord->pThreadInfo);

    VmDirFreeMemory(pSearchRecord);
}
Esempio n. 2
0
static
DWORD
VmDirPagedSearchCreateThread(
    PVDIR_PAGED_SEARCH_RECORD pSearchRecord
    )
{
    DWORD dwError = 0;
    PVDIR_THREAD_INFO pThrInfo = NULL;

    dwError = VmDirSrvThrInit(&pThrInfo, NULL, NULL, FALSE);
    BAIL_ON_VMDIR_ERROR(dwError);

    dwError = VmDirCreateThread(
                &pThrInfo->tid,
                pThrInfo->bJoinThr,
                _VmDirPagedSearchWorkerThread,
                pSearchRecord);
    BAIL_ON_VMDIR_ERROR(dwError);

    pSearchRecord->pThreadInfo = pThrInfo;

cleanup:
    return dwError;

error:
    VmDirSrvThrFree(pThrInfo);
    goto cleanup;
}
Esempio n. 3
0
DWORD
VmDirInitRidSynchThr(
    PVDIR_THREAD_INFO* ppThrInfo
    )
{
    DWORD               dwError = 0;
    PVDIR_THREAD_INFO   pThrInfo = NULL;

    dwError = VmDirAllocateMemory(
                sizeof(*pThrInfo),
                (PVOID)&pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrInit(
                pThrInfo,
                NULL,
                NULL,
                TRUE);   // join by main thr

    dwError = VmDirCreateThread(
                &pThrInfo->tid,
                FALSE,
                _VmDirRidSyncThr,
                pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrAdd(pThrInfo);
    *ppThrInfo = pThrInfo;

cleanup:

    return dwError;

error:

    if (pThrInfo)
    {
        VmDirSrvThrFree(pThrInfo);
    }

    goto cleanup;
}
Esempio n. 4
0
DWORD
InitializeDbChkpointThread(
    VOID)
{
    DWORD               dwError = 0;
    PVDIR_THREAD_INFO   pThrInfo = NULL;

    dwError = VmDirAllocateMemory(
            sizeof(*pThrInfo),
            (PVOID)&pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrInit(
            pThrInfo,
            NULL,
            NULL,
            TRUE);  // join by main thr

    dwError = VmDirCreateThread(
            &pThrInfo->tid,
            FALSE,
            VmDirBdbCheckpointThrFun,
            pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrAdd(pThrInfo);

cleanup:

    return (int)dwError;  //TODO, should not cast

error:

    if (pThrInfo)
    {
        VmDirSrvThrFree(pThrInfo);
    }

    goto cleanup;
}
Esempio n. 5
0
DWORD
InitializeIndexingThread(
    void)
{
    DWORD       dwError = 0;
    PVDIR_THREAD_INFO   pThrInfo = NULL;

    dwError = VmDirAllocateMemory(
                  sizeof(*pThrInfo),
                  (PVOID)&pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrInit(
        pThrInfo,
        gVdirAttrIndexGlobals.mutex,       // alternative mutex
        gVdirAttrIndexGlobals.condition,   // alternative cond
        TRUE);                              // join by main thr

    dwError = VmDirCreateThread(
                  &pThrInfo->tid,
                  FALSE,
                  vdirIndexingThrFun,
                  pThrInfo);
    BAIL_ON_VMDIR_ERROR(dwError);

    VmDirSrvThrAdd(pThrInfo);

cleanup:

    return dwError;

error:

    if (pThrInfo)
    {
        VmDirSrvThrFree(pThrInfo);
    }

    goto cleanup;
}
Esempio n. 6
0
DWORD
VmDirInitConnAcceptThread(
    void
    )
{
    DWORD               dwError = 0;
    PDWORD              pdwLdapPorts = NULL;
    DWORD               dwLdapPorts = 0;
    PDWORD              pdwLdapsPorts = NULL;
    DWORD               dwLdapsPorts = 0;
    PVDIR_THREAD_INFO   pThrInfo = NULL;
    PDWORD              pdwPort = NULL;
    DWORD               i = 0;
    BOOLEAN             isIPV6AddressPresent = FALSE;
    BOOLEAN             isIPV4AddressPresent = FALSE;

    dwError = VmDirWhichAddressPresent(&isIPV4AddressPresent, &isIPV6AddressPresent);
    BAIL_ON_VMDIR_ERROR(dwError);
    if (isIPV4AddressPresent)
    {
       gVmdirServerGlobals.isIPV4AddressPresent = TRUE;
    }
    if (isIPV6AddressPresent)
    {
       gVmdirServerGlobals.isIPV6AddressPresent = TRUE;
    }

    VmDirGetLdapListenPorts(&pdwLdapPorts, &dwLdapPorts);
    VmDirGetLdapsListenPorts(&pdwLdapsPorts, &dwLdapsPorts);

    for (i = 0; i < dwLdapPorts; i++)
    {
        dwError = VmDirAllocateMemory(
                sizeof(*pThrInfo),
                (PVOID*)&pThrInfo);
        BAIL_ON_VMDIR_ERROR(dwError);

        dwError = VmDirAllocateMemory(
                sizeof(DWORD),
                (PVOID)&pdwPort);
        BAIL_ON_VMDIR_ERROR(dwError);

        *pdwPort = pdwLdapPorts[i];

        VmDirSrvThrInit(
                pThrInfo,
                gVmdirGlobals.replCycleDoneMutex,     // alternative mutex
                gVmdirGlobals.replCycleDoneCondition, // alternative cond
                FALSE);  // join by main thr

        dwError = VmDirCreateThread(
                &pThrInfo->tid,
                FALSE,
                vmdirConnAcceptThrFunc,
                (PVOID)pdwPort);  // New thread owns pdwPort
        BAIL_ON_VMDIR_ERROR(dwError);

        VmDirSrvThrAdd(pThrInfo);
        pThrInfo = NULL;
        pdwPort = NULL;
    }

    for (i = 0; gVmdirOpensslGlobals.bSSLInitialized && i < dwLdapsPorts; i++)
    {
        dwError = VmDirAllocateMemory(
                sizeof(*pThrInfo),
                (PVOID*)&pThrInfo);
        BAIL_ON_VMDIR_ERROR(dwError);

        dwError = VmDirAllocateMemory(
                sizeof(DWORD),
                (PVOID)&pdwPort);
        BAIL_ON_VMDIR_ERROR(dwError);

        *pdwPort = pdwLdapsPorts[i];

        VmDirSrvThrInit(
                pThrInfo,
                gVmdirGlobals.replCycleDoneMutex,     // alternative mutex
                gVmdirGlobals.replCycleDoneCondition, // alternative cond
                FALSE);  // join by main thr

        dwError = VmDirCreateThread(
                &pThrInfo->tid,
                FALSE,
                vmdirSSLConnAcceptThrFunc,
                (PVOID)pdwPort);
        BAIL_ON_VMDIR_ERROR(dwError);

        VmDirSrvThrAdd(pThrInfo);
        pThrInfo = NULL;
        pdwPort = NULL;
    }

cleanup:

    return dwError;

error:

    if (pThrInfo)
    {
        VmDirSrvThrFree(pThrInfo);
    }

    VMDIR_SAFE_FREE_MEMORY(pdwPort);

    goto cleanup;
}