本文整理汇总了C++中LW_SAFE_FREE_MEMORY函数的典型用法代码示例。如果您正苦于以下问题:C++ LW_SAFE_FREE_MEMORY函数的具体用法?C++ LW_SAFE_FREE_MEMORY怎么用?C++ LW_SAFE_FREE_MEMORY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LW_SAFE_FREE_MEMORY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LsaInitBindingDefault
NTSTATUS
LsaInitBindingDefault(
OUT PLSA_BINDING phBinding,
IN PCWSTR pwszHostname,
IN PIO_CREDS pCreds
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
DWORD dwError = ERROR_SUCCESS;
PSTR pszHostname = NULL;
if (pwszHostname)
{
dwError = LwWc16sToMbs(pwszHostname, &pszHostname);
BAIL_ON_WIN_ERROR(dwError);
}
ntStatus = LsaInitBindingDefaultA(phBinding,
pszHostname,
pCreds);
BAIL_ON_NT_STATUS(ntStatus);
cleanup:
LW_SAFE_FREE_MEMORY(pszHostname);
return ntStatus;
error:
goto cleanup;
}
示例2: LsaNssClearState
void
LsaNssClearState(
PVOID pState
)
{
PLSA_NSS_STATE pNssState = (PLSA_NSS_STATE)pState;
LSA_LOG_PAM_DEBUG("Clearing LAM state");
if (pNssState != NULL)
{
LW_SAFE_FREE_MEMORY(pNssState->pLastGroup);
LW_SAFE_FREE_MEMORY(pNssState->pLastUser);
LW_SAFE_FREE_STRING(pNssState->pszRegistryName);
}
}
示例3: LsaNssFreeLastGroup
void
LsaNssFreeLastGroup(
VOID
)
{
LW_SAFE_FREE_MEMORY(gNssState.pLastGroup);
}
示例4: LsaUnjoinDomain
static
DWORD
LsaUnjoinDomain(
IN PCWSTR pwszDnsDomainName,
IN PCWSTR pwszMachineSamAccountName,
IN OPTIONAL PCWSTR pwszUserName,
IN OPTIONAL PCWSTR pwszUserDomain,
IN OPTIONAL PCWSTR pwszUserPassword,
IN DWORD dwUnjoinFlags
)
{
DWORD dwError = ERROR_SUCCESS;
NTSTATUS ntStatus = STATUS_SUCCESS;
PWSTR pwszDCName = NULL;
PIO_CREDS pCreds = NULL;
dwError = LsaGetRwDcName(pwszDnsDomainName,
FALSE,
&pwszDCName);
BAIL_ON_LSA_ERROR(dwError);
/* disable the account only if requested */
if (dwUnjoinFlags & LSAJOIN_ACCT_DELETE)
{
if (pwszUserName && pwszUserPassword)
{
ntStatus = LwIoCreatePlainCredsW(pwszUserName,
pwszUserDomain,
pwszUserPassword,
&pCreds);
dwError = LwNtStatusToWin32Error(ntStatus);
BAIL_ON_LSA_ERROR(dwError);
}
else
{
ntStatus = LwIoGetActiveCreds(NULL,
&pCreds);
dwError = LwNtStatusToWin32Error(ntStatus);
BAIL_ON_LSA_ERROR(dwError);
}
ntStatus = LsaDisableMachineAccount(pwszDCName,
pCreds,
pwszMachineSamAccountName);
dwError = LwNtStatusToWin32Error(ntStatus);
BAIL_ON_LSA_ERROR(dwError);
}
error:
LSA_ASSERT(!ntStatus || dwError);
LW_SAFE_FREE_MEMORY(pwszDCName);
if (pCreds)
{
LwIoDeleteCreds(pCreds);
}
return dwError;
}
示例5: LwSmFreeLogTarget
VOID
LwSmFreeLogTarget(
PSTR pszTarget
)
{
LW_SAFE_FREE_MEMORY(pszTarget);
}
示例6: LsaFreeStatus
VOID
LsaFreeStatus(
PLSASTATUS pLsaStatus
)
{
DWORD iCount = 0;
for (iCount = 0; iCount < pLsaStatus->dwCount; iCount++)
{
PLSA_AUTH_PROVIDER_STATUS pStatus =
&pLsaStatus->pAuthProviderStatusList[iCount];
LW_SAFE_FREE_STRING(pStatus->pszId);
LW_SAFE_FREE_STRING(pStatus->pszDomain);
LW_SAFE_FREE_STRING(pStatus->pszForest);
LW_SAFE_FREE_STRING(pStatus->pszSite);
LW_SAFE_FREE_STRING(pStatus->pszCell);
if (pStatus->pTrustedDomainInfoArray)
{
LsaFreeDomainInfoArray(
pStatus->dwNumTrustedDomains,
pStatus->pTrustedDomainInfoArray);
}
}
LW_SAFE_FREE_MEMORY(pLsaStatus->pAuthProviderStatusList);
LwFreeMemory(pLsaStatus);
}
示例7: ADCacheSafeFreeGroupMembership
void
ADCacheSafeFreeGroupMembership(
PLSA_GROUP_MEMBERSHIP* ppMembership)
{
ADCacheFreeGroupMembershipContents(*ppMembership);
LW_SAFE_FREE_MEMORY(*ppMembership);
}
示例8: AuthorizationPluginCreate
extern OSStatus
AuthorizationPluginCreate(
const AuthorizationCallbacks *pAuthCallbacks,
AuthorizationPluginRef *ppPlugin,
const AuthorizationPluginInterface **ppPluginInterface
)
{
LW_AUTH_PLUGIN *pPlugin = NULL;
OSStatus osStatus = noErr;
DWORD dwError = LW_ERROR_SUCCESS;
LwRtlLogSetCallback(LogCallback, NULL);
dwError = AUTH_PLUGIN_ALLOCATE(pPlugin);
BAIL_ON_LSA_ERROR(dwError);
pPlugin->pAuthCallbacks = pAuthCallbacks;
*ppPlugin = pPlugin;
*ppPluginInterface = &gPluginInterface;
cleanup:
return osStatus;
error:
LW_SAFE_FREE_MEMORY(pPlugin);
/*
* The documentation says all errors should return
* errAuthorizationInternal.
*/
osStatus = errAuthorizationInternal;
goto cleanup;
}
示例9: Del
static
DWORD
Del(
int argc,
char** ppszArgv
)
{
DWORD dwError = 0;
PWSTR pwszShareName = NULL;
dwError = LwMbsToWc16s(ppszArgv[1], &pwszShareName);
BAIL_ON_SRVSVC_ERROR(dwError);
dwError = NetShareDel(
gState.pwszServerName,
pwszShareName,
0);
BAIL_ON_SRVSVC_ERROR(dwError);
cleanup:
LW_SAFE_FREE_MEMORY(pwszShareName);
return dwError;
error:
goto cleanup;
}
示例10: LwSmQueryServiceDependencyClosureHelper
static
DWORD
LwSmQueryServiceDependencyClosureHelper(
LW_SERVICE_HANDLE hHandle,
PWSTR** pppwszServiceList
)
{
DWORD dwError = 0;
PLW_SERVICE_INFO pInfo = NULL;
LW_SERVICE_HANDLE hDepHandle = NULL;
PWSTR pwszDepName = NULL;
size_t i = 0;
dwError = LwSmQueryServiceInfo(hHandle, &pInfo);
BAIL_ON_ERROR(dwError);
for (i = 0; pInfo->ppwszDependencies[i]; i++)
{
dwError = LwSmAcquireServiceHandle(pInfo->ppwszDependencies[i], &hDepHandle);
BAIL_ON_ERROR(dwError);
dwError = LwSmQueryServiceDependencyClosureHelper(hDepHandle, pppwszServiceList);
BAIL_ON_ERROR(dwError);
if (!LwSmStringListContains(*pppwszServiceList, pInfo->ppwszDependencies[i]))
{
dwError = LwAllocateWc16String(&pwszDepName, pInfo->ppwszDependencies[i]);
BAIL_ON_ERROR(dwError);
dwError = LwSmStringListAppend(pppwszServiceList, pwszDepName);
BAIL_ON_ERROR(dwError);
pwszDepName = NULL;
}
LwSmReleaseServiceHandle(hDepHandle);
hDepHandle = NULL;
}
cleanup:
LW_SAFE_FREE_MEMORY(pwszDepName);
if (pInfo)
{
LwSmCommonFreeServiceInfo(pInfo);
}
if (hDepHandle)
{
LwSmReleaseServiceHandle(hDepHandle);
}
return dwError;
error:
goto cleanup;
}
示例11: AuthPluginDestroy
static OSStatus
AuthPluginDestroy(
IN AuthorizationPluginRef pPluginRef
)
{
LW_SAFE_FREE_MEMORY(pPluginRef);
return noErr;
}
示例12: AdtNetUserDelete
/**
* Delete AD user.
*
* @param appContext Application context reference.
* @param userNameC User name.
* @return 0 on success; error code on failure.
*/
DWORD
AdtNetUserDelete(
IN AppContextTP appContext,
IN PSTR userNameC
)
{
DWORD dwError = ERROR_SUCCESS;
PWSTR hostName = NULL;
PWSTR userName = NULL;
PSTR userNameN = NULL;
dwError = NormalizeUserName(userNameC, appContext->workConn->domainName, &userNameN);
ADT_BAIL_ON_ERROR_NP(dwError);
dwError = LwMbsToWc16s((PCSTR) (appContext->workConn->serverName), &hostName);
ADT_BAIL_ON_ALLOC_FAILURE_NP(!dwError);
dwError = LwMbsToWc16s((PCSTR) userNameN, &userName);
ADT_BAIL_ON_ALLOC_FAILURE_NP(!dwError);
PrintStderr(appContext, LogLevelTrace, "%s: Deleting user %s ...\n",
appContext->actionName, userNameN);
/* Perform the delete operation. */
if(!appContext->gopts.isReadOnly) {
dwError = NetUserDel((PCWSTR) hostName, (PCWSTR) userName);
}
if (dwError) {
dwError += ADT_WIN_ERR_BASE;
ADT_BAIL_ON_ERROR_NP(dwError);
}
PrintStderr(appContext, LogLevelTrace, "%s: Done deleting user %s\n",
appContext->actionName, userNameN);
cleanup:
LW_SAFE_FREE_MEMORY(hostName);
LW_SAFE_FREE_MEMORY(userName);
LW_SAFE_FREE_MEMORY(userNameN);
return dwError;
error:
goto cleanup;
}
示例13: LsaSrvQueryAccountSecurity
static
NTSTATUS
LsaSrvQueryAccountSecurity(
PLSAR_ACCOUNT_CONTEXT pAccountContext,
SECURITY_INFORMATION SecurityInformation,
PSECURITY_DESCRIPTOR_RELATIVE *ppSecurityDescRelative,
PDWORD pSecurityDescRelativeSize
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
DWORD err = ERROR_SUCCESS;
PSECURITY_DESCRIPTOR_RELATIVE pSecDescRelative = NULL;
DWORD secDescRelativeSize = 0;
PSECURITY_DESCRIPTOR_RELATIVE pSecurityDescRelative = NULL;
err = LsaSrvPrivsGetAccountSecurity(
NULL,
pAccountContext->pPolicyCtx->pUserToken,
pAccountContext->pAccountContext,
SecurityInformation,
&pSecDescRelative,
&secDescRelativeSize);
BAIL_ON_LSA_ERROR(err);
ntStatus = LsaSrvAllocateMemory(
OUT_PPVOID(&pSecurityDescRelative),
secDescRelativeSize);
BAIL_ON_NT_STATUS(ntStatus);
memcpy(pSecurityDescRelative,
pSecDescRelative,
secDescRelativeSize);
*ppSecurityDescRelative = pSecurityDescRelative;
*pSecurityDescRelativeSize = secDescRelativeSize;
error:
if (err || ntStatus)
{
if (pSecurityDescRelative)
{
LsaSrvFreeMemory(pSecurityDescRelative);
}
*ppSecurityDescRelative = NULL;
*pSecurityDescRelativeSize = 0;
}
LW_SAFE_FREE_MEMORY(pSecDescRelative);
if (ntStatus == STATUS_SUCCESS &&
err != ERROR_SUCCESS)
{
ntStatus = LwWin32ErrorToNtStatus(err);
}
return ntStatus;
}
示例14: 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;
}
示例15: AdtNetGroupAdd
/**
* Add AD local group with default properties.
*
* @param appContext Application context reference.
* @param aliasNameC Group name.
* @return 0 on success; error code on failure.
*/
DWORD
AdtNetGroupAdd(
IN AppContextTP appContext,
IN PSTR aliasNameC
)
{
DWORD dwError = ERROR_SUCCESS;
LOCALGROUP_INFO_0 Info = { 0 };
DWORD parmError = 0;
PWSTR hostName = NULL;
PWSTR aliasName = NULL;
dwError = LwMbsToWc16s((PCSTR) (appContext->workConn->serverName), &hostName);
ADT_BAIL_ON_ALLOC_FAILURE_NP(!dwError);
dwError = LwMbsToWc16s((PCSTR) aliasNameC, &aliasName);
ADT_BAIL_ON_ALLOC_FAILURE_NP(!dwError);
Info.lgrpi0_name = aliasName;
PrintStderr(appContext, LogLevelTrace, "%s: Adding group %s ...\n",
appContext->actionName, aliasNameC);
/* Perform the delete operation. */
if(!appContext->gopts.isReadOnly) {
dwError = NetLocalGroupAdd((PCWSTR) hostName, 0, (PVOID) &Info, &parmError);
}
if (dwError) {
dwError += ADT_WIN_ERR_BASE;
ADT_BAIL_ON_ERROR_NP(dwError);
}
PrintStderr(appContext, LogLevelTrace, "%s: Done adding group %s\n",
appContext->actionName, aliasNameC);
cleanup:
LW_SAFE_FREE_MEMORY(hostName);
LW_SAFE_FREE_MEMORY(aliasName);
return dwError;
error:
goto cleanup;
}