]> WPIA git - cassiopeia.git/blobdiff - src/apps/client.cpp
fmt: Whitespace
[cassiopeia.git] / src / apps / client.cpp
index e1855190673870e998e3aeb78ff5ed405a0e9302..3d4c339907e9f0a38391a6b73e3d40a03f23ab8b 100644 (file)
@@ -78,7 +78,7 @@ int main( int argc, const char* argv[] ) {
     std::shared_ptr<JobProvider> jp( new MySQLJobProvider( sqlHost, sqlUser, sqlPass, sqlDB ) );
     std::shared_ptr<BIO> b = openSerial( serialPath );
     std::shared_ptr<BIO> slip1( BIO_new( toBio<SlipBIO>() ), BIO_free );
-    ( ( SlipBIO* )slip1->ptr )->setTarget( std::shared_ptr<OpensslBIO>( new OpensslBIOWrapper( b ) ) );
+    static_cast<SlipBIO*>( slip1->ptr )->setTarget( std::shared_ptr<OpensslBIO>( new OpensslBIOWrapper( b ) ) );
     std::shared_ptr<RemoteSigner> sign( new RemoteSigner( slip1, generateSSLContext( false ) ) );
     // std::shared_ptr<Signer> sign( new SimpleOpensslSigner() );
 
@@ -159,8 +159,15 @@ 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 );
+                    continue;
+                }
+
                 res->crt_name = fn;
-                jp->writeBack( job, res );
+                jp->writeBack( job, res ); //! \FIXME: Check return value
                 log << "FINE: signing done." << std::endl;
 
                 if( DAEMON ) {
@@ -170,7 +177,7 @@ int main( int argc, const char* argv[] ) {
                 continue;
             } catch( const char* c ) {
                 log << "ERROR: " << c << std::endl;
-            } catch( std::string c ) {
+            } catch( std::string& c ) {
                 log << "ERROR: " << c << std::endl;
             }
 
@@ -178,7 +185,7 @@ int main( int argc, const char* argv[] ) {
                 jp->failJob( job );
             } catch( const char* c ) {
                 log << "ERROR: " << c << std::endl;
-            } catch( std::string c ) {
+            } catch( std::string& c ) {
                 log << "ERROR: " << c << std::endl;
             }
         } else if( job->task == "revoke" ) {