[WININET]
authorCameron Gutman <aicommander@gmail.com>
Mon, 20 Dec 2010 21:25:11 +0000 (21:25 +0000)
committerCameron Gutman <aicommander@gmail.com>
Mon, 20 Dec 2010 21:25:11 +0000 (21:25 +0000)
- Sync to Wine 1.3.9

svn path=/trunk/; revision=50073

reactos/dll/win32/wininet/http.c
reactos/dll/win32/wininet/internet.c
reactos/dll/win32/wininet/netconnection.c
reactos/dll/win32/wininet/wininet.spec

index 324f6c5..796c359 100644 (file)
@@ -5169,3 +5169,21 @@ BOOL WINAPI IsHostInProxyBypassList(DWORD flags, LPCSTR szHost, DWORD length)
    FIXME("STUB: flags=%d host=%s length=%d\n",flags,szHost,length);
    return FALSE;
 }
+
+/***********************************************************************
+ *           InternetShowSecurityInfoByURLA (@)
+ */
+BOOL WINAPI InternetShowSecurityInfoByURLA(LPCSTR url, HWND window)
+{
+   FIXME("stub: %s %p\n", url, window);
+   return FALSE;
+}
+
+/***********************************************************************
+ *           InternetShowSecurityInfoByURLW (@)
+ */
+BOOL WINAPI InternetShowSecurityInfoByURLW(LPCWSTR url, HWND window)
+{
+   FIXME("stub: %s %p\n", debugstr_w(url), window);
+   return FALSE;
+}
index 89337ac..94df521 100644 (file)
@@ -1370,8 +1370,9 @@ BOOL WINAPI InternetCrackUrlA(LPCSTR lpszUrl, DWORD dwUrlLength, DWORD dwFlags,
        InternetCrackUrlW should not include it                  */
   if (dwUrlLength == -1) nLength--;
 
-  lpwszUrl = HeapAlloc(GetProcessHeap(), 0, nLength * sizeof(WCHAR));
-  MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength);
+  lpwszUrl = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(WCHAR));
+  MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength + 1);
+  lpwszUrl[nLength] = '\0';
 
   memset(&UCW,0,sizeof(UCW));
   UCW.dwStructSize = sizeof(URL_COMPONENTSW);
@@ -1788,7 +1789,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
      */
     if (lpszcp != 0 && lpszcp - lpszUrl < dwUrlLength && (!lpszParam || lpszcp <= lpszParam))
     {
-        INT len;
+        DWORD len;
 
         /* Only truncate the parameter list if it's already been saved
          * in lpUC->lpszExtraInfo.
@@ -1806,8 +1807,46 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
             else
                 len = dwUrlLength-(lpszcp-lpszUrl);
         }
-        SetUrlComponentValueW(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength,
-                                   lpszcp, len);
+        if (lpUC->dwUrlPathLength && lpUC->lpszUrlPath &&
+                lpUC->nScheme == INTERNET_SCHEME_FILE)
+        {
+            WCHAR tmppath[MAX_PATH];
+            if (*lpszcp == '/')
+            {
+                len = MAX_PATH;
+                PathCreateFromUrlW(lpszUrl_orig, tmppath, &len, 0);
+            }
+            else
+            {
+                WCHAR *iter;
+                memcpy(tmppath, lpszcp, len * sizeof(WCHAR));
+                tmppath[len] = '\0';
+
+                iter = tmppath;
+                while (*iter) {
+                    if (*iter == '/')
+                        *iter = '\\';
+                    ++iter;
+                }
+            }
+            /* if ends in \. or \.. append a backslash */
+            if (tmppath[len - 1] == '.' &&
+                    (tmppath[len - 2] == '\\' ||
+                     (tmppath[len - 2] == '.' && tmppath[len - 3] == '\\')))
+            {
+                if (len < MAX_PATH - 1)
+                {
+                    tmppath[len] = '\\';
+                    tmppath[len+1] = '\0';
+                    ++len;
+                }
+            }
+            SetUrlComponentValueW(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength,
+                                       tmppath, len);
+        }
+        else
+            SetUrlComponentValueW(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength,
+                                       lpszcp, len);
     }
     else
     {
index 6e569a3..402cfd1 100644 (file)
@@ -114,7 +114,7 @@ static CRITICAL_SECTION init_ssl_cs = { &init_ssl_cs_debug, -1, 0, 0, 0, 0 };
 static void *OpenSSL_ssl_handle;
 static void *OpenSSL_crypto_handle;
 
-#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER> 0x1000000)
+#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER > 0x10000000)
 static const SSL_METHOD *meth;
 #else
 static SSL_METHOD *meth;
@@ -152,7 +152,6 @@ MAKE_FUNCPTR(SSL_CTX_set_default_verify_paths);
 MAKE_FUNCPTR(SSL_CTX_set_verify);
 MAKE_FUNCPTR(SSL_get_current_cipher);
 MAKE_FUNCPTR(SSL_CIPHER_get_bits);
-MAKE_FUNCPTR(X509_STORE_CTX_get_ex_data);
 
 /* OpenSSL's libcrypto functions that we use */
 MAKE_FUNCPTR(BIO_new_fp);
@@ -162,6 +161,7 @@ MAKE_FUNCPTR(CRYPTO_set_locking_callback);
 MAKE_FUNCPTR(ERR_free_strings);
 MAKE_FUNCPTR(ERR_get_error);
 MAKE_FUNCPTR(ERR_error_string);
+MAKE_FUNCPTR(X509_STORE_CTX_get_ex_data);
 MAKE_FUNCPTR(i2d_X509);
 MAKE_FUNCPTR(sk_num);
 MAKE_FUNCPTR(sk_value);
@@ -228,13 +228,15 @@ static DWORD netconn_verify_cert(PCCERT_CONTEXT cert, HCERTSTORE store,
     PCCERT_CHAIN_CONTEXT chain;
     char oid_server_auth[] = szOID_PKIX_KP_SERVER_AUTH;
     char *server_auth[] = { oid_server_auth };
-    DWORD err = ERROR_SUCCESS;
+    DWORD err = ERROR_SUCCESS, chainFlags = 0;
 
     TRACE("verifying %s\n", debugstr_w(server));
     chainPara.RequestedUsage.Usage.cUsageIdentifier = 1;
     chainPara.RequestedUsage.Usage.rgpszUsageIdentifier = server_auth;
-    if ((ret = CertGetCertificateChain(NULL, cert, NULL, store, &chainPara, 0,
-        NULL, &chain)))
+    if (!(security_flags & SECURITY_FLAG_IGNORE_REVOCATION))
+        chainFlags |= CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT;
+    if ((ret = CertGetCertificateChain(NULL, cert, NULL, store, &chainPara,
+        chainFlags, NULL, &chain)))
     {
         if (chain->TrustStatus.dwErrorStatus)
         {
@@ -431,7 +433,6 @@ DWORD NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
        DYNSSL(SSL_CTX_set_verify);
         DYNSSL(SSL_get_current_cipher);
         DYNSSL(SSL_CIPHER_get_bits);
-       DYNSSL(X509_STORE_CTX_get_ex_data);
 #undef DYNSSL
 
 #define DYNCRYPTO(x) \
@@ -449,6 +450,7 @@ DWORD NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL)
        DYNCRYPTO(ERR_free_strings);
        DYNCRYPTO(ERR_get_error);
        DYNCRYPTO(ERR_error_string);
+       DYNCRYPTO(X509_STORE_CTX_get_ex_data);
        DYNCRYPTO(i2d_X509);
        DYNCRYPTO(sk_num);
        DYNCRYPTO(sk_value);
@@ -877,7 +879,11 @@ LPCVOID NETCON_GetCert(WININET_NETCONNECTION *connection)
 int NETCON_GetCipherStrength(WININET_NETCONNECTION *connection)
 {
 #ifdef SONAME_LIBSSL
+#if defined(OPENSSL_VERSION_NUMBER) && (OPENSSL_VERSION_NUMBER >= 0x0090707f)
+    const SSL_CIPHER *cipher;
+#else
     SSL_CIPHER *cipher;
+#endif
     int bits = 0;
 
     if (!connection->useSSL)
index 46dd043..bb11d7e 100644 (file)
 @ stdcall InternetSetStatusCallback(ptr ptr) InternetSetStatusCallbackA
 @ stdcall InternetSetStatusCallbackA(ptr ptr)
 @ stdcall InternetSetStatusCallbackW(ptr ptr)
-@ stub InternetShowSecurityInfoByURL
-@ stub InternetShowSecurityInfoByURLA
-@ stub InternetShowSecurityInfoByURLW
+@ stdcall InternetShowSecurityInfoByURL(str ptr) InternetShowSecurityInfoByURLA
+@ stdcall InternetShowSecurityInfoByURLA(str ptr)
+@ stdcall InternetShowSecurityInfoByURLW(wstr ptr)
 @ stdcall InternetTimeFromSystemTime(ptr long ptr long) InternetTimeFromSystemTimeA
 @ stdcall InternetTimeFromSystemTimeA(ptr long ptr long)
 @ stdcall InternetTimeFromSystemTimeW(ptr long ptr long)