https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c1394ae71a4e98f87b69e…
commit c1394ae71a4e98f87b69e6b3b902d7a24b1bde3c
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Tue Dec 8 18:01:29 2020 +0100
Commit: Jérôme Gardou <zefklop(a)users.noreply.github.com>
CommitDate: Tue Jan 5 11:03:13 2021 +0100
[WINESYNC] wininet: Move INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT handling to
helper.
Signed-off-by: Daniel Lehman <dlehman25(a)gmail.com>
Signed-off-by: Jacek Caban <jacek(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id a41cb33afaee0adc6fdf3b8c69b9fb545dc15a96 by Daniel Lehman
<dlehman25(a)gmail.com>
---
dll/win32/wininet/http.c | 62 ++++++++++++++++++++++--------------------
sdk/tools/winesync/wininet.cfg | 2 +-
2 files changed, 34 insertions(+), 30 deletions(-)
diff --git a/dll/win32/wininet/http.c b/dll/win32/wininet/http.c
index 46556ee68d9..58e91bc1a13 100644
--- a/dll/win32/wininet/http.c
+++ b/dll/win32/wininet/http.c
@@ -2102,6 +2102,38 @@ static DWORD str_to_buffer(const WCHAR *str, void *buffer, DWORD
*size, BOOL uni
}
}
+static DWORD get_security_cert_struct(http_request_t *req, INTERNET_CERTIFICATE_INFOA
*info)
+{
+ PCCERT_CONTEXT context;
+ DWORD len;
+
+ context = (PCCERT_CONTEXT)NETCON_GetCert(req->netconn);
+ if(!context)
+ return ERROR_NOT_SUPPORTED;
+
+ memset(info, 0, sizeof(*info));
+ info->ftExpiry = context->pCertInfo->NotAfter;
+ info->ftStart = context->pCertInfo->NotBefore;
+ len = CertNameToStrA(context->dwCertEncodingType,
+ &context->pCertInfo->Subject,
CERT_SIMPLE_NAME_STR|CERT_NAME_STR_CRLF_FLAG, NULL, 0);
+ info->lpszSubjectInfo = LocalAlloc(0, len);
+ if(info->lpszSubjectInfo)
+ CertNameToStrA(context->dwCertEncodingType,
+ &context->pCertInfo->Subject,
CERT_SIMPLE_NAME_STR|CERT_NAME_STR_CRLF_FLAG,
+ info->lpszSubjectInfo, len);
+ len = CertNameToStrA(context->dwCertEncodingType,
+ &context->pCertInfo->Issuer,
CERT_SIMPLE_NAME_STR|CERT_NAME_STR_CRLF_FLAG, NULL, 0);
+ info->lpszIssuerInfo = LocalAlloc(0, len);
+ if(info->lpszIssuerInfo)
+ CertNameToStrA(context->dwCertEncodingType,
+ &context->pCertInfo->Issuer,
CERT_SIMPLE_NAME_STR|CERT_NAME_STR_CRLF_FLAG,
+ info->lpszIssuerInfo, len);
+ info->dwKeySize = NETCON_GetCipherStrength(req->netconn);
+
+ CertFreeCertificateContext(context);
+ return ERROR_SUCCESS;
+}
+
static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option, void *buffer, DWORD
*size, BOOL unicode)
{
http_request_t *req = (http_request_t*)hdr;
@@ -2254,8 +2286,6 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD option,
void *buffe
}
case INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT: {
- PCCERT_CONTEXT context;
-
if(!req->netconn)
return ERROR_INTERNET_INVALID_OPERATION;
@@ -2264,33 +2294,7 @@ static DWORD HTTPREQ_QueryOption(object_header_t *hdr, DWORD
option, void *buffe
return ERROR_INSUFFICIENT_BUFFER;
}
- context = (PCCERT_CONTEXT)NETCON_GetCert(req->netconn);
- if(context) {
- INTERNET_CERTIFICATE_INFOA *info = (INTERNET_CERTIFICATE_INFOA*)buffer;
- DWORD len;
-
- memset(info, 0, sizeof(*info));
- info->ftExpiry = context->pCertInfo->NotAfter;
- info->ftStart = context->pCertInfo->NotBefore;
- len = CertNameToStrA(context->dwCertEncodingType,
- &context->pCertInfo->Subject,
CERT_SIMPLE_NAME_STR|CERT_NAME_STR_CRLF_FLAG, NULL, 0);
- info->lpszSubjectInfo = LocalAlloc(0, len);
- if(info->lpszSubjectInfo)
- CertNameToStrA(context->dwCertEncodingType,
- &context->pCertInfo->Subject,
CERT_SIMPLE_NAME_STR|CERT_NAME_STR_CRLF_FLAG,
- info->lpszSubjectInfo, len);
- len = CertNameToStrA(context->dwCertEncodingType,
- &context->pCertInfo->Issuer,
CERT_SIMPLE_NAME_STR|CERT_NAME_STR_CRLF_FLAG, NULL, 0);
- info->lpszIssuerInfo = LocalAlloc(0, len);
- if(info->lpszIssuerInfo)
- CertNameToStrA(context->dwCertEncodingType,
- &context->pCertInfo->Issuer,
CERT_SIMPLE_NAME_STR|CERT_NAME_STR_CRLF_FLAG,
- info->lpszIssuerInfo, len);
- info->dwKeySize = NETCON_GetCipherStrength(req->netconn);
- CertFreeCertificateContext(context);
- return ERROR_SUCCESS;
- }
- return ERROR_NOT_SUPPORTED;
+ return get_security_cert_struct(req, (INTERNET_CERTIFICATE_INFOA*)buffer);
}
case INTERNET_OPTION_CONNECT_TIMEOUT:
if (*size < sizeof(DWORD))
diff --git a/sdk/tools/winesync/wininet.cfg b/sdk/tools/winesync/wininet.cfg
index fb5a002b667..01c3002408a 100644
--- a/sdk/tools/winesync/wininet.cfg
+++ b/sdk/tools/winesync/wininet.cfg
@@ -5,4 +5,4 @@ files:
include/wininet.h: sdk/include/psdk/wininet.h
include/winineti.h: sdk/include/psdk/winineti.h
tags:
- wine: c06e00ee6a15fd77faf66b28edac5e84ad30b550
+ wine: a41cb33afaee0adc6fdf3b8c69b9fb545dc15a96