diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h index 35545c6e5..30b6ebb62 100644 --- a/include/freerdp/freerdp.h +++ b/include/freerdp/freerdp.h @@ -767,6 +767,17 @@ owned by rdpRdp */ FREERDP_API SECURITY_STATUS freerdp_nla_QueryContextAttributes(rdpContext* context, DWORD ulAttr, PVOID pBuffer); + /** Calls FreeContextbuffer on the SSPI context associated with the NLA part of the RDP context + * + * \param context the RDP context + * \param pBuffer an opaque pointer to free + * \returns a SECURITY_STATUS indicating if the operation completed successfully + * \since version 3.22.0 + * + * Supported buffers are ones retrieved from SECPKG_ATTR_PACKAGE_INFO. + */ + FREERDP_API SECURITY_STATUS freerdp_nla_FreeContextBuffer(rdpContext* context, PVOID pBuffer); + FREERDP_API void clearChannelError(rdpContext* context); FREERDP_API HANDLE getChannelErrorEventHandle(rdpContext* context); FREERDP_API UINT getChannelError(const rdpContext* context); diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index 696bb8666..02d8d33aa 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -1349,6 +1349,20 @@ SECURITY_STATUS freerdp_nla_QueryContextAttributes(rdpContext* context, DWORD ul return nla_QueryContextAttributes(nla, ulAttr, pBuffer); } +SECURITY_STATUS freerdp_nla_FreeContextBuffer(rdpContext* context, PVOID pBuffer) +{ + WINPR_ASSERT(context); + WINPR_ASSERT(context->rdp); + + rdpNla* nla = context->rdp->nla; + if (!nla) + nla = transport_get_nla(context->rdp->transport); + + WINPR_ASSERT(nla); + + return nla_FreeContextBuffer(nla, pBuffer); +} + HANDLE getChannelErrorEventHandle(rdpContext* context) { WINPR_ASSERT(context); diff --git a/libfreerdp/core/nla.c b/libfreerdp/core/nla.c index 95e71bc4d..f768f88b0 100644 --- a/libfreerdp/core/nla.c +++ b/libfreerdp/core/nla.c @@ -2455,3 +2455,14 @@ SECURITY_STATUS nla_QueryContextAttributes(rdpNla* nla, DWORD ulAttr, PVOID pBuf return table->QueryContextAttributes(&context, ulAttr, pBuffer); } + +SECURITY_STATUS nla_FreeContextBuffer(rdpNla* nla, PVOID pBuffer) +{ + WINPR_ASSERT(nla); + + SecurityFunctionTable* table = NULL; + CtxtHandle context = { 0 }; + credssp_auth_tableAndContext(nla->auth, &table, &context); + + return table->FreeContextBuffer(pBuffer); +} diff --git a/libfreerdp/core/nla.h b/libfreerdp/core/nla.h index cfd758d29..e5a4541ba 100644 --- a/libfreerdp/core/nla.h +++ b/libfreerdp/core/nla.h @@ -78,5 +78,6 @@ FREERDP_LOCAL void nla_set_early_user_auth(rdpNla* nla, BOOL earlyUserAuth); FREERDP_LOCAL BOOL nla_encrypt(rdpNla* nla, const SecBuffer* inBuffer, SecBuffer* outBuffer); FREERDP_LOCAL BOOL nla_decrypt(rdpNla* nla, const SecBuffer* inBuffer, SecBuffer* outBuffer); FREERDP_LOCAL SECURITY_STATUS nla_QueryContextAttributes(rdpNla* nla, DWORD ulAttr, PVOID pBuffer); +FREERDP_LOCAL SECURITY_STATUS nla_FreeContextBuffer(rdpNla* nla, PVOID pBuffer); #endif /* FREERDP_LIB_CORE_NLA_H */