From: Automatic source maintenance Date: Thu, 4 Jul 2013 00:10:48 +0000 (-0600) Subject: Bootstrapped X-Git-Tag: SQUID_3_4_0_1~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d74740bdf5c33382f96feaa8d84cd657358b1b53;p=thirdparty%2Fsquid.git Bootstrapped --- diff --git a/src/Notes.h b/src/Notes.h index ce9b47fbce..0068bd2332 100644 --- a/src/Notes.h +++ b/src/Notes.h @@ -122,7 +122,7 @@ public: MEMPROXY_CLASS(Entry); }; - NotePairs(){} + NotePairs() {} ~NotePairs(); /** diff --git a/src/redirect.cc b/src/redirect.cc index ec7cd58f60..854422bb7f 100644 --- a/src/redirect.cc +++ b/src/redirect.cc @@ -119,7 +119,7 @@ redirectHandleReply(void *data, const HelperReply &reply) // BACKWARD COMPATIBILITY 2012-06-15: // We got HelperReply::Unknown reply result but new // redirectStateData handlers require HelperReply::Okay, - // else will drop the helper reply + // else will drop the helper reply newReply.result = HelperReply::Okay; newReply.notes.append(&reply.notes); diff --git a/src/ssl/certificate_db.cc b/src/ssl/certificate_db.cc index 8146ae32e1..f58f84db4c 100644 --- a/src/ssl/certificate_db.cc +++ b/src/ssl/certificate_db.cc @@ -184,8 +184,7 @@ void Ssl::CertificateDb::sq_TXT_DB_delete(TXT_DB *db, const char **row) } #define countof(arr) (sizeof(arr)/sizeof(*arr)) -void Ssl::CertificateDb::sq_TXT_DB_delete_row(TXT_DB *db, int idx) -{ +void Ssl::CertificateDb::sq_TXT_DB_delete_row(TXT_DB *db, int idx) { char **rrow; #if SQUID_SSLTXTDB_PSTRINGDATA rrow = (char **)sk_OPENSSL_PSTRING_delete(db->data, idx); @@ -213,29 +212,25 @@ void Ssl::CertificateDb::sq_TXT_DB_delete_row(TXT_DB *db, int idx) } } -unsigned long Ssl::CertificateDb::index_serial_hash(const char **a) -{ +unsigned long Ssl::CertificateDb::index_serial_hash(const char **a) { const char *n = a[Ssl::CertificateDb::cnlSerial]; while (*n == '0') ++n; return lh_strhash(n); } -int Ssl::CertificateDb::index_serial_cmp(const char **a, const char **b) -{ +int Ssl::CertificateDb::index_serial_cmp(const char **a, const char **b) { const char *aa, *bb; for (aa = a[Ssl::CertificateDb::cnlSerial]; *aa == '0'; ++aa); for (bb = b[Ssl::CertificateDb::cnlSerial]; *bb == '0'; ++bb); return strcmp(aa, bb); } -unsigned long Ssl::CertificateDb::index_name_hash(const char **a) -{ +unsigned long Ssl::CertificateDb::index_name_hash(const char **a) { return(lh_strhash(a[Ssl::CertificateDb::cnlName])); } -int Ssl::CertificateDb::index_name_cmp(const char **a, const char **b) -{ +int Ssl::CertificateDb::index_name_cmp(const char **a, const char **b) { return(strcmp(a[Ssl::CertificateDb::cnlName], b[CertificateDb::cnlName])); } @@ -252,23 +247,20 @@ Ssl::CertificateDb::CertificateDb(std::string const & aDb_path, size_t aMax_db_s max_db_size(aMax_db_size), fs_block_size(aFs_block_size), dbLock(db_full), - enabled_disk_store(true) -{ + enabled_disk_store(true) { if (db_path.empty() && !max_db_size) enabled_disk_store = false; else if ((db_path.empty() && max_db_size) || (!db_path.empty() && !max_db_size)) throw std::runtime_error("ssl_crtd is missing the required parameter. There should be -s and -M parameters together."); } -bool Ssl::CertificateDb::find(std::string const & host_name, Ssl::X509_Pointer & cert, Ssl::EVP_PKEY_Pointer & pkey) -{ +bool Ssl::CertificateDb::find(std::string const & host_name, Ssl::X509_Pointer & cert, Ssl::EVP_PKEY_Pointer & pkey) { const Locker locker(dbLock, Here); load(); return pure_find(host_name, cert, pkey); } -bool Ssl::CertificateDb::purgeCert(std::string const & key) -{ +bool Ssl::CertificateDb::purgeCert(std::string const & key) { const Locker locker(dbLock, Here); load(); if (!db) @@ -281,8 +273,7 @@ bool Ssl::CertificateDb::purgeCert(std::string const & key) return true; } -bool Ssl::CertificateDb::addCertAndPrivateKey(Ssl::X509_Pointer & cert, Ssl::EVP_PKEY_Pointer & pkey, std::string const & useName) -{ +bool Ssl::CertificateDb::addCertAndPrivateKey(Ssl::X509_Pointer & cert, Ssl::EVP_PKEY_Pointer & pkey, std::string const & useName) { const Locker locker(dbLock, Here); load(); if (!db || !cert || !pkey) @@ -367,8 +358,7 @@ bool Ssl::CertificateDb::addCertAndPrivateKey(Ssl::X509_Pointer & cert, Ssl::EVP return true; } -void Ssl::CertificateDb::create(std::string const & db_path) -{ +void Ssl::CertificateDb::create(std::string const & db_path) { if (db_path == "") throw std::runtime_error("Path to db is empty"); std::string db_full(db_path + "/" + db_file); @@ -391,14 +381,12 @@ void Ssl::CertificateDb::create(std::string const & db_path) throw std::runtime_error("Cannot open " + db_full + " to open"); } -void Ssl::CertificateDb::check(std::string const & db_path, size_t max_db_size) -{ +void Ssl::CertificateDb::check(std::string const & db_path, size_t max_db_size) { CertificateDb db(db_path, max_db_size, 0); db.load(); } -bool Ssl::CertificateDb::pure_find(std::string const & host_name, Ssl::X509_Pointer & cert, Ssl::EVP_PKEY_Pointer & pkey) -{ +bool Ssl::CertificateDb::pure_find(std::string const & host_name, Ssl::X509_Pointer & cert, Ssl::EVP_PKEY_Pointer & pkey) { if (!db) return false; @@ -420,23 +408,19 @@ bool Ssl::CertificateDb::pure_find(std::string const & host_name, Ssl::X509_Poin return true; } -size_t Ssl::CertificateDb::size() const -{ +size_t Ssl::CertificateDb::size() const { return readSize(); } -void Ssl::CertificateDb::addSize(std::string const & filename) -{ +void Ssl::CertificateDb::addSize(std::string const & filename) { writeSize(readSize() + getFileSize(filename)); } -void Ssl::CertificateDb::subSize(std::string const & filename) -{ +void Ssl::CertificateDb::subSize(std::string const & filename) { writeSize(readSize() - getFileSize(filename)); } -size_t Ssl::CertificateDb::readSize() const -{ +size_t Ssl::CertificateDb::readSize() const { std::ifstream ifstr(size_full.c_str()); if (!ifstr && enabled_disk_store) throw std::runtime_error("cannot open for reading: " + size_full); @@ -446,24 +430,21 @@ size_t Ssl::CertificateDb::readSize() const return db_size; } -void Ssl::CertificateDb::writeSize(size_t db_size) -{ +void Ssl::CertificateDb::writeSize(size_t db_size) { std::ofstream ofstr(size_full.c_str()); if (!ofstr && enabled_disk_store) throw std::runtime_error("cannot write \"" + size_full + "\" file"); ofstr << db_size; } -size_t Ssl::CertificateDb::getFileSize(std::string const & filename) -{ +size_t Ssl::CertificateDb::getFileSize(std::string const & filename) { std::ifstream file(filename.c_str(), std::ios::binary); file.seekg(0, std::ios_base::end); size_t file_size = file.tellg(); return ((file_size + fs_block_size - 1) / fs_block_size) * fs_block_size; } -void Ssl::CertificateDb::load() -{ +void Ssl::CertificateDb::load() { // Load db from file. Ssl::BIO_Pointer in(BIO_new(BIO_s_file())); if (!in || BIO_read_filename(in.get(), db_full.c_str()) <= 0) @@ -487,8 +468,7 @@ void Ssl::CertificateDb::load() db.reset(temp_db.release()); } -void Ssl::CertificateDb::save() -{ +void Ssl::CertificateDb::save() { if (!db) throw std::runtime_error("The certificates database is not loaded");; @@ -502,8 +482,7 @@ void Ssl::CertificateDb::save() } // Normally defined in defines.h file -void Ssl::CertificateDb::deleteRow(const char **row, int rowIndex) -{ +void Ssl::CertificateDb::deleteRow(const char **row, int rowIndex) { const std::string filename(cert_full + "/" + row[cnlSerial] + ".pem"); sq_TXT_DB_delete_row(db.get(), rowIndex); @@ -513,8 +492,7 @@ void Ssl::CertificateDb::deleteRow(const char **row, int rowIndex) throw std::runtime_error("Failed to remove certficate file " + filename + " from db"); } -bool Ssl::CertificateDb::deleteInvalidCertificate() -{ +bool Ssl::CertificateDb::deleteInvalidCertificate() { if (!db) return false; @@ -543,8 +521,7 @@ bool Ssl::CertificateDb::deleteInvalidCertificate() return true; } -bool Ssl::CertificateDb::deleteOldestCertificate() -{ +bool Ssl::CertificateDb::deleteOldestCertificate() { if (!db) return false; @@ -570,8 +547,7 @@ bool Ssl::CertificateDb::deleteOldestCertificate() return true; } -bool Ssl::CertificateDb::deleteByHostname(std::string const & host) -{ +bool Ssl::CertificateDb::deleteByHostname(std::string const & host) { if (!db) return false; @@ -594,7 +570,6 @@ bool Ssl::CertificateDb::deleteByHostname(std::string const & host) return false; } -bool Ssl::CertificateDb::IsEnabledDiskStore() const -{ +bool Ssl::CertificateDb::IsEnabledDiskStore() const { return enabled_disk_store; }