[+] STATUS_ACCESS_DENIED error enum in AuNetError.cpp (required for filtered connects given the overlappeds internal field that uses the nt status codes)

[*] fixed: TLS now properly sends the encrypted frame down to the next piece instead of directly to the drain
This commit is contained in:
Reece Wilson 2022-10-01 01:07:26 +01:00
parent 4671664396
commit 051db40a1c
3 changed files with 29 additions and 1 deletions

View File

@ -9,6 +9,16 @@
#include "Networking.hpp"
#include "AuNetError.hpp"
#if defined(AURORA_IS_MODERNNT_DERIVED)
#if !defined(STATUS_BUFFER_TOO_SMALL)
#define STATUS_BUFFER_TOO_SMALL ((AuUInt) 0xc0000023)
#endif
#if !defined(STATUS_ACCESS_DENIED)
#define STATUS_ACCESS_DENIED ((AuUInt) 0xc0000022)
#endif
#endif
namespace Aurora::IO::Net
{
void NetError_SetCurrent(NetError &error)
@ -43,6 +53,7 @@ namespace Aurora::IO::Net
break;
case WSAEMSGSIZE:
case WSAENOBUFS:
case (AuUInt)STATUS_BUFFER_TOO_SMALL:
error.netError = ENetworkError::eSocketBufferOverflow;
break;
case WSA_OPERATION_ABORTED:
@ -55,6 +66,7 @@ namespace Aurora::IO::Net
case WSAEPROTONOSUPPORT:
case WSAEPFNOSUPPORT:
case WSAEAFNOSUPPORT:
case (AuUInt)STATUS_ACCESS_DENIED:
error.netError = ENetworkError::ePermissionDenied;
break;
case WSA_IO_INCOMPLETE:

View File

@ -90,6 +90,18 @@ namespace Aurora::IO::TLS
int TLSContext::Write(const void *pIn, AuUInt length)
{
if (auto pPiece = this->pPiece_.lock())
{
AuUInt count {};
if (Aurora::IO::EStreamError::eErrorNone !=
pPiece->ToNextWriter()->Write(AuMemoryViewStreamRead { AuMemoryViewRead { pIn, length }, count }))
{
SysPushErrorIO("TLS couldn't flush write into next protocol layer or drain");
return -1;
}
return count;
}
return this->pSendStack_->pDrainBuffer->Write(pIn, length);
}
@ -144,12 +156,15 @@ namespace Aurora::IO::TLS
return false;
}
if (!this->pSendStack_->AppendInterceptorEx(this->GetSendInterceptor(), this->meta_.uOutPageSize))
auto pPiece = this->pSendStack_->AppendInterceptorEx(this->GetSendInterceptor(), this->meta_.uOutPageSize);
if (!pPiece)
{
SysPushErrorNet("Couldn't add TLS interceptor");
return false;
}
this->pPiece_ = pPiece;
if (!this->pRecvStack_->AppendInterceptorEx(this->GetRecvInterceptor(), this->meta_.uOutPageSize))
{
SysPushErrorNet("Couldn't add TLS interceptor");

View File

@ -92,6 +92,7 @@ namespace Aurora::IO::TLS
TLSProtocolSend channelSend_;
AuSPtr<Protocol::ProtocolStack> pSendStack_;
AuSPtr<Protocol::ProtocolStack> pRecvStack_;
AuWPtr<Protocol::IProtocolPiece> pPiece_;
};
}