Browse Source

Fix security issue CVE-2013-2074

[taken from RedHat kdelibs3 patches]
(cherry picked from commit 29227e0caa)
Slávek Banko 3 years ago
parent
commit
1eeb0bec0b
1 changed files with 23 additions and 21 deletions
  1. 23
    21
      tdeioslave/http/http.cc

+ 23
- 21
tdeioslave/http/http.cc View File

@@ -310,7 +310,7 @@ void HTTPProtocol::resetSessionSettings()
310 310
     m_bUseProxy = m_proxyURL.isValid();
311 311
 
312 312
     kdDebug(7113) << "(" << m_pid << ") Using proxy: " << m_bUseProxy <<
313
-                                              " URL: " << m_proxyURL.url() <<
313
+                                              " URL: " << m_proxyURL.prettyURL() <<
314 314
                                             " Realm: " << m_strProxyRealm << endl;
315 315
   }
316 316
 
@@ -480,7 +480,7 @@ void HTTPProtocol::setHost( const TQString& host, int port,
480 480
 
481 481
 bool HTTPProtocol::checkRequestURL( const KURL& u )
482 482
 {
483
-  kdDebug (7113) << "(" << m_pid << ") HTTPProtocol::checkRequestURL:  " << u.url() << endl;
483
+  kdDebug (7113) << "(" << m_pid << ") HTTPProtocol::checkRequestURL:  " << u.prettyURL() << endl;
484 484
 
485 485
   m_request.url = u;
486 486
 
@@ -662,7 +662,7 @@ void HTTPProtocol::stat(const KURL& url)
662 662
 
663 663
 void HTTPProtocol::listDir( const KURL& url )
664 664
 {
665
-  kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::listDir " << url.url()
665
+  kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::listDir " << url.prettyURL()
666 666
                 << endl;
667 667
 
668 668
   if ( !checkRequestURL( url ) )
@@ -834,7 +834,7 @@ void HTTPProtocol::davStatList( const KURL& url, bool stat )
834 834
 
835 835
 void HTTPProtocol::davGeneric( const KURL& url, TDEIO::HTTP_METHOD method )
836 836
 {
837
-  kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::davGeneric " << url.url()
837
+  kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::davGeneric " << url.prettyURL()
838 838
                 << endl;
839 839
 
840 840
   if ( !checkRequestURL( url ) )
@@ -1233,7 +1233,7 @@ void HTTPProtocol::davFinished()
1233 1233
 
1234 1234
 void HTTPProtocol::mkdir( const KURL& url, int )
1235 1235
 {
1236
-  kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::mkdir " << url.url()
1236
+  kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::mkdir " << url.prettyURL()
1237 1237
                 << endl;
1238 1238
 
1239 1239
   if ( !checkRequestURL( url ) )
@@ -1255,7 +1255,7 @@ void HTTPProtocol::mkdir( const KURL& url, int )
1255 1255
 
1256 1256
 void HTTPProtocol::get( const KURL& url )
1257 1257
 {
1258
-  kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::get " << url.url()
1258
+  kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::get " << url.prettyURL()
1259 1259
                 << endl;
1260 1260
 
1261 1261
   if ( !checkRequestURL( url ) )
@@ -1570,8 +1570,10 @@ TQString HTTPProtocol::davError( int code /* = -1 */, TQString url )
1570 1570
     callError = true;
1571 1571
   }
1572 1572
 
1573
+  // Huh? This looks like inverted logic to me (it doesn't make sense to me as
1574
+  // written), but I'm only fixing the CVE now. -- Kevin Kofler
1573 1575
   if ( !url.isNull() )
1574
-    url = m_request.url.url();
1576
+    url = m_request.url.prettyURL();
1575 1577
 
1576 1578
   TQString action, errorString;
1577 1579
   TDEIO::Error kError;
@@ -1869,7 +1871,7 @@ void HTTPProtocol::multiGet(const TQByteArray &data)
1869 1871
      if ( !checkRequestURL( url ) )
1870 1872
         continue;
1871 1873
 
1872
-     kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::multi_get " << url.url() << endl;
1874
+     kdDebug(7113) << "(" << m_pid << ") HTTPProtocol::multi_get " << url.prettyURL() << endl;
1873 1875
 
1874 1876
      m_request.method = HTTP_GET;
1875 1877
      m_request.path = url.path();
@@ -2241,17 +2243,17 @@ bool HTTPProtocol::httpOpen()
2241 2243
 
2242 2244
      if (bCacheOnly && bOffline)
2243 2245
      {
2244
-        error( ERR_OFFLINE_MODE, m_request.url.url() );
2246
+        error( ERR_OFFLINE_MODE, m_request.url.prettyURL() );
2245 2247
         return false;
2246 2248
      }
2247 2249
      if (bCacheOnly)
2248 2250
      {
2249
-        error( ERR_DOES_NOT_EXIST, m_request.url.url() );
2251
+        error( ERR_DOES_NOT_EXIST, m_request.url.prettyURL() );
2250 2252
         return false;
2251 2253
      }
2252 2254
      if (bOffline)
2253 2255
      {
2254
-        error( ERR_OFFLINE_MODE, m_request.url.url() );
2256
+        error( ERR_OFFLINE_MODE, m_request.url.prettyURL() );
2255 2257
         return false;
2256 2258
      }
2257 2259
   }
@@ -2925,7 +2927,7 @@ try_again:
2925 2927
               errorPage();
2926 2928
            else
2927 2929
            {
2928
-              error(ERR_INTERNAL_SERVER, m_request.url.url());
2930
+              error(ERR_INTERNAL_SERVER, m_request.url.prettyURL());
2929 2931
               return false;
2930 2932
            }
2931 2933
         }
@@ -2965,7 +2967,7 @@ try_again:
2965 2967
           errorPage();
2966 2968
         else
2967 2969
         {
2968
-          error(ERR_DOES_NOT_EXIST, m_request.url.url());
2970
+          error(ERR_DOES_NOT_EXIST, m_request.url.prettyURL());
2969 2971
           return false;
2970 2972
         }
2971 2973
         m_request.bCachedWrite = false; // Don't put in cache
@@ -3618,7 +3620,7 @@ try_again:
3618 3620
     KURL u(m_request.url, locationStr);
3619 3621
     if(!u.isValid())
3620 3622
     {
3621
-      error(ERR_MALFORMED_URL, u.url());
3623
+      error(ERR_MALFORMED_URL, u.prettyURL());
3622 3624
       return false;
3623 3625
     }
3624 3626
     if ((u.protocol() != "http") && (u.protocol() != "https") &&
@@ -3626,7 +3628,7 @@ try_again:
3626 3628
        (u.protocol() != "webdavs"))
3627 3629
     {
3628 3630
       redirection(u);
3629
-      error(ERR_ACCESS_DENIED, u.url());
3631
+      error(ERR_ACCESS_DENIED, u.prettyURL());
3630 3632
       return false;
3631 3633
     }
3632 3634
 
@@ -3647,10 +3649,10 @@ try_again:
3647 3649
        sendMetaData();
3648 3650
     }
3649 3651
 
3650
-    kdDebug(7113) << "(" << m_pid << ") request.url: " << m_request.url.url()
3652
+    kdDebug(7113) << "(" << m_pid << ") request.url: " << m_request.url.prettyURL()
3651 3653
                   << endl << "LocationStr: " << locationStr.data() << endl;
3652 3654
 
3653
-    kdDebug(7113) << "(" << m_pid << ") Requesting redirection to: " << u.url()
3655
+    kdDebug(7113) << "(" << m_pid << ") Requesting redirection to: " << u.prettyURL()
3654 3656
                   << endl;
3655 3657
 
3656 3658
     // If we're redirected to a http:// url, remember that we're doing webdav...
@@ -3866,7 +3868,7 @@ try_again:
3866 3868
         if (!m_request.fcache)
3867 3869
         {
3868 3870
           m_request.bCachedWrite = false; // Error creating cache entry.
3869
-          kdDebug(7113) << "(" << m_pid << ") Error creating cache entry for " << m_request.url.url()<<"!\n";
3871
+          kdDebug(7113) << "(" << m_pid << ") Error creating cache entry for " << m_request.url.prettyURL()<<"!\n";
3870 3872
         }
3871 3873
         m_request.expireDate = expireDate;
3872 3874
         m_maxCacheSize = config()->readNumEntry("MaxCacheSize", DEFAULT_MAX_CACHE_SIZE) / 2;
@@ -3874,11 +3876,11 @@ try_again:
3874 3876
   }
3875 3877
 
3876 3878
   if (m_request.bCachedWrite && !m_strMimeType.isEmpty())
3877
-    kdDebug(7113) << "(" << m_pid << ") Cache, adding \"" << m_request.url.url() << "\"" << endl;
3879
+    kdDebug(7113) << "(" << m_pid << ") Cache, adding \"" << m_request.url.prettyURL() << "\"" << endl;
3878 3880
   else if (m_request.bCachedWrite && m_strMimeType.isEmpty())
3879
-    kdDebug(7113) << "(" << m_pid << ") Cache, pending \"" << m_request.url.url() << "\"" << endl;
3881
+    kdDebug(7113) << "(" << m_pid << ") Cache, pending \"" << m_request.url.prettyURL() << "\"" << endl;
3880 3882
   else
3881
-    kdDebug(7113) << "(" << m_pid << ") Cache, not adding \"" << m_request.url.url() << "\"" << endl;
3883
+    kdDebug(7113) << "(" << m_pid << ") Cache, not adding \"" << m_request.url.prettyURL() << "\"" << endl;
3882 3884
   return true;
3883 3885
 }
3884 3886
 

Loading…
Cancel
Save