Drop dnPolicy for now

This commit is contained in:
Christian Hohnstaedt 2018-03-01 08:28:39 +01:00
parent 7a553da38a
commit af0e0a75b9
5 changed files with 6 additions and 148 deletions

View File

@ -1057,8 +1057,6 @@ void db_x509::caProperties(QModelIndex idx)
{
QStringList actions;
Ui::CaProperties ui;
QString policy;
int i;
pki_x509 *cert = static_cast<pki_x509*>(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; i<rows; i++) {
QStringList l = ui.subjectManager->getRow(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());

View File

@ -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);
}

View File

@ -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);

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>487</width>
<height>434</height>
<height>238</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
@ -81,49 +81,6 @@
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Subject manager</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="kvView" name="subjectManager"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QPushButton" name="extDNadd">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="extDNdel">
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="certName">
<layout class="QVBoxLayout" name="verticalLayout">
@ -177,15 +134,6 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>kvView</class>
<extends>QTableView</extends>
<header>widgets/kvView.h</header>
<slots>
<slot>addKvRow()</slot>
<slot>deleteCurrentRow()</slot>
</slots>
</customwidget>
<customwidget>
<class>itemComboTemp</class>
<extends>QComboBox</extends>
@ -226,37 +174,5 @@
</hint>
</hints>
</connection>
<connection>
<sender>extDNadd</sender>
<signal>clicked()</signal>
<receiver>subjectManager</receiver>
<slot>addKvRow()</slot>
<hints>
<hint type="sourcelabel">
<x>407</x>
<y>113</y>
</hint>
<hint type="destinationlabel">
<x>363</x>
<y>106</y>
</hint>
</hints>
</connection>
<connection>
<sender>extDNdel</sender>
<signal>clicked()</signal>
<receiver>subjectManager</receiver>
<slot>deleteCurrentRow()</slot>
<hints>
<hint type="sourcelabel">
<x>399</x>
<y>138</y>
</hint>
<hint type="destinationlabel">
<x>362</x>
<y>139</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -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)) "