From af0e0a75b927fe7823c95b4d3b1465874b458607 Mon Sep 17 00:00:00 2001 From: Christian Hohnstaedt Date: Thu, 1 Mar 2018 08:28:39 +0100 Subject: [PATCH] Drop dnPolicy for now --- lib/db_x509.cpp | 54 ++------------------------ lib/pki_x509.cpp | 1 - lib/pki_x509.h | 11 +----- ui/CaProperties.ui | 86 +---------------------------------------- widgets/MW_database.cpp | 2 +- 5 files changed, 6 insertions(+), 148 deletions(-) diff --git a/lib/db_x509.cpp b/lib/db_x509.cpp index 51f5b972..cf436a62 100644 --- a/lib/db_x509.cpp +++ b/lib/db_x509.cpp @@ -1057,8 +1057,6 @@ void db_x509::caProperties(QModelIndex idx) { QStringList actions; Ui::CaProperties ui; - QString policy; - int i; pki_x509 *cert = static_cast(idx.internalPointer()); if (!cert) @@ -1082,39 +1080,7 @@ void db_x509::caProperties(QModelIndex idx) ui.certName->setTitle(cert->getIntName()); - QStringList sl; - sl << tr("Type") << tr("Action"); - ui.subjectManager->initCols(sl); - - sl.clear(); - sl << "*"; - foreach(int nid, *MainWindow::dn_nid) - sl << QString(OBJ_nid2ln(nid)); - ui.subjectManager->setKeys(sl, 0); - - actions << "From request" << "From template" << "Erase" << "Match"; - ui.subjectManager->setKeys(actions, 1); - - sl = cert->getDnPolicy().split(","); - - qDebug() << "Policy:" << cert->getDnPolicy(); - ui.subjectManager->deleteAllRows(); - foreach(policy, sl) { - QStringList polKV, l = policy.split(":"); - if (l.size() != 2) - continue; - qDebug() << "Option:" << l[1].toInt(); - if (l[0] == "*") - polKV << "*"; - else - polKV << QString(OBJ_nid2ln(OBJ_sn2nid(CCHAR(l[0])))); - polKV << actions[l[1].toInt()]; - ui.subjectManager->addRow(polKV); - } -#warning Complete dnPolicies - if (dlg->exec()) { - int rows = ui.subjectManager->rowCount(); XSqlQuery q; QSqlError e; Transaction; @@ -1123,29 +1089,15 @@ void db_x509::caProperties(QModelIndex idx) templ = ui.temp->currentPkiItem(); tmplId = templ ? templ->getSqlItemId() : QVariant(); - sl.clear(); - for (i=0; igetRow(i); - int idx = actions.indexOf(l[1]); - if (idx == -1) - continue; - QString first = l[0]; - if (first != "*") - first = OBJ_nid2sn(OBJ_ln2nid(CCHAR(l[0]))); - sl << QString("%1:%2").arg(first).arg(idx); - } - policy = sl.join(","); cert->setTemplateSqlId(tmplId); cert->setCrlDays(ui.days->value()); - cert->setDnPolicy(policy); - SQL_PREPARE(q, "UPDATE authority SET crlDays=?, dnPolicy=?, " + SQL_PREPARE(q, "UPDATE authority SET crlDays=?, " "template=? WHERE item=?"); q.bindValue(0, cert->getCrlDays()); - q.bindValue(1, policy); - q.bindValue(2, tmplId); - q.bindValue(3, cert->getSqlItemId()); + q.bindValue(1, tmplId); + q.bindValue(2, cert->getSqlItemId()); AffectedItems(cert->getSqlItemId()); q.exec(); TransDone(q.lastError()); diff --git a/lib/pki_x509.cpp b/lib/pki_x509.cpp index 81f0e1e5..ec1a1b86 100644 --- a/lib/pki_x509.cpp +++ b/lib/pki_x509.cpp @@ -128,7 +128,6 @@ void pki_x509::restoreSql(QSqlRecord &rec) crlExpire.fromPlain(rec.value(VIEW_x509_auth_crlExpire).toString()); caTemplateSqlId = rec.value(VIEW_x509_auth_template); crlDays = rec.value(VIEW_x509_auth_crlDays).toInt(); - dnPolicy = rec.value(VIEW_x509_auth_dnPolicy).toString(); if (!rec.isNull(VIEW_x509_revocation)) revocation = x509rev(rec, VIEW_x509_revocation); } diff --git a/lib/pki_x509.h b/lib/pki_x509.h index 7d6059ac..cb85c85a 100644 --- a/lib/pki_x509.h +++ b/lib/pki_x509.h @@ -30,7 +30,7 @@ #define VIEW_x509_auth_crlExpire 12 #define VIEW_x509_auth_crlNo 13 #define VIEW_x509_auth_crlDays 14 -#define VIEW_x509_auth_dnPolicy 15 +#define VIEW_x509_auth_dnPolicy_UNUSED 15 #define VIEW_x509_revocation 16 class pki_x509 : public pki_x509super @@ -46,7 +46,6 @@ class pki_x509 : public pki_x509super X509 *cert; void init(); x509rev revocation; - QString dnPolicy; x509revList fromDataRevList; protected: @@ -142,14 +141,6 @@ class pki_x509 : public pki_x509super { return revocation; } - void setDnPolicy(QString policy) - { - dnPolicy = policy; - } - QString getDnPolicy() - { - return dnPolicy; - } pk11_attlist objectAttributes(); bool hasExtension(int nid); bool cmpIssuerAndSerial(pki_x509 *refcert); diff --git a/ui/CaProperties.ui b/ui/CaProperties.ui index 58dca499..d25954ca 100644 --- a/ui/CaProperties.ui +++ b/ui/CaProperties.ui @@ -7,7 +7,7 @@ 0 0 487 - 434 + 238 @@ -81,49 +81,6 @@ - - - - Subject manager - - - - - - - - - - - Add - - - - - - - Delete - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - @@ -177,15 +134,6 @@ - - kvView - QTableView -
widgets/kvView.h
- - addKvRow() - deleteCurrentRow() - -
itemComboTemp QComboBox @@ -226,37 +174,5 @@ - - extDNadd - clicked() - subjectManager - addKvRow() - - - 407 - 113 - - - 363 - 106 - - - - - extDNdel - clicked() - subjectManager - deleteCurrentRow() - - - 399 - 138 - - - 362 - 139 - - - diff --git a/widgets/MW_database.cpp b/widgets/MW_database.cpp index 7d45d1ab..205edfc5 100644 --- a/widgets/MW_database.cpp +++ b/widgets/MW_database.cpp @@ -173,7 +173,7 @@ QSqlError MainWindow::initSqlDB() "crlExpire " DB_DATE ", " /* CRL expiry date */ "crlNo INTEGER, " /* Last CRL Number */ "crlDays INTEGER, " /* CRL days until renewal */ - "dnPolicy VARCHAR(1024), " /* DistinguishedName policy */ + "dnPolicy VARCHAR(1024), " /* DistinguishedName policy (UNUSED) */ "FOREIGN KEY (item) REFERENCES items (id), " "FOREIGN KEY (template) REFERENCES items (id)) "