]> WPIA git - cassiopeia.git/blobdiff - src/crypto/simpleOpensslSigner.cpp
fix: check for nullptr can be direct
[cassiopeia.git] / src / crypto / simpleOpensslSigner.cpp
index 17323a34adb45ddca61613e7c0209c48bb2d73c8..fa51a9e1ccd85c5c086a323b439c9779d9ea3338 100644 (file)
@@ -35,7 +35,7 @@ std::pair<std::shared_ptr<BIGNUM>, std::string> SimpleOpensslSigner::nextSerial(
     if( res == "" ) {
         bn = BN_new();
 
-        if( !bn ) {
+        if( !bn || !BN_hex2bn( &bn, "1" )) {
             throw "Initing serial failed";
         }
     } else {
@@ -122,7 +122,10 @@ std::shared_ptr<SignedCertificate> SimpleOpensslSigner::sign( std::shared_ptr<TB
 
     for( std::shared_ptr<AVA> a : cert->AVAs ) {
         logger::notef( "INFO: Trying to add RDN: %s: %s", a->name, a->value );
-
+        if( a-> value == "") {
+            logger::notef( "INFO: Removing empty RDN: %s", a->name);
+            continue;
+        }
         if( a->name == "CN" ) {
             c.addRDN( NID_commonName, a->value );
         } else if( a->name == "EMAIL" ) {