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


C++ GetSecurityStatusString函数代码示例

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


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

示例1: ntlm_client_init

BOOL ntlm_client_init(rdpNtlm* ntlm, BOOL http, LPCTSTR user, LPCTSTR domain, LPCTSTR password,
                      SecPkgContext_Bindings* Bindings)
{
	SECURITY_STATUS status;
	ntlm->http = http;
	ntlm->Bindings = Bindings;
	ntlm->table = InitSecurityInterfaceEx(0);

	if (!ntlm->table)
		return FALSE;

	sspi_SetAuthIdentity(&(ntlm->identity), user, domain, password);
	status = ntlm->table->QuerySecurityPackageInfo(NTLM_SSP_NAME, &ntlm->pPackageInfo);

	if (status != SEC_E_OK)
	{
		WLog_ERR(TAG, "QuerySecurityPackageInfo status %s [0x%08"PRIX32"]",
		         GetSecurityStatusString(status), status);
		return FALSE;
	}

	ntlm->cbMaxToken = ntlm->pPackageInfo->cbMaxToken;
	status = ntlm->table->AcquireCredentialsHandle(NULL, NTLM_SSP_NAME,
	         SECPKG_CRED_OUTBOUND, NULL, &ntlm->identity, NULL, NULL,
	         &ntlm->credentials, &ntlm->expiration);

	if (status != SEC_E_OK)
	{
		WLog_ERR(TAG, "AcquireCredentialsHandle status %s [0x%08"PRIX32"]",
		         GetSecurityStatusString(status), status);
		return FALSE;
	}

	ntlm->haveContext = FALSE;
	ntlm->haveInputBuffer = FALSE;
	ZeroMemory(&ntlm->inputBuffer, sizeof(SecBuffer));
	ZeroMemory(&ntlm->outputBuffer, sizeof(SecBuffer));
	ZeroMemory(&ntlm->ContextSizes, sizeof(SecPkgContext_Sizes));
	ntlm->fContextReq = 0;

	if (ntlm->http)
	{
		/* flags for HTTP authentication */
		ntlm->fContextReq |= ISC_REQ_CONFIDENTIALITY;
	}
	else
	{
		/**
		* flags for RPC authentication:
		* RPC_C_AUTHN_LEVEL_PKT_INTEGRITY:
		* ISC_REQ_USE_DCE_STYLE | ISC_REQ_DELEGATE | ISC_REQ_MUTUAL_AUTH |
		* ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT
		*/
		ntlm->fContextReq |= ISC_REQ_USE_DCE_STYLE;
		ntlm->fContextReq |= ISC_REQ_DELEGATE | ISC_REQ_MUTUAL_AUTH;
		ntlm->fContextReq |= ISC_REQ_REPLAY_DETECT | ISC_REQ_SEQUENCE_DETECT;
	}

	return TRUE;
}
开发者ID:Devolutions,项目名称:FreeRDP,代码行数:60,代码来源:ntlm.c

示例2: winpr_ExportSecurityContext

static SECURITY_STATUS SEC_ENTRY winpr_ExportSecurityContext(PCtxtHandle phContext, ULONG fFlags,
        PSecBuffer pPackedContext, HANDLE* pToken)
{
	SEC_CHAR* Name;
	SECURITY_STATUS status;
	SecurityFunctionTableW* table;
	Name = (SEC_CHAR*) sspi_SecureHandleGetUpperPointer(phContext);

	if (!Name)
		return SEC_E_SECPKG_NOT_FOUND;

	table = sspi_GetSecurityFunctionTableWByNameA(Name);

	if (!table)
		return SEC_E_SECPKG_NOT_FOUND;

	if (!table->ExportSecurityContext)
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = table->ExportSecurityContext(phContext, fFlags, pPackedContext, pToken);

	if (IsSecurityStatusError(status))
	{
		WLog_WARN(TAG, "ExportSecurityContext status %s [0x%08"PRIX32"]",
		          GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:29,代码来源:sspi_winpr.c

示例3: negotiate_AcceptSecurityContext

SECURITY_STATUS SEC_ENTRY negotiate_AcceptSecurityContext(PCredHandle phCredential,
        PCtxtHandle phContext,
        PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext,
        PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsTimeStamp)
{
	SECURITY_STATUS status;
	NEGOTIATE_CONTEXT* context;
	context = (NEGOTIATE_CONTEXT*) sspi_SecureHandleGetLowerPointer(phContext);

	if (!context)
	{
		context = negotiate_ContextNew();

		if (!context)
			return SEC_E_INTERNAL_ERROR;

		sspi_SecureHandleSetLowerPointer(phNewContext, context);
		sspi_SecureHandleSetUpperPointer(phNewContext, (void*) NEGO_SSP_NAME);
	}

	negotiate_SetSubPackage(context,
	                        (const char*) NTLM_SSP_NAME); /* server-side Kerberos not yet implemented */
	status = context->sspiA->AcceptSecurityContext(phCredential, &(context->SubContext),
	         pInput, fContextReq, TargetDataRep, &(context->SubContext),
	         pOutput, pfContextAttr, ptsTimeStamp);

	if (status != SEC_E_OK)
	{
		WLog_WARN(TAG, "AcceptSecurityContext status %s [0x%08"PRIX32"]",
		          GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:34,代码来源:negotiate.c

示例4: sspi_gss_init_sec_context

UINT32 SSPI_GSSAPI sspi_gss_init_sec_context(
    UINT32* minor_status,
    sspi_gss_cred_id_t claimant_cred_handle,
    sspi_gss_ctx_id_t* context_handle,
    sspi_gss_name_t target_name,
    sspi_gss_OID mech_type,
    UINT32 req_flags,
    UINT32 time_req,
    sspi_gss_channel_bindings_t input_chan_bindings,
    sspi_gss_buffer_t input_token,
    sspi_gss_OID* actual_mech_type,
    sspi_gss_buffer_t output_token,
    UINT32* ret_flags,
    UINT32* time_rec)
{
	SECURITY_STATUS status;
	InitOnceExecuteOnce(&g_Initialized, sspi_GssApiInit, NULL, NULL);

	if (!(g_GssApi && g_GssApi->gss_init_sec_context))
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = g_GssApi->gss_init_sec_context(minor_status, claimant_cred_handle, context_handle,
	                                        target_name, mech_type, req_flags, time_req, input_chan_bindings,
	                                        input_token, actual_mech_type, output_token, ret_flags, time_rec);
	WLog_DBG(TAG, "gss_init_sec_context: %s (0x%08"PRIX32")",
	         GetSecurityStatusString(status), status);
	return status;
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:28,代码来源:sspi_gss.c

示例5: winpr_ImportSecurityContextA

static SECURITY_STATUS SEC_ENTRY winpr_ImportSecurityContextA(SEC_CHAR* pszPackage,
        PSecBuffer pPackedContext, HANDLE pToken, PCtxtHandle phContext)
{
	char* Name = NULL;
	SECURITY_STATUS status;
	SecurityFunctionTableA* table;
	Name = (char*) sspi_SecureHandleGetUpperPointer(phContext);

	if (!Name)
		return SEC_E_SECPKG_NOT_FOUND;

	table = sspi_GetSecurityFunctionTableAByNameA(Name);

	if (!table)
		return SEC_E_SECPKG_NOT_FOUND;

	if (!table->ImportSecurityContextA)
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = table->ImportSecurityContextA(pszPackage, pPackedContext, pToken, phContext);

	if (IsSecurityStatusError(status))
	{
		WLog_WARN(TAG, "ImportSecurityContextA status %s [0x%08"PRIX32"]",
		          GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:29,代码来源:sspi_winpr.c

示例6: winpr_AcquireCredentialsHandleA

static SECURITY_STATUS SEC_ENTRY winpr_AcquireCredentialsHandleA(SEC_CHAR* pszPrincipal,
        SEC_CHAR* pszPackage,
        ULONG fCredentialUse, void* pvLogonID, void* pAuthData, SEC_GET_KEY_FN pGetKeyFn,
        void* pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
{
	SECURITY_STATUS status;
	SecurityFunctionTableA* table = sspi_GetSecurityFunctionTableAByNameA(pszPackage);

	if (!table)
		return SEC_E_SECPKG_NOT_FOUND;

	if (!table->AcquireCredentialsHandleA)
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = table->AcquireCredentialsHandleA(pszPrincipal, pszPackage, fCredentialUse,
	         pvLogonID, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential, ptsExpiry);

	if (IsSecurityStatusError(status))
	{
		WLog_WARN(TAG, "AcquireCredentialsHandleA status %s [0x%08"PRIX32"]",
		          GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:25,代码来源:sspi_winpr.c

示例7: sspi_gss_accept_sec_context

UINT32 SSPI_GSSAPI sspi_gss_accept_sec_context(
    UINT32* minor_status,
    sspi_gss_ctx_id_t* context_handle,
    sspi_gss_cred_id_t acceptor_cred_handle,
    sspi_gss_buffer_t input_token_buffer,
    sspi_gss_channel_bindings_t input_chan_bindings,
    sspi_gss_name_t* src_name,
    sspi_gss_OID* mech_type,
    sspi_gss_buffer_t output_token,
    UINT32* ret_flags,
    UINT32* time_rec,
    sspi_gss_cred_id_t* delegated_cred_handle)
{
	SECURITY_STATUS status;
	InitOnceExecuteOnce(&g_Initialized, sspi_GssApiInit, NULL, NULL);

	if (!(g_GssApi && g_GssApi->gss_accept_sec_context))
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = g_GssApi->gss_accept_sec_context(minor_status, context_handle, acceptor_cred_handle,
	         input_token_buffer, input_chan_bindings, src_name, mech_type, output_token,
	         ret_flags, time_rec, delegated_cred_handle);
	WLog_DBG(TAG, "gss_accept_sec_context: %s (0x%08"PRIX32")",
	         GetSecurityStatusString(status), status);
	return status;
}
开发者ID:99455125,项目名称:FreeRDP,代码行数:26,代码来源:sspi_gss.c

示例8: winpr_EncryptMessage

static SECURITY_STATUS SEC_ENTRY winpr_EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
        PSecBufferDesc pMessage, ULONG MessageSeqNo)
{
	char* Name;
	SECURITY_STATUS status;
	SecurityFunctionTableA* table;
	Name = (char*) sspi_SecureHandleGetUpperPointer(phContext);

	if (!Name)
		return SEC_E_SECPKG_NOT_FOUND;

	table = sspi_GetSecurityFunctionTableAByNameA(Name);

	if (!table)
		return SEC_E_SECPKG_NOT_FOUND;

	if (!table->EncryptMessage)
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = table->EncryptMessage(phContext, fQOP, pMessage, MessageSeqNo);

	if (status != SEC_E_OK)
	{
		WLog_ERR(TAG, "EncryptMessage status %s [0x%08"PRIX32"]",
		         GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:29,代码来源:sspi_winpr.c

示例9: winpr_VerifySignature

static SECURITY_STATUS SEC_ENTRY winpr_VerifySignature(PCtxtHandle phContext,
        PSecBufferDesc pMessage,
        ULONG MessageSeqNo, PULONG pfQOP)
{
	char* Name;
	SECURITY_STATUS status;
	SecurityFunctionTableA* table;
	Name = (char*) sspi_SecureHandleGetUpperPointer(phContext);

	if (!Name)
		return SEC_E_SECPKG_NOT_FOUND;

	table = sspi_GetSecurityFunctionTableAByNameA(Name);

	if (!table)
		return SEC_E_SECPKG_NOT_FOUND;

	if (!table->VerifySignature)
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = table->VerifySignature(phContext, pMessage, MessageSeqNo, pfQOP);

	if (IsSecurityStatusError(status))
	{
		WLog_WARN(TAG, "VerifySignature status %s [0x%08"PRIX32"]",
		          GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:30,代码来源:sspi_winpr.c

示例10: winpr_InitializeSecurityContextA

static SECURITY_STATUS SEC_ENTRY winpr_InitializeSecurityContextA(PCredHandle phCredential,
        PCtxtHandle phContext,
        SEC_CHAR* pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep,
        PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext,
        PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
{
	SEC_CHAR* Name;
	SECURITY_STATUS status;
	SecurityFunctionTableA* table;
	Name = (SEC_CHAR*) sspi_SecureHandleGetUpperPointer(phCredential);

	if (!Name)
		return SEC_E_SECPKG_NOT_FOUND;

	table = sspi_GetSecurityFunctionTableAByNameA(Name);

	if (!table)
		return SEC_E_SECPKG_NOT_FOUND;

	if (!table->InitializeSecurityContextA)
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = table->InitializeSecurityContextA(phCredential, phContext,
	         pszTargetName, fContextReq, Reserved1, TargetDataRep,
	         pInput, Reserved2, phNewContext, pOutput, pfContextAttr, ptsExpiry);

	if (IsSecurityStatusError(status))
	{
		WLog_WARN(TAG, "InitializeSecurityContextA status %s [0x%08"PRIX32"]",
		          GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:34,代码来源:sspi_winpr.c

示例11: winpr_SetContextAttributesW

static SECURITY_STATUS SEC_ENTRY winpr_SetContextAttributesW(PCtxtHandle phContext,
        ULONG ulAttribute,
        void* pBuffer, ULONG cbBuffer)
{
	SEC_CHAR* Name;
	SECURITY_STATUS status;
	SecurityFunctionTableW* table;
	Name = (SEC_CHAR*) sspi_SecureHandleGetUpperPointer(phContext);

	if (!Name)
		return SEC_E_SECPKG_NOT_FOUND;

	table = sspi_GetSecurityFunctionTableWByNameA(Name);

	if (!table)
		return SEC_E_SECPKG_NOT_FOUND;

	if (!table->SetContextAttributesW)
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = table->SetContextAttributesW(phContext, ulAttribute, pBuffer, cbBuffer);

	if (IsSecurityStatusError(status))
	{
		WLog_WARN(TAG, "SetContextAttributesW status %s [0x%08"PRIX32"]",
		          GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:30,代码来源:sspi_winpr.c

示例12: winpr_CompleteAuthToken

static SECURITY_STATUS SEC_ENTRY winpr_CompleteAuthToken(PCtxtHandle phContext,
        PSecBufferDesc pToken)
{
	char* Name = NULL;
	SECURITY_STATUS status;
	SecurityFunctionTableA* table;
	Name = (char*) sspi_SecureHandleGetUpperPointer(phContext);

	if (!Name)
		return SEC_E_SECPKG_NOT_FOUND;

	table = sspi_GetSecurityFunctionTableAByNameA(Name);

	if (!table)
		return SEC_E_SECPKG_NOT_FOUND;

	if (!table->CompleteAuthToken)
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = table->CompleteAuthToken(phContext, pToken);

	if (IsSecurityStatusError(status))
	{
		WLog_WARN(TAG, "CompleteAuthToken status %s [0x%08"PRIX32"]",
		          GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:29,代码来源:sspi_winpr.c

示例13: winpr_ImpersonateSecurityContext

static SECURITY_STATUS SEC_ENTRY winpr_ImpersonateSecurityContext(PCtxtHandle phContext)
{
	SEC_CHAR* Name;
	SECURITY_STATUS status;
	SecurityFunctionTableW* table;
	Name = (SEC_CHAR*) sspi_SecureHandleGetUpperPointer(phContext);

	if (!Name)
		return SEC_E_SECPKG_NOT_FOUND;

	table = sspi_GetSecurityFunctionTableWByNameA(Name);

	if (!table)
		return SEC_E_SECPKG_NOT_FOUND;

	if (!table->ImpersonateSecurityContext)
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = table->ImpersonateSecurityContext(phContext);

	if (IsSecurityStatusError(status))
	{
		WLog_WARN(TAG, "ImpersonateSecurityContext status %s [0x%08"PRIX32"]",
		          GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:28,代码来源:sspi_winpr.c

示例14: winpr_AcceptSecurityContext

static SECURITY_STATUS SEC_ENTRY winpr_AcceptSecurityContext(PCredHandle phCredential,
        PCtxtHandle phContext,
        PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext,
        PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsTimeStamp)
{
	char* Name;
	SECURITY_STATUS status;
	SecurityFunctionTableA* table;
	Name = (char*) sspi_SecureHandleGetUpperPointer(phCredential);

	if (!Name)
		return SEC_E_SECPKG_NOT_FOUND;

	table = sspi_GetSecurityFunctionTableAByNameA(Name);

	if (!table)
		return SEC_E_SECPKG_NOT_FOUND;

	if (!table->AcceptSecurityContext)
		return SEC_E_UNSUPPORTED_FUNCTION;

	status = table->AcceptSecurityContext(phCredential, phContext, pInput, fContextReq,
	                                      TargetDataRep, phNewContext, pOutput, pfContextAttr, ptsTimeStamp);

	if (IsSecurityStatusError(status))
	{
		WLog_WARN(TAG, "AcceptSecurityContext status %s [0x%08"PRIX32"]",
		          GetSecurityStatusString(status), status);
	}

	return status;
}
开发者ID:FreeRDP,项目名称:FreeRDP,代码行数:32,代码来源:sspi_winpr.c

示例15: negotiate_AcceptSecurityContext

SECURITY_STATUS SEC_ENTRY negotiate_AcceptSecurityContext(PCredHandle phCredential, PCtxtHandle phContext,
							  PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext,
							  PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsTimeStamp)
{
	SECURITY_STATUS status;
	NEGOTIATE_CONTEXT* context;

	context = (NEGOTIATE_CONTEXT*) sspi_SecureHandleGetLowerPointer(phContext);

	if (!context)
	{
		context = negotiate_ContextNew();

		if (!context)
			return SEC_E_INTERNAL_ERROR;

		sspi_SecureHandleSetLowerPointer(phNewContext, context);
		sspi_SecureHandleSetUpperPointer(phNewContext, (void*) NEGOTIATE_PACKAGE_NAME);
	}

	status = context->sspiA->AcceptSecurityContext(phCredential, &(context->SubContext),
						       pInput, fContextReq, TargetDataRep, &(context->SubContext),
						       pOutput, pfContextAttr, ptsTimeStamp);

	if (status != SEC_E_OK)
	{
		WLog_WARN(TAG, "AcceptSecurityContext status %s [%08X]",
			  GetSecurityStatusString(status), status);
	}
	return status;
}
开发者ID:BrianChangchien,项目名称:FiWoRDC,代码行数:31,代码来源:negotiate.c


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