]> WPIA git - cassiopeia.git/commitdiff
fmt: Whitespace
authorBenny Baumann <BenBE@geshi.org>
Sat, 21 Mar 2015 16:16:41 +0000 (17:16 +0100)
committerBenny Baumann <BenBE@geshi.org>
Sat, 21 Mar 2015 16:16:41 +0000 (17:16 +0100)
src/apps/client.cpp
src/crypto/X509.cpp
src/crypto/simpleOpensslSigner.cpp
src/crypto/sslUtil.cpp
src/io/record.h
src/io/recordHandler.cpp
src/util.cpp
test/src/sql.cpp

index e30803e690ba333e6c0f828df4e9675a9a7f89ed..3d4c339907e9f0a38391a6b73e3d40a03f23ab8b 100644 (file)
@@ -159,6 +159,7 @@ int main( int argc, const char* argv[] ) {
                 log << "FINE: CERTIFICATE LOG: " << res->log << std::endl;
                 log << "FINE: CERTIFICATE:" << std::endl << res->certificate << std::endl;
                 std::string fn = writeBackFile( job->target.c_str(), res->certificate, keyDir );
+
                 if( fn.empty() ) {
                     log << "ERROR: Writeback of the certificate failed." << std::endl;
                     jp->failJob( job );
index a068957b4071a2646f3d2b8d475b991aae8bdf4c..a617ac33ffddb21c7d471d9b251b0bfd6faf7f29 100644 (file)
@@ -247,9 +247,11 @@ std::shared_ptr<SignedCertificate> X509Cert::sign( std::shared_ptr<EVP_PKEY> caK
     //X509_print_fp( stdout, target.get() );
 
     std::shared_ptr<BIO> mem = std::shared_ptr<BIO>( BIO_new( BIO_s_mem() ), BIO_free );
+
     if( !mem ) {
         throw "Failed to allocate memory for the signed certificate.";
     }
+
     PEM_write_bio_X509( mem.get(), target.get() );
 
     BUF_MEM* buf = NULL;
@@ -259,6 +261,7 @@ std::shared_ptr<SignedCertificate> X509Cert::sign( std::shared_ptr<EVP_PKEY> caK
     res->certificate = std::string( buf->data, buf->data + buf->length );
 
     std::shared_ptr<BIGNUM> ser( ASN1_INTEGER_to_BN( target->cert_info->serialNumber, NULL ), BN_free );
+
     if( !ser ) {
         throw "Failed to retrieve certificate serial of signed certificate.";
     }
index f7042a29fccee7cbbdc731e5cf16e7d04469b4cd..b6005b7483c112e85ed108f0939331a582c94ae8 100644 (file)
@@ -191,6 +191,7 @@ std::shared_ptr<SignedCertificate> SimpleOpensslSigner::sign( std::shared_ptr<TB
     std::shared_ptr<SignedCertificate> output = c.sign( ca->caKey, cert->md );
     signlog << "FINE: all went well" << std::endl;
     std::string fn = writeBackFile( num, output->certificate, ca->path );
+
     if( fn.empty() ) {
         signlog << "ERROR: failed to get filename for storage of signed certificate." << std::endl;
         throw "Storage location could not be determined";
index cc80916138b555c4a0718a1b609b34eae102ff38..d0df60c9d7a3f5171b093e8bf1421ede90a6bee9 100644 (file)
@@ -96,6 +96,7 @@ std::shared_ptr<SSL_CTX> generateSSLContext( bool server ) {
     SSL_CTX_set_verify( ctx.get(), SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, verify_callback );
     SSL_CTX_use_certificate_file( ctx.get(), server ? "keys/signer_server.crt" : "keys/signer_client.crt", SSL_FILETYPE_PEM );
     SSL_CTX_use_PrivateKey_file( ctx.get(), server ? "keys/signer_server.key" : "keys/signer_client.key", SSL_FILETYPE_PEM );
+
     if( 1 != SSL_CTX_load_verify_locations( ctx.get(), "keys/ca.crt", 0 ) ) {
         throw "Cannot load CA store for certificate validation.";
     }
index 88576651ea574c25c2c7f2ebf83ad44e8ec6d5f1..0a1368117fc681099fe74b6cf8dca60a45da926d 100644 (file)
@@ -59,10 +59,10 @@ public:
     template <class T>
     static void read( std::string::const_iterator& it, T& val ) {
         union typeConversion {
-            char buf[sizeof(T)];
+            char buf[sizeof( T )];
             T value;
 
-            typeConversion(const T& v) : value(v) {}
+            typeConversion( const T& v ) : value( v ) {}
         };
 
         typeConversion data( 0 );
index 672712813a579197b7bd736bfdcb4c2169503aec..35ad8087e93d8110f29a01af5476d8f012f5b38d 100644 (file)
@@ -40,7 +40,7 @@ public:
     RecordHandlerSession( DefaultRecordHandler* parent, std::shared_ptr<Signer> signer, std::shared_ptr<SSL_CTX> ctx, std::shared_ptr<BIO> output ) :
         sessid( 0 ),
         lastCommandCount( 0 ),
-        tbs( new TBSCertificate() ){
+        tbs( new TBSCertificate() ) {
         this->parent = parent;
         this->signer = signer;
         time_t c_time;
index ed7b42e61ff87a407c981ff791cd92d05459136a..dc03e9dfb133c60e15a830711214fb5015c1fb15 100644 (file)
@@ -30,6 +30,7 @@ std::string writeBackFile( const std::string& serial, const std::string& cert, c
     errno = 0;
 
     std::string filename = keydir;
+
     if( 0 != mkdir( filename.c_str(), 0755 ) ) {
         if( EEXIST != errno ) {
             return "";
@@ -39,6 +40,7 @@ std::string writeBackFile( const std::string& serial, const std::string& cert, c
     }
 
     filename += "/crt";
+
     if( 0 != mkdir( filename.c_str(), 0755 ) ) {
         if( EEXIST != errno ) {
             return "";
@@ -46,6 +48,7 @@ std::string writeBackFile( const std::string& serial, const std::string& cert, c
 
         //! \FIXME: Check this is a directory
     }
+
     std::string first;
 
     if( serial.length() < 3 ) {
@@ -55,6 +58,7 @@ std::string writeBackFile( const std::string& serial, const std::string& cert, c
     }
 
     filename += "/" + first;
+
     if( 0 != mkdir( filename.c_str(), 0755 ) ) {
         if( EEXIST != errno ) {
             return "";
index 8f5107ebb25fa18b8a06850ac2199aa52d03d5db..cf856296847b364f217d6fef31130f78e0087486 100644 (file)
@@ -10,12 +10,14 @@ extern std::string sqlHost, sqlUser, sqlPass, sqlDB;
 BOOST_AUTO_TEST_SUITE( TestSQL )
 
 BOOST_AUTO_TEST_CASE( testSQL ) {
-    std::ifstream conf("config.txt");
+    std::ifstream conf( "config.txt" );
+
     if( !conf ) {
         BOOST_WARN_MESSAGE( 0, "Config file is missing. Exiting." );
-       return;
+        return;
     }
-    BOOST_REQUIRE( parseConfig("config.txt") == 0 );
+
+    BOOST_REQUIRE( parseConfig( "config.txt" ) == 0 );
     std::shared_ptr<MySQLJobProvider> jp( new MySQLJobProvider( sqlHost, sqlUser, sqlPass, sqlDB ) );
     BOOST_REQUIRE( jp->query( "TRUNCATE TABLE profiles" ).first == 0 );
     BOOST_REQUIRE( jp->query( "TRUNCATE TABLE certs" ).first == 0 );
@@ -27,24 +29,24 @@ BOOST_AUTO_TEST_CASE( testSQL ) {
 
     std::shared_ptr<Job> job = jp->fetchJob();
     BOOST_REQUIRE( job );
-    jp->failJob(job);
+    jp->failJob( job );
     BOOST_REQUIRE_EQUAL( job->target, "1" );
     BOOST_REQUIRE_EQUAL( job->task, "sign" );
     job = jp->fetchJob();
     BOOST_REQUIRE( job );
-    std::shared_ptr<TBSCertificate> cert = jp->fetchTBSCert(job);
+    std::shared_ptr<TBSCertificate> cert = jp->fetchTBSCert( job );
     BOOST_REQUIRE( !cert );
     BOOST_REQUIRE( jp->query( "INSERT INTO certs SET csr_type='CSR', id='1', profile='1'" ).first == 0 );
     BOOST_REQUIRE( jp->query( "INSERT INTO subjectAlternativeNames SET certId='1', contents='example.org', type='DNS'" ).first == 0 );
     BOOST_REQUIRE( jp->query( "INSERT INTO certAvas SET certid='1', name='CN', value='example.org'" ).first == 0 );
-    cert = jp->fetchTBSCert(job);
+    cert = jp->fetchTBSCert( job );
     BOOST_REQUIRE( cert );
 
     std::shared_ptr<SignedCertificate> fcert( new SignedCertificate() );
-    fcert->certificate="CERT";
-    fcert->serial="1234";
-    fcert->crt_name="crt.name.crt";
-    fcert->ca_name="assured";
+    fcert->certificate = "CERT";
+    fcert->serial = "1234";
+    fcert->crt_name = "crt.name.crt";
+    fcert->ca_name = "assured";
     jp->writeBack( job, fcert );
     jp->finishJob( job );
     BOOST_REQUIRE( !jp->fetchJob() );
@@ -53,27 +55,29 @@ BOOST_AUTO_TEST_CASE( testSQL ) {
     BOOST_REQUIRE_EQUAL( job->target, "1" );
     BOOST_REQUIRE_EQUAL( job->task, "revoke" );
     std::pair<std::string, std::string> revocationInfo = jp->getRevocationInfo( job );
-    BOOST_REQUIRE_EQUAL( revocationInfo.first, "1234");
-    BOOST_REQUIRE_EQUAL( revocationInfo.second, "assured");
+    BOOST_REQUIRE_EQUAL( revocationInfo.first, "1234" );
+    BOOST_REQUIRE_EQUAL( revocationInfo.second, "assured" );
     jp->writeBackRevocation( job, "2000-01-01 01:01:01" );
     jp->finishJob( job );
 }
 
 BOOST_AUTO_TEST_CASE( testSQLDisconnected ) {
-    std::ifstream conf("config.txt");
+    std::ifstream conf( "config.txt" );
+
     if( !conf ) {
         BOOST_WARN_MESSAGE( 0, "Config file is missing. Exiting." );
-       return;
+        return;
     }
+
     //if(1) return;
     //BOOST_REQUIRE( parseConfig("config.txt") == 0 );
     std::shared_ptr<MySQLJobProvider> jp( new MySQLJobProvider( sqlHost, sqlUser, sqlPass, sqlDB ) );
     jp->disconnect();
     jp->disconnect();
-    BOOST_REQUIRE( jp->query("SELECT 1").first);
-    BOOST_REQUIRE_THROW( jp->escape_string("uia"), const char * );
-    BOOST_REQUIRE_THROW( jp->finishJob(std::shared_ptr<Job>()), const char * );
-    BOOST_REQUIRE_THROW( jp->failJob(std::shared_ptr<Job>()), const char * );
+    BOOST_REQUIRE( jp->query( "SELECT 1" ).first );
+    BOOST_REQUIRE_THROW( jp->escape_string( "uia" ), const char* );
+    BOOST_REQUIRE_THROW( jp->finishJob( std::shared_ptr<Job>() ), const char* );
+    BOOST_REQUIRE_THROW( jp->failJob( std::shared_ptr<Job>() ), const char* );
 }
 
 BOOST_AUTO_TEST_SUITE_END()