X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fconfig.cpp;h=ce78f417582a8a8049389f18435279cde60b7fa8;hb=b14903fa5cded58b70beb4e84fb0409011b6e7aa;hp=b746bad11a88049338853537be38250c1297bb6a;hpb=ab317a7803ad0ff688ab8fb452d13d8bdd09fd60;p=cassiopeia.git diff --git a/src/config.cpp b/src/config.cpp index b746bad..ce78f41 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -87,13 +87,31 @@ int parseProfiles() { prof.id = std::stoi( id ); prof.eku = map->at( "eku" ); prof.ku = map->at( "ku" ); + prof.maxValidity = std::stoi( map->at( "days" ) ) * /* DAYS */24 * 60 * 60; - if( CAs.find( map->at( "ca" ) ) == CAs.end() ) { - std::shared_ptr ca( new CAConfig( map->at( "ca" ) ) ); - CAs.emplace( map->at( "ca" ), ca ); - } + std::string cas = map->at( "ca" ); + + for( size_t pos = 0; pos != std::string::npos; ) { + size_t end = cas.find( ",", pos ); + std::string sub; + + if( end == std::string::npos ) { + sub = cas.substr( pos ); + } else { + sub = cas.substr( pos, end - pos ); + end++; + } + + pos = end; - prof.ca = CAs.at( map->at( "ca" ) ); + if( CAs.find( sub ) == CAs.end() ) { + std::shared_ptr ca( new CAConfig( sub ) ); + CAs.emplace( sub, ca ); + } + + prof.ca.push_back( CAs.at( sub ) ); + + } profiles.emplace( profileName, prof ); std::cout << "Profile: " << profileName << " up and running." << std::endl;