secur32: Extract schan_imp_get_session_peer_certificate function.
This commit is contained in:
parent
9b85662fec
commit
12195b32df
|
@ -72,6 +72,26 @@ MAKE_FUNCPTR(gnutls_transport_set_push_function);
|
|||
#undef MAKE_FUNCPTR
|
||||
|
||||
|
||||
static SECURITY_STATUS schan_imp_get_session_peer_certificate(gnutls_session_t s,
|
||||
PCCERT_CONTEXT *cert)
|
||||
{
|
||||
unsigned int list_size;
|
||||
const gnutls_datum_t *datum;
|
||||
|
||||
datum = pgnutls_certificate_get_peers(s, &list_size);
|
||||
if (datum)
|
||||
{
|
||||
*cert = CertCreateCertificateContext(X509_ASN_ENCODING, datum->data,
|
||||
datum->size);
|
||||
if (!*cert)
|
||||
return GetLastError();
|
||||
else
|
||||
return SEC_E_OK;
|
||||
}
|
||||
else
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
static SECURITY_STATUS schan_imp_send(gnutls_session_t s, const void *buffer,
|
||||
size_t *length)
|
||||
{
|
||||
|
@ -1013,24 +1033,9 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW(
|
|||
return SEC_E_OK;
|
||||
}
|
||||
case SECPKG_ATTR_REMOTE_CERT_CONTEXT:
|
||||
{
|
||||
unsigned int list_size;
|
||||
const gnutls_datum_t *datum;
|
||||
|
||||
datum = pgnutls_certificate_get_peers(ctx->session, &list_size);
|
||||
if (datum)
|
||||
{
|
||||
PCCERT_CONTEXT *cert = buffer;
|
||||
|
||||
*cert = CertCreateCertificateContext(X509_ASN_ENCODING,
|
||||
datum->data, datum->size);
|
||||
if (!*cert)
|
||||
return GetLastError();
|
||||
else
|
||||
return SEC_E_OK;
|
||||
}
|
||||
else
|
||||
return SEC_E_INTERNAL_ERROR;
|
||||
return schan_imp_get_session_peer_certificate(ctx->session, cert);
|
||||
}
|
||||
case SECPKG_ATTR_CONNECTION_INFO:
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue