]> git.saurik.com Git - apt.git/blobdiff - methods/https.cc
test if TMPDIR is accessible before using
[apt.git] / methods / https.cc
index a40f377101c7b836d9ac55c1eb59755f92c9fab3..366148e199678ccb112e5e5b6952585396f44dc7 100644 (file)
                                                                        /*}}}*/
 using namespace std;
 
                                                                        /*}}}*/
 using namespace std;
 
+bool HttpsMethod::Configuration(std::string Message)
+{
+   if (pkgAcqMethod::Configuration(Message) == false)
+      return false;
+
+   DropPrivsOrDie();
+
+   return true;
+}
+
 size_t
 HttpsMethod::parse_header(void *buffer, size_t size, size_t nmemb, void *userp)
 {
 size_t
 HttpsMethod::parse_header(void *buffer, size_t size, size_t nmemb, void *userp)
 {
@@ -82,6 +92,12 @@ HttpsMethod::write_data(void *buffer, size_t size, size_t nmemb, void *userp)
    if(me->File->Write(buffer, size*nmemb) != true)
       return false;
 
    if(me->File->Write(buffer, size*nmemb) != true)
       return false;
 
+   if(me->Queue->MaximumSize > 0 && me->File->Tell() > me->Queue->MaximumSize)
+   {
+      me->SetFailReason("MaximumSizeExceeded");
+      return _error->Error("Writing more data than expected (%llu > %llu)",
+                           me->TotalWritten, me->Queue->MaximumSize);
+   }
    return size*nmemb;
 }
 
    return size*nmemb;
 }
 
@@ -443,8 +459,6 @@ int main()
 {
    setlocale(LC_ALL, "");
 
 {
    setlocale(LC_ALL, "");
 
-   DropPrivs();
-
    HttpsMethod Mth;
    curl_global_init(CURL_GLOBAL_SSL) ;
 
    HttpsMethod Mth;
    curl_global_init(CURL_GLOBAL_SSL) ;