X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fdb%2Fmysql.cpp;h=304d4963dcaed689e54751ca1b6ed756405e6f80;hb=db26a9bc01d5ee5f34557fa1ea00feca5be3b79f;hp=7bb93d01746891b75ce815830f28de16ab3c4526;hpb=56358cbe81dd0d11267a06133ce227c2c53f10f7;p=cassiopeia.git diff --git a/src/db/mysql.cpp b/src/db/mysql.cpp index 7bb93d0..304d496 100644 --- a/src/db/mysql.cpp +++ b/src/db/mysql.cpp @@ -319,8 +319,7 @@ void MySQLJobProvider::writeBack( std::shared_ptr job, std::shared_ptrescape_string( res->crt_name ) + "', serial='" + this->escape_string( res->serial ) + "', caId = '" + this->escape_string( read_id ) + "', created=NOW() WHERE id='" + this->escape_string( job->target ) + "' LIMIT 1"; - + std::string q = "UPDATE certs SET crt_name='" + this->escape_string( res->crt_name ) + "', serial='" + this->escape_string( res->serial ) + "', caId = '" + this->escape_string( read_id ) + "', created='" + this->escape_string( res->before ) + "', expire='" + this->escape_string( res->after ) + "' WHERE id='" + this->escape_string( job->target ) + "' LIMIT 1"; // TODO write more thingies back if( query( q ).first ) { @@ -347,3 +346,9 @@ std::pair MySQLJobProvider::getRevocationInfo( std::sh return std::pair( std::string( row[0], row[0] + l[0] ), std::string( row[1], row[1] + l[1] ) ); } + +void MySQLJobProvider::writeBackRevocation( std::shared_ptr job, std::string date ) { + if( query( "UPDATE certs SET revoked = '" + this->escape_string( date ) + "' WHERE id = '" + this->escape_string( job->target ) + "'" ).first ) { + throw "Error while writing back revocation"; + } +}