]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fixed Ssl::CrtdMessage::parseRequest(properties, error) profile
authorAlex Rousskov <rousskov@measurement-factory.com>
Mon, 20 Feb 2012 21:40:59 +0000 (14:40 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Mon, 20 Feb 2012 21:40:59 +0000 (14:40 -0700)
to allow this method to return error texts using its second argument.

Polished error formatting.

src/ssl/crtd_message.cc
src/ssl/crtd_message.h
src/ssl/ssl_crtd.cc

index ddcda17560a496f9d178e3881676b0e42962d1ff..3ba5118cb1d4cc7c13428fcc5953be43d9c6e409 100644 (file)
@@ -174,14 +174,15 @@ void Ssl::CrtdMessage::composeBody(CrtdMessage::BodyParams const & map, std::str
         body += '\n' + other_part;
 }
 
-bool Ssl::CrtdMessage::parseRequest(Ssl::CertificateProperties &certProperties, std::string error)
+
+bool Ssl::CrtdMessage::parseRequest(Ssl::CertificateProperties &certProperties, std::string &error)
 {
     Ssl::CrtdMessage::BodyParams map;
     std::string certs_part;
     parseBody(map, certs_part);
     Ssl::CrtdMessage::BodyParams::iterator i = map.find(Ssl::CrtdMessage::param_host);
     if (i == map.end()) {
-        error = "Parse request: Cannot find \"host\" parameter in request message";
+        error = "Cannot find \"host\" parameter in request message";
         return false;
     }
     certProperties.commonName = i->second;
@@ -205,7 +206,7 @@ bool Ssl::CrtdMessage::parseRequest(Ssl::CertificateProperties &certProperties,
     i = map.find(Ssl::CrtdMessage::param_Sign);
     if (i != map.end()) {
         if ((certProperties.signAlgorithm = Ssl::certSignAlgorithmId(i->second.c_str())) == Ssl::algSignEnd) {
-            error = "Parse request: Wrong signing algoritm: " + i->second;
+            error = "Wrong signing algoritm: " + i->second;
             return false;
         }
     }
@@ -214,7 +215,7 @@ bool Ssl::CrtdMessage::parseRequest(Ssl::CertificateProperties &certProperties,
 
     if (certProperties.signAlgorithm != Ssl::algSignSelf && 
         !Ssl::readCertAndPrivateKeyFromMemory(certProperties.signWithX509, certProperties.signWithPkey, certs_part.c_str())) {
-        error = "Parse request: Broken signing certificate!";
+        error = "Broken signing certificate!";
         return false;
     }
 
index 6149cf722767696b2022bcb3c939880077cd33c8..af6e084fe844b01cb14eeae5c0686a24da1e7fe1 100644 (file)
@@ -64,7 +64,7 @@ public:
     */
     void composeBody(BodyParams const & map, std::string const & other_part);
 
-    bool parseRequest(Ssl::CertificateProperties &, std::string error);
+    bool parseRequest(Ssl::CertificateProperties &, std::string &error);
     void composeRequest(Ssl::CertificateProperties const &);
 
     /// String code for "new_certificate" messages
index 0855b7046743aacc7c8b7ba11da7c5652228f630..c2bec535e2f16f01ea9efe24ac0f2758ad1efe88 100644 (file)
@@ -214,7 +214,7 @@ static bool proccessNewRequest(Ssl::CrtdMessage & request_message, std::string c
     Ssl::CertificateProperties certProperties;
     std::string error;
     if (!request_message.parseRequest(certProperties, error))
-        throw std::runtime_error("Error while parsing the crtd request" + error);
+        throw std::runtime_error("Error while parsing the crtd request" + error);
 
     Ssl::CertificateDb db(db_path, max_db_size, fs_block_size);
     Ssl::X509_Pointer cert;