Skip to content

Commit b26e82c

Browse files
committed
Check context attributes of established schannel context
1 parent 9ff1938 commit b26e82c

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

src/windows/SChannelConnection.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,23 @@ bool SChannelConnection::connect(const std::string &hostname, uint16_t port)
236236
} while (!done);
237237

238238
debug << "Done!\n";
239-
// TODO: Check resulting context attributes
239+
240+
if (success)
241+
{
242+
SecPkgContext_Flags resultFlags;
243+
QueryContextAttributes(context.get(), SECPKG_ATTR_FLAGS, &resultFlags);
244+
if (resultFlags.Flags & ISC_REQ_CONFIDENTIALITY == 0)
245+
{
246+
debug << "Resulting context is not encrypted, marking as failed\n";
247+
success = false;
248+
}
249+
if (resultFlags.Flags & ISC_REQ_INTEGRITY == 0)
250+
{
251+
debug << "Resulting context is not signed, marking as failed\n";
252+
success = false;
253+
}
254+
}
255+
240256
if (success)
241257
this->context = static_cast<void*>(context.release());
242258
else if (contextCreated)

0 commit comments

Comments
 (0)