X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fmysql.cpp;h=973e9d0fb68f06ba13f8d57f29e07485ba632c88;hb=a14002d5a4531462c0ae6631323dd038e8d9990e;hp=15478acb553743c315197a95110acd52fe405dd3;hpb=47247a0a500435276c287c69db0e74ab2b92c7fa;p=cassiopeia.git diff --git a/src/mysql.cpp b/src/mysql.cpp index 15478ac..973e9d0 100644 --- a/src/mysql.cpp +++ b/src/mysql.cpp @@ -199,7 +199,7 @@ void MySQLJobProvider::failJob( std::shared_ptr job ) { std::shared_ptr MySQLJobProvider::fetchTBSCert( std::shared_ptr job ) { std::shared_ptr cert = std::shared_ptr( new TBSCertificate() ); - std::string q = "SELECT md, profile, csr_name, csr_type FROM certs WHERE id='" + this->escape_string( job->target ) + "'"; + std::string q = "SELECT md, profile, csr_name, csr_type, keyname FROM certs INNER JOIN profiles ON profiles.id = certs.profile WHERE certs.id='" + this->escape_string( job->target ) + "'"; int err = 0; @@ -223,8 +223,17 @@ std::shared_ptr MySQLJobProvider::fetchTBSCert( std::shared_ptr< return std::shared_ptr(); } + std::string profileName = std::string( row[4], row[4] + l[4] ); + cert->md = std::string( row[0], row[0] + l[0] ); - cert->profile = std::string( row[1], row[1] + l[1] ); + std::string profileId = std::string( row[1], row[1] + l[1] ); + + while( profileId.size() < 4 ) { + profileId = "0" + profileId; + } + + cert->profile = profileId + "-" + profileName; + cert->csr = std::string( row[2], row[2] + l[2] ); cert->csr_type = std::string( row[3], row[3] + l[3] );