• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LwAllocateStringPrintf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: KtLdapBind

static
DWORD
KtLdapBind(
    LDAP  **ppLd,
    PCSTR   pszDc
    )
{
    const int version = LDAP_VERSION3;
    DWORD dwError = ERROR_SUCCESS;
    int lderr = 0;
    PSTR pszUrl = NULL;
    LDAP *pLd = NULL;

    dwError = LwAllocateStringPrintf(&pszUrl,
                                     "ldap://%s",
                                     pszDc);
    BAIL_ON_LSA_ERROR(dwError);

    lderr = ldap_initialize(&pLd,
                            pszUrl);
    BAIL_ON_LDAP_ERROR(lderr);

    lderr = ldap_set_option(pLd,
                            LDAP_OPT_PROTOCOL_VERSION,
                            &version);
    BAIL_ON_LDAP_ERROR(lderr);

    lderr = ldap_set_option(pLd,
                            LDAP_OPT_REFERRALS,
                            LDAP_OPT_OFF);
    BAIL_ON_LDAP_ERROR(lderr);

    dwError = LwLdapBindDirectorySasl(pLd, pszDc, FALSE);
    BAIL_ON_LSA_ERROR(dwError);

    *ppLd = pLd;

cleanup:
    LW_SAFE_FREE_MEMORY(pszUrl);

    if (dwError == ERROR_SUCCESS &&
        lderr != LDAP_SUCCESS)
    {
        dwError = LwMapLdapErrorToLwError(lderr);
    }

    return dwError;

error:
    if (pLd)
    {
        ldap_memfree(pLd);
    }

    *ppLd = NULL;

    goto cleanup;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:58,代码来源:ktldap.c


示例2: KtLdapGetSaltingPrincipalA

DWORD
KtLdapGetSaltingPrincipalA(
    PCSTR  pszDcName,
    PCSTR  pszBaseDn,
    PCSTR  pszMachAcctName,
    PSTR  *ppszSalt
    )
{
    PCSTR pszUpnAttr = "userPrincipalName";
    PCSTR pszSamAcctAttr = "sAMAccountName";

    DWORD dwError = ERROR_SUCCESS;
    LDAP *pLd = NULL;
    PSTR pszFilter = NULL;
    PSTR pszUpn = NULL;

    /* Bind to directory service on the DC */
    dwError = KtLdapBind(&pLd, pszDcName);
    BAIL_ON_LSA_ERROR(dwError);

    /* Prepare ldap query filter */
    dwError = LwAllocateStringPrintf(&pszFilter,
                                     "(%s=%s)",
                                     pszSamAcctAttr,
                                     pszMachAcctName);
    BAIL_ON_LSA_ERROR(dwError);

    /* Look for key version number attribute */
    dwError = KtLdapQuery(pLd,
                          pszBaseDn,
                          LDAP_SCOPE_SUBTREE,
                          pszFilter,
                          pszUpnAttr,
                          &pszUpn);
    BAIL_ON_LSA_ERROR(dwError);

    *ppszSalt = pszUpn;

cleanup:
    /* Close connection to the directory */
    if (pLd)
    {
        KtLdapUnbind(pLd);
    }

    LW_SAFE_FREE_MEMORY(pszFilter);

    return dwError;

error:
    LW_SAFE_FREE_MEMORY(pszUpn);

    *ppszSalt = NULL;

    goto cleanup;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:56,代码来源:ktldap.c


示例3: LwpsLegacyGetJoinedDomainTrustEnumerationWaitTime

DWORD
LwpsLegacyGetJoinedDomainTrustEnumerationWaitTime(
    IN PLWPS_LEGACY_STATE pContext,
    IN OPTIONAL PCSTR pszDomainName,
    OUT PDWORD* ppdwTrustEnumerationWaitSeconds,
    OUT PDWORD* ppdwTrustEnumerationWaitEnabled    
    )
{
    DWORD dwError = 0;
    int EE = 0;
    PSTR pszRegistryPath = NULL;
    PVOID dwValue = NULL;
    PVOID dwValue1 = NULL;
    REG_DATA_TYPE readType = 0;
    DWORD dwValueSize = 0;
    DWORD dwValueSize1 = 0;

    if (pszDomainName)
    {
        dwError = LwAllocateStringPrintf(
                  &pszRegistryPath,
                  "%s\\%s",
                  PSTOREDB_REGISTRY_AD_KEY,
                  pszDomainName);
        GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);
        dwError = RegUtilGetValue(
                      pContext->hReg,
                      HKEY_THIS_MACHINE,
                      pszRegistryPath,
                      NULL,
                      PSTOREDB_REGISTRY_TRUSTENUMERATIONWAIT_VALUE,
                      &readType,
                      &dwValue,
                      &dwValueSize);
        GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);
        dwError = RegUtilGetValue(
                      pContext->hReg,
                      HKEY_THIS_MACHINE,
                      pszRegistryPath,
                      NULL,
                      PSTOREDB_REGISTRY_TRUSTENUMERATIONWAITSECONDS_VALUE,
                      &readType,
                      &dwValue1,
                      &dwValueSize1);
        GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

        *ppdwTrustEnumerationWaitSeconds = (PDWORD) dwValue1;
        *ppdwTrustEnumerationWaitEnabled = (PDWORD) dwValue;      
    }

cleanup:
   
    LW_SAFE_FREE_MEMORY(pszRegistryPath);
    LSA_PSTORE_LOG_LEAVE_ERROR_EE(dwError, EE);
    return dwError;
}
开发者ID:virtual-void,项目名称:pbis,代码行数:56,代码来源:lsapstore-backend-legacy-internal.c


示例4: CleanupUsername

static
DWORD
CleanupUsername(
    IN PCSTR pszDomain,
    IN OUT PSTR* ppszUsername
    )
{
    DWORD dwError = 0;
    PSTR pszOldUsername = *ppszUsername;
    PSTR pszNewUsername = NULL;

    // Fix up username and prompt for password, if needed.
    if (pszOldUsername)
    {
        PSTR at = NULL;

        if (strchr(pszOldUsername, '\\'))
        {
            fprintf(stderr,
                    "The USERNAME (%s) is not allowed to contain a backslash.\n",
                    pszOldUsername);
            exit(1);
        }

        at = strchr(pszOldUsername, '@');
        if (at)
        {
            LwStrToUpper(at);
        }
        else
        {
            dwError = LwAllocateStringPrintf(
                            &pszNewUsername,
                            "%[email protected]%s",
                            pszOldUsername,
                            pszDomain);
            GOTO_CLEANUP_ON_WINERROR(dwError);
        }
    }

cleanup:
    if (dwError)
    {
        LW_SAFE_FREE_MEMORY(pszNewUsername);
    }

    if (pszNewUsername)
    {
        LW_SAFE_FREE_MEMORY(*ppszUsername);
        *ppszUsername = pszNewUsername;
    }

    return dwError;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:54,代码来源:join_leave_main.c


示例5: LwpsLegacyDeletePassword

DWORD
LwpsLegacyDeletePassword(
    IN PLWPS_LEGACY_STATE pContext,
    IN PCSTR pszDomainName
    )
{
    DWORD dwError = 0;
    int EE = 0;
    PSTR pszRegistryPath = NULL;
    DWORD dwSubKeysCount = 0;
    DWORD dwValuesCount = 0;

    dwError = LwAllocateStringPrintf(
                  &pszRegistryPath,
                  "%s\\%s",
                  PSTOREDB_REGISTRY_AD_KEY,
                  pszDomainName);
    GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

    RegUtilDeleteTree(
        pContext->hReg,
        NULL,
        pszRegistryPath,
        PSTOREDB_REGISTRY_PSTORE_SUBKEY);
    // TODO-What if there is an error?

    /* Delete domain key only if empty */
    dwError = RegUtilGetKeyObjectCounts(
                  pContext->hReg,
                  HKEY_THIS_MACHINE,
                  pszRegistryPath,
                  NULL,
                  &dwSubKeysCount,
                  &dwValuesCount);
    if (dwError)
    {
        dwError = 0;
    }
    else if (!dwSubKeysCount && !dwValuesCount)
    {
        RegUtilDeleteKey(
            pContext->hReg,
            HKEY_THIS_MACHINE,
            pszRegistryPath,
            NULL);
        // TODO-What if there is an error?
    }

cleanup:
    LW_SAFE_FREE_MEMORY(pszRegistryPath);

    LSA_PSTORE_LOG_LEAVE_ERROR_EE(dwError, EE);
    return dwError;
}
开发者ID:borland667,项目名称:pbis,代码行数:54,代码来源:lsapstore-backend-legacy-internal.c


示例6: LwKrb5InitializeCredentials

DWORD
LwKrb5InitializeCredentials(
    IN PCSTR pszUserPrincipalName,
    IN PCSTR pszPassword,
    IN PCSTR pszCachePath,
    OUT OPTIONAL PDWORD pdwGoodUntilTime
    )
{
    DWORD dwError = LW_ERROR_SUCCESS;
    DWORD dwGoodUntilTime = 0;
    PSTR pszTempCachePath = NULL;

    if (!pszCachePath)
    {
        dwError = ERROR_INVALID_PARAMETER;
        BAIL_ON_LW_ERROR(dwError);
    }

    if (!strncmp(pszCachePath, "FILE:", sizeof("FILE:") - 1))
    {
        dwError = LwAllocateStringPrintf(&pszTempCachePath, "%s.new",
                                         pszCachePath);
        BAIL_ON_LW_ERROR(dwError);
    }

    dwError = LwKrb5GetTgt(
                    pszUserPrincipalName,
                    pszPassword,
                    pszTempCachePath ? pszTempCachePath : pszCachePath,
                    &dwGoodUntilTime);
    BAIL_ON_LW_ERROR(dwError);

    if (pszTempCachePath)
    {
        dwError = LwMoveFile(pszTempCachePath + sizeof("FILE:") - 1,
                             pszCachePath + sizeof("FILE:") - 1);
        BAIL_ON_LW_ERROR(dwError);
    }

error:
    if (dwError)
    {
        dwGoodUntilTime = 0;
    }

    LW_SAFE_FREE_STRING(pszTempCachePath);

    if (pdwGoodUntilTime)
    {
        *pdwGoodUntilTime = dwGoodUntilTime;
    }

    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:54,代码来源:lwkrb5.c


示例7: ADUSMBGetFolder

DWORD
ADUSMBGetFolder(
    PSTR  pszDomainName,
    PSTR  pszSourceFolder,
    PSTR  pszDestFolder
    )
{
    DWORD dwError = MAC_AD_ERROR_SUCCESS;
    PSTR  pszFQSrcPath = NULL;
    PSTR  pszDCHostname = NULL;

    if (IsNullOrEmptyString(pszDomainName) ||
        IsNullOrEmptyString(pszSourceFolder) ||
        IsNullOrEmptyString(pszDestFolder))
    {
        dwError = MAC_AD_ERROR_INVALID_PARAMETER;
        BAIL_ON_MAC_ERROR(dwError);
    }

    dwError = GetPreferredDCAddress(
                    pszDomainName,
                    &pszDCHostname);
    BAIL_ON_MAC_ERROR(dwError);

    dwError = LwCreateDirectory(
                    pszDestFolder,
                    S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
    BAIL_ON_MAC_ERROR(dwError);

    dwError = LwAllocateStringPrintf(
                    &pszFQSrcPath,
                    "//%s/sysvol/%s",
                    pszDCHostname,
                    *pszSourceFolder == '/' ? pszSourceFolder+1 : pszSourceFolder);
    BAIL_ON_MAC_ERROR(dwError);

    LOG("Calling ADUSMBGetFolder(Src:%s, Dest:%s)", pszFQSrcPath, pszDestFolder);

    dwError = ADUCopyDirFromRemote(
                    pszFQSrcPath,
                    pszDestFolder);
    BAIL_ON_MAC_ERROR(dwError);

cleanup:

    LW_SAFE_FREE_STRING( pszFQSrcPath );
    LW_SAFE_FREE_STRING(pszDCHostname);

    return dwError;

error:

    goto cleanup;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:54,代码来源:filexfer.c


示例8: LsaSELinuxManageHomeDir

DWORD
LsaSELinuxManageHomeDir(
    PCSTR pszHomeDir
    )
{
    DWORD dwError = 0;
    PCSTR pszSemanageFormat = "semanage fcontext -a -e /home %s";
    PSTR pszRootHomeDir = NULL;
    PSTR pszSemanageExecute = NULL;
    int systemresult = 0;

    dwError = LsaGetDirectoryFromPath(pszHomeDir, &pszRootHomeDir);
    BAIL_ON_LSA_ERROR(dwError);

    if (LW_IS_NULL_OR_EMPTY_STR(pszRootHomeDir))
    {
        dwError = LW_ERROR_INVALID_PREFIX_PATH;
        BAIL_ON_LSA_ERROR(dwError);
    }

    if (pszRootHomeDir[0] != '/')
    {
        dwError = LW_ERROR_INVALID_PREFIX_PATH;
        BAIL_ON_LSA_ERROR(dwError);
    }

    if (pszRootHomeDir[1] == '\0')
    {
        dwError = LW_ERROR_INVALID_PREFIX_PATH;
        BAIL_ON_LSA_ERROR(dwError);
    }

    dwError = LwAllocateStringPrintf(
                    &pszSemanageExecute,
                    pszSemanageFormat,
                    pszRootHomeDir);
    BAIL_ON_LSA_ERROR(dwError);

    systemresult = system(pszSemanageExecute);
    if (systemresult < 0)
    {
        dwError = LwMapErrnoToLwError(errno);
        BAIL_ON_LSA_ERROR(dwError);
    }

cleanup:
    LW_SAFE_FREE_STRING(pszRootHomeDir);
    LW_SAFE_FREE_STRING(pszSemanageExecute);

    return dwError;

error:
    goto cleanup;
}
开发者ID:virtual-void,项目名称:pbis,代码行数:54,代码来源:selinux.c


示例9: SamDbIncrementSequenceNumber_inlock

DWORD
SamDbIncrementSequenceNumber_inlock(
    PSAM_DIRECTORY_CONTEXT pDirectoryContext
    )
{
    DWORD dwError = ERROR_SUCCESS;
    PCSTR pszQueryTemplate = "UPDATE " SAM_DB_OBJECTS_TABLE \
                     " SET " SAM_DB_COL_SEQUENCE_NUMBER \
                     " = " SAM_DB_COL_SEQUENCE_NUMBER " + 1 " \
                     " WHERE " SAM_DB_COL_OBJECT_CLASS " = %u";
    PSTR pszQuery = NULL;
    sqlite3_stmt *pSqlStatement = NULL;

    dwError = LwAllocateStringPrintf(&pszQuery,
                                     pszQueryTemplate,
                                     SAMDB_OBJECT_CLASS_DOMAIN);
    BAIL_ON_SAMDB_ERROR(dwError);

    dwError = sqlite3_prepare_v2(
                    pDirectoryContext->pDbContext->pDbHandle,
                    pszQuery,
                    -1,
                    &pSqlStatement,
                    NULL);
    BAIL_ON_SAMDB_SQLITE_ERROR_DB(
                    dwError,
                    pDirectoryContext->pDbContext->pDbHandle);

    dwError = sqlite3_step(pSqlStatement);
    if (dwError == SQLITE_DONE)
    {
        dwError = ERROR_SUCCESS;
    }
    BAIL_ON_SAMDB_SQLITE_ERROR_STMT(dwError, pSqlStatement);

cleanup:
    if (pSqlStatement)
    {
        sqlite3_finalize(pSqlStatement);
    }

    DIRECTORY_FREE_MEMORY(pszQuery);

    return dwError;

error:
    goto cleanup;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:48,代码来源:samdbmisc.c


示例10: LwKrb5SetProcessDefaultCachePath

DWORD
LwKrb5SetProcessDefaultCachePath(
    PCSTR pszCachePath
    )
{
    DWORD dwError = 0;
    PSTR pszEnvironmentEntry = NULL;
    static volatile PSTR pszSavedEnvironmentEntry = NULL;
    static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
    BOOLEAN bLocked = FALSE;

    dwError = pthread_mutex_lock(&lock);
    if (dwError)
    {
        dwError = LwMapErrnoToLwError(dwError);
        BAIL_ON_LW_ERROR(dwError);
    }
    bLocked = TRUE;

    dwError = LwAllocateStringPrintf(&pszEnvironmentEntry,
                                      "KRB5CCNAME=%s",
                                      pszCachePath);
    BAIL_ON_LW_ERROR(dwError);

    /*
     * putenv requires that the buffer not be free'd.
     */
    if (putenv(pszEnvironmentEntry) < 0)
    {
        dwError = LwMapErrnoToLwError(errno);
        BAIL_ON_LW_ERROR(dwError);
    }

    LW_SAFE_FREE_STRING(pszSavedEnvironmentEntry);
    pszSavedEnvironmentEntry = pszEnvironmentEntry;
    pszEnvironmentEntry = NULL;

error:
    LW_SAFE_FREE_STRING(pszEnvironmentEntry);
    
    if (bLocked)
    {
        pthread_mutex_unlock(&lock);
    }
    
    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:47,代码来源:lwkrb5.c


示例11: ADUSMBGetFile

DWORD
ADUSMBGetFile(
    PSTR  pszDomainName,
    PSTR  pszSourcePath,
    PSTR  pszDestPath
    )
{
    DWORD   dwError = MAC_AD_ERROR_SUCCESS;
    PSTR    pszFQSrcPath = NULL;
    PSTR    pszDCHostname = NULL;

    if (IsNullOrEmptyString(pszDomainName) ||
        IsNullOrEmptyString(pszSourcePath) ||
        IsNullOrEmptyString(pszDestPath))
    {
        dwError = MAC_AD_ERROR_INVALID_PARAMETER;
        BAIL_ON_MAC_ERROR(dwError);
    }

    dwError = GetPreferredDCAddress(
                    pszDomainName,
                    &pszDCHostname);
    BAIL_ON_MAC_ERROR(dwError);

    dwError = LwAllocateStringPrintf(
                    &pszFQSrcPath,
                    "//%s/sysvol/%s",
                    pszDCHostname,
                    *pszSourcePath == '/' ? pszSourcePath+1 : pszSourcePath);
    BAIL_ON_MAC_ERROR(dwError);

    LOG("Calling ADUCopyFileFromRemote(Src:%s, Dest:%s)", pszFQSrcPath, pszDestPath);

    dwError = ADUCopyFileFromRemote(pszFQSrcPath, pszDestPath);
    BAIL_ON_MAC_ERROR(dwError);

cleanup:

    LW_SAFE_FREE_STRING(pszFQSrcPath);
    LW_SAFE_FREE_STRING(pszDCHostname);

    return dwError;

error:

    goto cleanup;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:47,代码来源:filexfer.c


示例12: LwCLdapOpenDirectory

DWORD
LwCLdapOpenDirectory(
    IN PCSTR pszServerName,
    OUT PHANDLE phDirectory
    )
{
    DWORD dwError = LW_ERROR_SUCCESS;
    LDAP * ld = NULL;
    PLW_LDAP_DIRECTORY_CONTEXT pDirectory = NULL;
    int rc = LDAP_VERSION3;
    PSTR pszURL = NULL;

    LW_BAIL_ON_INVALID_STRING(pszServerName);

    dwError = LwAllocateStringPrintf(&pszURL, "cldap://%s",
                                        pszServerName);
    BAIL_ON_LW_ERROR(dwError);

    dwError = ldap_initialize(&ld, pszURL);
    BAIL_ON_LDAP_ERROR(dwError);

    dwError = ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &rc);
    BAIL_ON_LDAP_ERROR(dwError);

    dwError = ldap_set_option(ld, LDAP_OPT_REFERRALS, (void *)LDAP_OPT_OFF);
    BAIL_ON_LDAP_ERROR(dwError);

    dwError = LwAllocateMemory(sizeof(*pDirectory), OUT_PPVOID(&pDirectory));
    BAIL_ON_LW_ERROR(dwError);

    pDirectory->ld = ld;

error:
    LW_SAFE_FREE_STRING(pszURL);
    if (dwError)
    {
        if (pDirectory)
        {
            LwLdapCloseDirectory(pDirectory);
            pDirectory = NULL;
        }
    }

    *phDirectory = (HANDLE)pDirectory;

    return dwError;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:47,代码来源:lwldap.c


示例13: LsaAdRemoveGroupByIdFromCache

LSASS_API
DWORD
LsaAdRemoveGroupByIdFromCache(
    IN HANDLE hLsaConnection,
    IN OPTIONAL PCSTR pszDomainName,
    IN gid_t  gid
    )
{
    DWORD dwError = 0;
    PSTR pszTargetProvider = NULL;

    if (geteuid() != 0)
    {
        dwError = LW_ERROR_ACCESS_DENIED;
        BAIL_ON_LSA_ERROR(dwError);
    }

    if (pszDomainName)
    {
        dwError = LwAllocateStringPrintf(
                      &pszTargetProvider,
                      "%s:%s",
                      LSA_PROVIDER_TAG_AD,
                      pszDomainName);
        BAIL_ON_LSA_ERROR(dwError);
    }

    dwError = LsaProviderIoControl(
                  hLsaConnection,
                  pszTargetProvider ? pszTargetProvider : LSA_PROVIDER_TAG_AD,
                  LSA_AD_IO_REMOVEGROUPBYIDCACHE,
                  sizeof(gid),
                  &gid,
                  NULL,
                  NULL);
    BAIL_ON_LSA_ERROR(dwError);

cleanup:

    LW_SAFE_FREE_STRING(pszTargetProvider);

    return dwError;

error:

    goto cleanup;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:47,代码来源:groups.c


示例14: LsaSrvLogProcessStoppedEvent

VOID
LsaSrvLogProcessStoppedEvent(
    DWORD dwExitCode
    )
{
    DWORD dwError = 0;
    PSTR pszDescription = NULL;
    PSTR pszData = NULL;

    dwError = LwAllocateStringPrintf(
                 &pszDescription,
                 "The authentication service was stopped");
    BAIL_ON_LSA_ERROR(dwError);

    dwError = LsaGetErrorMessageForLoggingEvent(
                         dwExitCode,
                         &pszData);
    BAIL_ON_LSA_ERROR(dwError);

    if (dwExitCode)
    {
        LsaSrvLogServiceFailureEvent(
                LSASS_EVENT_ERROR_SERVICE_STOPPED,
                SERVICE_EVENT_CATEGORY,
                pszDescription,
                pszData);
    }
    else
    {
        LsaSrvLogServiceSuccessEvent(
                LSASS_EVENT_INFO_SERVICE_STOPPED,
                SERVICE_EVENT_CATEGORY,
                pszDescription,
                pszData);
    }

cleanup:

    LW_SAFE_FREE_STRING(pszDescription);
    LW_SAFE_FREE_STRING(pszData);

    return;

error:

    goto cleanup;
}
开发者ID:virtual-void,项目名称:pbis,代码行数:47,代码来源:main-svcm.c


示例15: LwpsLegacySetJoinedDomainTrustEnumerationWaitTime

DWORD
LwpsLegacySetJoinedDomainTrustEnumerationWaitTime(
    IN PLWPS_LEGACY_STATE pContext,
    IN OPTIONAL PCSTR pszDomainName
    )
{
    DWORD dwError = 0;
    int EE = 0;
    PSTR pszRegistryPath = NULL;
    DWORD dwValue = 0;
    
    if (pszDomainName)
    {
        dwError = LwAllocateStringPrintf(
                  &pszRegistryPath,
                  "%s\\%s",
                  PSTOREDB_REGISTRY_AD_KEY,
                  pszDomainName);
        GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);
        dwError = RegUtilSetValue(
                      pContext->hReg,
                      HKEY_THIS_MACHINE,
                      pszRegistryPath,
                      NULL,
                      PSTOREDB_REGISTRY_TRUSTENUMERATIONWAIT_VALUE,
                      REG_DWORD,
                      (PVOID)&dwValue,
                      sizeof(dwValue));
        GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);
        dwError = RegUtilSetValue(
                      pContext->hReg,
                      HKEY_THIS_MACHINE,
                      pszRegistryPath,
                      NULL,
                      PSTOREDB_REGISTRY_TRUSTENUMERATIONWAITSECONDS_VALUE,
                      REG_DWORD,
                      (PVOID)&dwValue,
                      sizeof(dwValue));
        GOTO_CLEANUP_ON_WINERROR_EE(dwError, EE);

    }

cleanup:
    LSA_PSTORE_LOG_LEAVE_ERROR_EE(dwError, EE);
    return dwError;
}
开发者ID:borland667,项目名称:pbis,代码行数:46,代码来源:lsapstore-backend-legacy-internal.c


示例16: GetErrorMessage

static
DWORD
GetErrorMessage(
    DWORD dwErrCode,
    PSTR* ppszErrorMsg)
{
    DWORD dwError = 0;
    DWORD dwErrorBufferSize = 0;
    DWORD dwLen = 0;
    PSTR pszErrorMsg = NULL;
    PSTR pszErrorBuffer = NULL;

    dwErrorBufferSize = LwGetErrorString(dwErrCode, NULL, 0);

    if(!dwErrorBufferSize)
        goto cleanup;

    dwError = LwAllocateMemory(
                    dwErrorBufferSize,
                    OUT_PPVOID(&pszErrorBuffer));
    BAIL_ON_UP_ERROR(dwError);

    dwLen = LwGetErrorString(dwErrCode, pszErrorBuffer, dwErrorBufferSize);
    if ((dwLen == dwErrorBufferSize) && !LW_IS_NULL_OR_EMPTY_STR(pszErrorBuffer))
    {
        dwError = LwAllocateStringPrintf(
                    &pszErrorMsg,
                    "Error: %s [error code: %d]", pszErrorBuffer,
                    dwErrCode);
        BAIL_ON_UP_ERROR(dwError);
    }

    *ppszErrorMsg = pszErrorMsg;

cleanup:
    LW_SAFE_FREE_MEMORY(pszErrorBuffer);

    return dwError;

error:
    LW_SAFE_FREE_STRING(pszErrorMsg);

    *ppszErrorMsg = NULL;

    goto cleanup;
}
开发者ID:twistround,项目名称:pbis,代码行数:46,代码来源:conf2reg.c


示例17: EVTLogConfigReload

VOID
EVTLogConfigReload(
    VOID
    )
{
    DWORD dwError = 0;
    PSTR pszDescription = NULL;

    dwError = LwAllocateStringPrintf(
                 &pszDescription,
                 "     Current config settings are...\r\n" \
                 "     Max Disk Usage :                 %d\r\n" \
                 "     Max Number Of Events:            %d\r\n" \
                 "     Max Event Lifespan:              %d\r\n" \
                 "     Remove Events As Needed:         %s\r\n" \
                 "     Register TCP/IP RPC endpoints:   %s\r\n" \
                 "     Allow Read   To :                %s\r\n" \
                 "     Allow Write  To :                %s\r\n" \
                 "     Allow Delete To :                %s\r\n",
                 gServerInfo.dwMaxLogSize,
                 gServerInfo.dwMaxRecords,
                 gServerInfo.dwMaxAge,
                 gServerInfo.bRemoveAsNeeded? "true" : "false",
                 gServerInfo.bRegisterTcpIp ? "true" : "false",
                 gServerInfo.pszAllowReadTo ?
                    gServerInfo.pszAllowReadTo: "",
                 gServerInfo.pszAllowWriteTo ?
                    gServerInfo.pszAllowWriteTo: "",
                 gServerInfo.pszAllowDeleteTo ?
                    gServerInfo.pszAllowDeleteTo: "");

    BAIL_ON_EVT_ERROR(dwError);

    EVT_LOG_INFO("%s", pszDescription);

cleanup:

    LW_SAFE_FREE_STRING(pszDescription);

    return;

error:

    goto cleanup;
}
开发者ID:FarazShaikh,项目名称:likewise-open,代码行数:45,代码来源:main.c


示例18: LsaAdBatchMarshalUnprovisionedGroup

static
DWORD
LsaAdBatchMarshalUnprovisionedGroup(
    IN PAD_PROVIDER_DATA pProviderData,
    IN OUT PLSA_AD_BATCH_ITEM_GROUP_INFO pGroupInfo,
    IN PCSTR pszDnsDomainName,
    IN PCSTR pszNetbiosDomainName,
    IN PCSTR pszSamAccountName,
    IN PCSTR pszSid
    )
{
    DWORD dwError = 0;
    DWORD dwId = 0;
    PSTR pszNT4Name = NULL;

    dwError = LwAllocateStringPrintf(
                   &pszNT4Name,
                   "%s\\%s",
                   pszNetbiosDomainName,
                   pszSamAccountName);
    BAIL_ON_LSA_ERROR(dwError);

    // gid, alias
    dwError = ADUnprovPlugin_QueryByReal(
                   pProviderData,
                   FALSE,
                   pszNT4Name,
                   pszSid,
                   &pGroupInfo->pszAlias,
                   &dwId);
    BAIL_ON_LSA_ERROR(dwError);

    pGroupInfo->gid = (gid_t)dwId;

cleanup:
    LW_SAFE_FREE_STRING(pszNT4Name);
    return dwError;

error:
    goto cleanup;
}
开发者ID:borland667,项目名称:pbis,代码行数:41,代码来源:batch_marshal.c


示例19: LwGssGetErrorMessage

DWORD
LwGssGetErrorMessage(
    OUT PSTR* ppszErrorMessage,
    IN OPTIONAL PCSTR pszGssFunction,
    IN OM_uint32 MajorStatus,
    IN OM_uint32 MinorStatus
    )
{
    DWORD dwError = 0;
    PSTR pszErrorMessage = NULL;
    PSTR pszMajorMessage = NULL;
    PSTR pszMinorMessage = NULL;

    dwError = LwGssGetSingleErrorMessage(&pszMajorMessage, MajorStatus, TRUE);
    BAIL_ON_LW_ERROR(dwError);

    dwError = LwGssGetSingleErrorMessage(&pszMinorMessage, MinorStatus, FALSE);
    BAIL_ON_LW_ERROR(dwError);

    dwError = LwAllocateStringPrintf(&pszErrorMessage,
                                     "GSS API error calling %s(): "
                                     "majorStatus = 0x%08x (%s), "
                                     "minorStatus = 0x%08x (%s)",
                                     pszGssFunction,
                                     MajorStatus, pszMajorMessage,
                                     MinorStatus, pszMinorMessage);
    BAIL_ON_LW_ERROR(dwError);

error:
    if (dwError)
    {
        LW_SAFE_FREE_STRING(pszErrorMessage);
    }

    LW_SAFE_FREE_STRING(pszMajorMessage);
    LW_SAFE_FREE_STRING(pszMinorMessage);

    *ppszErrorMessage = pszErrorMessage;

    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:41,代码来源:lwkrb5.c


示例20: LsaSrvLogProcessFailureEvent

VOID
LsaSrvLogProcessFailureEvent(
    DWORD dwErrCode
    )
{
    DWORD dwError = 0;
    PSTR pszDescription = NULL;
    PSTR pszData = NULL;

    dwError = LwAllocateStringPrintf(
                 &pszDescription,
                 "The authentication service stopped running due to an error");
    BAIL_ON_LSA_ERROR(dwError);

    dwError = LsaGetErrorMessageForLoggingEvent(
                         dwErrCode,
                         &pszData);
    BAIL_ON_LSA_ERROR(dwError);

    LsaSrvLogServiceFailureEvent(
            LSASS_EVENT_ERROR_SERVICE_START_FAILURE,
            SERVICE_EVENT_CATEGORY,
            pszDescription,
            pszData);

cleanup:

    LW_SAFE_FREE_STRING(pszDescription);
    LW_SAFE_FREE_STRING(pszData);

    return;

error:

    goto cleanup;
}
开发者ID:virtual-void,项目名称:pbis,代码行数:36,代码来源:main-svcm.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LwFreeMemory函数代码示例发布时间:2022-05-30
下一篇:
C++ LwAllocateString函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap