当前位置: 首页>>代码示例>>C++>>正文


C++ BAIL_ON_VMCA_ERROR函数代码示例

本文整理汇总了C++中BAIL_ON_VMCA_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ BAIL_ON_VMCA_ERROR函数的具体用法?C++ BAIL_ON_VMCA_ERROR怎么用?C++ BAIL_ON_VMCA_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BAIL_ON_VMCA_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: VMCAInitLog

DWORD
VMCAInitLog()
{
    DWORD dwError = 0;
    PSTR pszLogDir = NULL;

    pthread_rwlock_wrlock(&rwloglock);

    VMCAReadLogConfig();

    if (gVMCALogType == VMCA_LOG_TYPE_FILE)
    {
        dwError = VMCAGetLogFileDirectory(&pszLogDir);
        BAIL_ON_VMCA_ERROR(dwError);

        dwError = VMCARenameLogs();
        BAIL_ON_VMCA_ERROR(dwError);

        dwError = VMCACreatePrimaryLog(pszLogDir);
        BAIL_ON_VMCA_ERROR(dwError);
    }
#ifndef WIN32
    if (gVMCALogType == VMCA_LOG_TYPE_SYSLOG)
    {
        openlog("vmcad", 0, LOG_DAEMON);
    }
#endif

error :
    pthread_rwlock_unlock(&rwloglock);
    VMCA_SAFE_FREE_STRINGA(pszLogDir);

    return dwError;

}
开发者ID:vmware,项目名称:lightwave,代码行数:35,代码来源:logging.c

示例2: VMCAAllocateStringW

DWORD
VMCAAllocateStringW(
    PCWSTR pwszSrc,
    PWSTR* ppwszDst
    )
{
    DWORD dwError = 0;

    if (!pwszSrc || !ppwszDst)
    {
        dwError = ERROR_INVALID_PARAMETER;
    }
    else
    {
#ifdef _WIN32
        PWSTR pwszNewString = NULL;
        size_t len = wcslen(pwszSrc);
        dwError = VMCAAllocateMemory(
                        (DWORD) (len + 1)*sizeof(WCHAR), 
                        (PVOID *)&pwszNewString
                        );
        BAIL_ON_VMCA_ERROR(dwError);

        wcscpy_s(pwszNewString, (len + 1), pwszSrc);

        *ppwszDst = pwszNewString;
#else
		dwError = LwNtStatusToWin32Error(
						LwRtlWC16StringDuplicate(ppwszDst, pwszSrc));
        BAIL_ON_VMCA_ERROR(dwError);
#endif
    }
error:
    return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:35,代码来源:memory.c

示例3: InitializeRPCServer

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;
}
开发者ID:vmware,项目名称:lightwave,代码行数:30,代码来源:service.c

示例4: VMCAShutdownRPCServer

static
VOID
VMCAShutdownRPCServer(
    VOID
    )
{
    DWORD dwError = 0;

    // stop rpc listening
    dwError = VMCAStopRpcServer();
    BAIL_ON_VMCA_ERROR(dwError);

    if (gVMCAServerGlobals.pRPCServerThread)
    {
        dwError = dcethread_interrupt(gVMCAServerGlobals.pRPCServerThread);
        dwError = VMCAMapDCEErrorCode(dwError);
        BAIL_ON_VMCA_ERROR(dwError);
#if defined(_WIN32)
        // BUGBUG BUGBUG PR http://bugzilla.eng.vmware.com/show_bug.cgi?id=1219191
        // This is most likely a pthread issue due to signal lost.
        // We should update pthread to see if we can resolve this.
        // http://bugzilla.eng.vmware.com/show_bug.cgi?id=1224401 tracks this effort.

        VMCASleep(1);  // sleep 1s
#else
        dwError = dcethread_join(gVMCAServerGlobals.pRPCServerThread, NULL);
        dwError = VMCAMapDCEErrorCode(dwError);
        BAIL_ON_VMCA_ERROR(dwError);
#endif
        gVMCAServerGlobals.pRPCServerThread = NULL;
    }

error:
    return;
}
开发者ID:vmware,项目名称:lightwave,代码行数:35,代码来源:service.c

示例5: VMCACreatePrimaryLog

DWORD
VMCACreatePrimaryLog(PSTR pszLogDir)
{
    DWORD dwError = 0;
    PSTR pszDestFile = NULL;
    if(pszLogDir == NULL) {
        dwError = ERROR_INVALID_PARAMETER;
        BAIL_ON_VMCA_ERROR(dwError);
    }

    dwError = VMCAAllocateStringPrintfA(
                  &pszDestFile,
                  FORMATSTR,
                  pszLogDir,
                  VMCA_LOG_STRING,
                  0);// This is always the Current Log File
    BAIL_ON_VMCA_ERROR(dwError);

    if (fpCurrentLog != NULL) {
        fclose(fpCurrentLog);
        fpCurrentLog = NULL;
    }

    fpCurrentLog = fopen(pszDestFile, "a");

    gVMCACurrentLogSizeBytes = 0;

error :
    VMCA_SAFE_FREE_STRINGA(pszDestFile);
    return dwError;
}
开发者ID:vmware,项目名称:lightwave,代码行数:31,代码来源:logging.c

示例6: VMCAReadDataFromFile

DWORD
VMCAReadDataFromFile(
    PSTR pszFileName,
    DWORD dwOffset,
    DWORD dwSize,
    PSTR data,
    PDWORD dwBytesRead)
{
    DWORD dwError = 0;
    FILE *pFile = NULL;
    int bytes_read = 0;

    dwError = VMCAOpenFilePath(pszFileName, "r", &pFile);
    BAIL_ON_VMCA_ERROR(dwError);

    if ( pFile == NULL) {
        dwError = VMCA_FILE_IO_ERROR;
        BAIL_ON_VMCA_ERROR(dwError);
    }

    dwError = fseek(pFile, dwOffset, SEEK_SET);
    BAIL_ON_VMCA_ERROR(dwError);

    bytes_read = fread(data, 1, dwSize, pFile);
    if ( !feof(pFile) && ( bytes_read != dwSize)){
        dwError = VMCA_FILE_IO_ERROR;
        BAIL_ON_VMCA_ERROR(dwError);
    }
    *dwBytesRead = bytes_read;
error :
    if(pFile != NULL){
        fclose(pFile);
    }
    return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:35,代码来源:entrypoints.c

示例7: VMCAReGenCRL

unsigned int
VMCAReGenCRL()
{

    DWORD dwError = 0;
    PSTR pszTmpFile = NULL;
    DWORD dwExists = 0;

    dwError = VMCAGetTempCRLNamePath(&pszTmpFile);
    BAIL_ON_VMCA_ERROR(dwError);

    dwError = VMCACheckFileExists(pszTmpFile,&dwExists);
    if(dwExists == FILE_EXISTS) {

        dwError = remove(pszTmpFile);

        if ( dwError == -1) {
            dwError = VMCA_FILE_REMOVE_ERROR;
        }
        BAIL_ON_VMCA_ERROR(dwError);
    }
    dwError = VMCAGenerateCRL();
    BAIL_ON_VMCA_ERROR(dwError);

    dwError = VMCACopyTempCRLtoCRL();
    BAIL_ON_VMCA_ERROR(dwError);

error :

    VMCA_SAFE_FREE_STRINGA(pszTmpFile);
    return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:32,代码来源:entrypoints.c

示例8: VmcaDbCreateContext

DWORD
VmcaDbCreateContext(
    PVMCA_DB_CONTEXT* ppDbContext
    )
{
    DWORD dwError = 0;
    PVMCA_DB_CONTEXT pDbContext = NULL;
    BOOLEAN bInLock = FALSE;

    VMCA_LOG_(VMCA_LOG_LEVEL_DEBUG,"Creating VMCA database context");
    VMCA_LOCK_MUTEX(bInLock, &gVmcaDbGlobals.mutex);

    if (gVmcaDbGlobals.pDbContextList)
    {
        pDbContext = gVmcaDbGlobals.pDbContextList;
        gVmcaDbGlobals.pDbContextList = gVmcaDbGlobals.pDbContextList->pNext;

        pDbContext->pNext = NULL;

        gVmcaDbGlobals.dwNumCachedContexts--;
    }
    else
    {
        VMCA_LOG_DEBUG("Allocating database context for %s", gVmcaDbGlobals.pszDbPath);
        dwError = VMCAAllocateMemory(sizeof(*pDbContext), (PVOID*)&pDbContext);
        BAIL_ON_VMCA_ERROR(dwError);

        dwError = sqlite3_open(
            gVmcaDbGlobals.pszDbPath,
            &pDbContext->pDb);
        BAIL_ON_VMCA_ERROR(dwError);

        dwError = sqlite3_busy_timeout(
                    pDbContext->pDb,
                    5000);
        BAIL_ON_VMCA_ERROR(dwError);
    }

    *ppDbContext = pDbContext;

cleanup:
    VMCA_UNLOCK_MUTEX(bInLock, &gVmcaDbGlobals.mutex);
    VMCA_LOG_DEBUG("VMCA database context created Error = %d", dwError);
    return dwError;

error:

    *ppDbContext = NULL;

    if (pDbContext)
    {
        VmcaDbFreeContext(pDbContext);
    }

    goto cleanup;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:56,代码来源:dbcontext.c

示例9: VMCACloneCertContainerFromDbCertEntryArray

// db entry util
unsigned int
VMCACloneCertContainerFromDbCertEntryArray(
    PVMCA_DB_CERTIFICATE_ENTRY  pDbCertEntryArray,
    DWORD                       dwDbCertEntryNums,
    VMCA_CERTIFICATE_ARRAY**    ppCertArray
    )
{
    DWORD dwError = 0;
    PVMCA_CERTIFICATE_ARRAY pCertArray = NULL;

    dwError = VMCARpcAllocateMemory(
                    sizeof(VMCA_CERTIFICATE_ARRAY),
                    (PVOID*)&pCertArray);
    BAIL_ON_VMCA_ERROR(dwError);
    // get array size
    pCertArray->dwCount = dwDbCertEntryNums;

    if (pCertArray->dwCount > 0)
    {
        DWORD iEntry = 0;
        dwError = VMCARpcAllocateMemory(
                    pCertArray->dwCount * sizeof(pCertArray->certificates[0]),
                    (PVOID*)&pCertArray->certificates);
        BAIL_ON_VMCA_ERROR(dwError);
        for (; iEntry < pCertArray->dwCount; iEntry++)
        {
            PVMCA_DB_CERTIFICATE_ENTRY    pDbCertEntrySrc      = &pDbCertEntryArray[iEntry];
            PVMCA_CERTIFICATE_CONTAINER pCertContainerDst = &pCertArray->certificates[iEntry];

            // copy pCert string to container
            dwError = VMCAClonePkgEntryContentsFromDbPkgEntry(
                      pDbCertEntrySrc,
                      pCertContainerDst);

            BAIL_ON_VMCA_ERROR(dwError);
        }
    }

    *ppCertArray = pCertArray;

cleanup:

    return dwError;

error:

    *ppCertArray = NULL;

    if (pCertArray)
    {
        VMCARpcFreeCertificateArray(pCertArray);
    }

    goto cleanup;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:56,代码来源:entrypoints.c

示例10: VMCARestServerInit

DWORD
VMCARestServerInit(
    VOID
    )
{
    DWORD dwError = 0;

    MODULE_REG_MAP stRegMap[] =
    {
        //{"endpoint", VMCARestFunctionModule},
        {NULL, NULL}
    };

    /*
     * We can use the same REST_API_SPEC for both HTTP and HTTPS
     * if the rest init code refers to common API definitions
     */
    dwError = coapi_load_from_file(REST_API_SPEC, &gpVMCARestApiDef);
    BAIL_ON_VMCA_ERROR(dwError);

    dwError = coapi_map_api_impl(gpVMCARestApiDef, stRegMap);
    BAIL_ON_VMCA_ERROR(dwError);

    dwError = VMCAOpensslInit();
    BAIL_ON_VMCA_ERROR(dwError);

    dwError = _VMCARestServerInitHTTPS();
    if (dwError != 0)
    {
        /*
         * Before promoting lightwave node, obtaining cert from VECS will fail which is expected
         * hence treat it as soft fail
         */
         VMCA_LOG_WARNING(
                 "VmRESTServerInit: HTTPS port init failed with error %d, (failure is expected before promote)",
                 dwError);
         dwError = 0;
    }

cleanup:
    return dwError;

error:
    if (VMCARestServerStop() == 0)
    {
        VMCARestServerShutdown();
    }
    VMCA_LOG_ERROR(
            "%s failed, error (%d)",
            __FUNCTION__,
            dwError);

    goto cleanup;
}
开发者ID:vmware,项目名称:lightwave,代码行数:54,代码来源:libmain.c

示例11: VMCACreateDirectory

DWORD
VMCACreateDirectory(PSTR pszDirectoryName, BOOL bRestrictAccess)
{
    DWORD dwError = 0;
    PSTR pszDir = NULL;
#ifdef _WIN32
    PSTR pszTemp = NULL;
    int err = 0;
#endif

    if (!pszDirectoryName || !*pszDirectoryName)
    {
        dwError = ERROR_INVALID_PARAMETER;
        BAIL_ON_VMCA_ERROR(dwError);
    }

#ifndef _WIN32
     mkdir(pszDirectoryName, 700);
     goto error;
#else
    dwError = VMCAAllocateStringA(pszDirectoryName, &pszDir);
    BAIL_ON_VMCA_ERROR(dwError);

    pszTemp = pszDir;
    if (strlen(pszDir) > 3 && pszDir[1] == ':' && pszDir[2] == '\\')
    {
        pszTemp += 3;
    }
    while ( (pszTemp = strchr(pszTemp, '\\')) )
    {
        *pszTemp = '\0';
        err = _mkdir(pszDir);
        if(err == -1 && errno != EEXIST)
        {
            dwError = ERROR_PATH_NOT_FOUND;
            BAIL_ON_VMCA_ERROR(dwError);
        }
        *pszTemp++ = '/';
    }

    if (bRestrictAccess)
    {
        dwError = VMCARestrictDirectoryAccess(pszDir);
        BAIL_ON_VMCA_ERROR(dwError);
    }
#endif

error:

    VMCA_SAFE_FREE_STRINGA(pszDir);

    return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:53,代码来源:entrypoints.c

示例12: VMCAVerifyCertificate

DWORD
VMCAVerifyCertificate(
    unsigned char *pszPEMEncodedCertificate,
    unsigned int *dwStatus
    )
{
    DWORD dwError = 0;
    PVMCA_DB_CERTIFICATE_ENTRY pEntry = NULL;
    PVMCA_DB_CONTEXT pContext = NULL;
    BOOLEAN bLocked = FALSE;

    *dwStatus = VMCA_CERTIFICATE_ALL;

    VMCA_LOCK_MUTEX_SHARED(&gVMCAServerGlobals.svcMutex, bLocked);

    dwError = VMCASrvValidateCA();
    BAIL_ON_VMCA_ERROR(dwError);

    dwError = VMCADecodeCert((LPSTR)pszPEMEncodedCertificate, &pEntry);
    BAIL_ON_VMCA_ERROR(dwError);

    if (pEntry->dwRevoked == VMCA_CERTIFICATE_EXPIRED)
    {
        *dwStatus = VMCA_CERTIFICATE_EXPIRED;
        goto error;
    }

    dwError = VmcaDbCreateContext(&pContext);
    BAIL_ON_VMCA_ERROR(dwError);

    dwError =  VmcaDbVerifyCertificate(pContext, pEntry->pwszSerial, (DWORD*)dwStatus);
    BAIL_ON_VMCA_ERROR(dwError);

error :

    VMCA_LOCK_MUTEX_UNLOCK(&gVMCAServerGlobals.svcMutex, bLocked);

    if (pContext != NULL)
    {
        VmcaDbReleaseContext(pContext);
        pContext = NULL;
    }
    if(pEntry != NULL)
    {
        VMCAFreeDBEntryFields(pEntry);
        pEntry = NULL;
    }
    return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:49,代码来源:entrypoints.c

示例13: _VMCAMkDir

DWORD
_VMCAMkDir( PSTR pszDirName, int mode)
{
    DWORD dwError = 0;
#ifdef _WIN32
    UNUSED(mode);
    dwError = _mkdir(pszDirName);
    BAIL_ON_VMCA_ERROR(dwError);
#else
    dwError = mkdir(pszDirName, mode);
    BAIL_ON_VMCA_ERROR(dwError);
#endif
error:
    return dwError;
}
开发者ID:vmware,项目名称:lightwave,代码行数:15,代码来源:logging.c

示例14: VMCARpcAllocateStringW

DWORD
VMCARpcAllocateStringW(
    RP_PWSTR  pwszSrc,
    RP_PWSTR* ppwszDst
    )
{
    DWORD dwError = 0;
    size_t len = 0;
    RP_PWSTR pwszDst = NULL;

    if (!pwszSrc || !ppwszDst)
    {
        dwError = ERROR_INVALID_PARAMETER;
        BAIL_ON_VMCA_ERROR(dwError);
    }

    dwError = LwWc16sLen(pwszSrc, &len);
    BAIL_ON_VMCA_ERROR(dwError);

    dwError = VMCARpcAllocateMemory(
                    sizeof(RP_WSTR) * (len + 1),
                    (PVOID*)&pwszDst);
    BAIL_ON_VMCA_ERROR(dwError);

    dwError = LwWc16snCpy(pwszDst, pwszSrc, len);
    BAIL_ON_VMCA_ERROR(dwError);

    *ppwszDst = pwszDst;

cleanup:

    return dwError;

error:

    if (ppwszDst)
    {
        *ppwszDst = NULL;
    }

    if (pwszDst)
    {
        VMCARpcFreeMemory(pwszDst);
    }

    goto cleanup;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:47,代码来源:rpcstring.c

示例15: VMCAGetRootCACertificate

unsigned int
VMCAGetRootCACertificate(
    unsigned int *dwCertLength,
    VMCA_CERTIFICATE_CONTAINER **ppCertContainer
    )
{
    DWORD dwError = 0;
    PVMCA_CERTIFICATE pCertificate = NULL;
    PSTR pszRootCertFile = NULL;
    BOOLEAN bLocked = FALSE;

    VMCA_LOCK_MUTEX_SHARED(&gVMCAServerGlobals.svcMutex, bLocked);

    dwError = VMCASrvValidateCA();
    BAIL_ON_VMCA_ERROR(dwError);

    VMCAGetRootCertificateFilePath(&pszRootCertFile);
    BAIL_ON_VMCA_ERROR(dwError);

    dwError = VMCAReadCertificateChainFromFile(
                                pszRootCertFile,
                                &pCertificate);
    BAIL_ON_VMCA_ERROR(dwError);

    dwError = VMCARpcAllocateCertificateContainer(pCertificate, ppCertContainer);
    BAIL_ON_VMCA_ERROR(dwError);

    strcpy((char*)(*ppCertContainer)->pCert,pCertificate);

error :

    VMCA_LOCK_MUTEX_UNLOCK(&gVMCAServerGlobals.svcMutex, bLocked);

    if( dwError != 0)
    {
        if (ppCertContainer && *ppCertContainer)
        {
            VMCARpcFreeCertificateContainer(*ppCertContainer);
            *ppCertContainer = NULL;
        }
    }

    VMCA_SAFE_FREE_STRINGA(pCertificate);
    VMCA_SAFE_FREE_STRINGA(pszRootCertFile);
    pCertificate = NULL;
    return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:47,代码来源:entrypoints.c


注:本文中的BAIL_ON_VMCA_ERROR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。