]> WPIA git - cassiopeia.git/blobdiff - src/config.cpp
fix: use correct prepared statement for writing logs
[cassiopeia.git] / src / config.cpp
index a58cc82878acabf16190dcc212bb27e2a617b8f3..8b175967de13ad74c672ab90fc0ffcae5b205324 100644 (file)
@@ -15,6 +15,7 @@ std::string sqlHost, sqlUser, sqlPass, sqlDB;
 std::string serialPath;
 std::string crlPrefix;
 std::string crtPrefix;
+std::string ocspPath;
 
 std::shared_ptr<std::unordered_map<std::string, std::string>> parseConf( std::string path ) {
     auto map = std::make_shared<std::unordered_map<std::string, std::string>>();
@@ -91,6 +92,20 @@ int parseProfiles() {
         prof.id = std::stoi( id );
         prof.eku = map->at( "eku" );
         prof.ku = map->at( "ku" );
+        {
+            std::string include = map->at( "include" );
+            size_t pos = 0;
+            size_t end = 0;
+            std::unordered_set<std::string> include_set;
+
+            while( ( end = include.find( ",", pos ) ) != std::string::npos ) {
+                include_set.emplace( include.substr( pos, end - pos ) );
+                pos = end + 1;
+            }
+
+            include_set.emplace( include.substr( pos ) );
+            prof.include = include_set;
+        }
         prof.maxValidity = std::stoi( map->at( "days" ) ) * /* DAYS */24 * 60 * 60;
 
 
@@ -147,6 +162,14 @@ int parseConfig( std::string path ) {
     crlPrefix = masterConf->at( "crlPrefix" );
     crtPrefix = masterConf->at( "crtPrefix" );
 
+    auto ocspPathEntry = masterConf->find( "ocsp.path" );
+
+    if( ocspPathEntry == masterConf->end() ) {
+        ocspPath = "";
+    } else {
+        ocspPath = ocspPathEntry->second;
+    }
+
     if( keyDir == "" ) {
         logger::error( "Missing config property key.directory" );
         return -1;