diff --git a/lib/db_base.cpp b/lib/db_base.cpp index d79b7450..a13b0e90 100644 --- a/lib/db_base.cpp +++ b/lib/db_base.cpp @@ -700,6 +700,9 @@ void db_base::showItem() bool db_base::columnHidden(int col) const { + if (pki_x509::disable_netscape && + allHeaders[col]->type == dbheader::hd_v3ext_ns) + return true; return !allHeaders[col]->show; } @@ -744,6 +747,8 @@ void db_base::contextMenu(QContextMenuEvent *e, QMenu *parent, int) current = v3ext; break; case dbheader::hd_v3ext_ns: + if (pki_x509::disable_netscape) + continue; current = v3ns; break; default: diff --git a/lib/pki_x509.cpp b/lib/pki_x509.cpp index 76f55c87..08e674a7 100644 --- a/lib/pki_x509.cpp +++ b/lib/pki_x509.cpp @@ -19,6 +19,8 @@ #include bool pki_x509::dont_colorize_expiries = false; +bool pki_x509::disable_netscape = false; + QPixmap *pki_x509::icon[6] = { NULL, NULL, NULL, NULL, NULL, NULL }; pki_x509::pki_x509(X509 *c) diff --git a/lib/pki_x509.h b/lib/pki_x509.h index c07bdaf1..830adad6 100644 --- a/lib/pki_x509.h +++ b/lib/pki_x509.h @@ -42,6 +42,7 @@ class pki_x509 : public pki_x509super public: static QPixmap *icon[6]; static bool dont_colorize_expiries; + static bool disable_netscape; pki_x509(X509 *c); pki_x509(const pki_x509 *crt); pki_x509(const QString name = ""); diff --git a/ui/Options.ui b/ui/Options.ui index f05fcee4..ad0ad8f5 100644 --- a/ui/Options.ui +++ b/ui/Options.ui @@ -115,6 +115,13 @@ Especially EC and DSA are only defined with SHA1 in the PKCS#11 specification. + + + + Disable legacy Netscape extensions + + + diff --git a/widgets/MW_menu.cpp b/widgets/MW_menu.cpp index d72c6ad9..44773470 100644 --- a/widgets/MW_menu.cpp +++ b/widgets/MW_menu.cpp @@ -271,6 +271,8 @@ void MainWindow::setOptions() translate_dn ? Qt::Checked : Qt::Unchecked); opt->onlyTokenHashes->setCheckState( pki_scard::only_token_hashes ? Qt::Checked : Qt::Unchecked); + opt->disableNetscape->setCheckState( + pki_x509::disable_netscape ? Qt::Checked : Qt::Unchecked); if (!opt->exec()) { delete opt; @@ -303,6 +305,7 @@ void MainWindow::setOptions() pki_x509::dont_colorize_expiries = opt->noColorize->checkState(); translate_dn = opt->transDnEntries->checkState(); pki_scard::only_token_hashes = opt->onlyTokenHashes->checkState(); + pki_x509::disable_netscape = opt->disableNetscape->checkState(); if (flags != getOptFlags()) { flags = getOptFlags(); @@ -311,6 +314,8 @@ void MainWindow::setOptions() mydb.first(); if (!mydb.find(setting, "suppress")) mydb.erase(); + certView->showHideSections(); + reqView->showHideSections(); } if (opt->getStringOpt() != string_opt) { @@ -359,10 +364,12 @@ void MainWindow::setOptFlags_old(QString flags) void MainWindow::setOptFlags(QString flags) { + bool old_disable_netscape = pki_x509::disable_netscape; pki_base::suppress_messages = false; pki_x509::dont_colorize_expiries = false; translate_dn = false; pki_scard::only_token_hashes = false; + pki_x509::disable_netscape = false; foreach(QString flag, flags.split(",")) { if (flag == "suppress_messages") @@ -373,9 +380,15 @@ void MainWindow::setOptFlags(QString flags) translate_dn = true; else if (flag == "only_token_hashes") pki_scard::only_token_hashes = true; + else if (flag == "disable_netscape") + pki_x509::disable_netscape = true; else if (!flag.isEmpty()) fprintf(stderr, "Unkown flag '%s'\n", CCHAR(flag)); } + if (old_disable_netscape != pki_x509::disable_netscape) { + certView->showHideSections(); + reqView->showHideSections(); + } } QString MainWindow::getOptFlags() @@ -390,5 +403,7 @@ QString MainWindow::getOptFlags() flags << "translate_dn"; if (pki_scard::only_token_hashes) flags << "only_token_hashes"; + if (pki_x509::disable_netscape) + flags << "disable_netscape"; return flags.join(","); } diff --git a/widgets/NewX509.cpp b/widgets/NewX509.cpp index 8c9fe5dc..c6308141 100644 --- a/widgets/NewX509.cpp +++ b/widgets/NewX509.cpp @@ -265,6 +265,8 @@ NewX509::NewX509(QWidget *parent) cb->setText(tr("Critical")); } } + if (pki_x509::disable_netscape) + tabWidget->removeTab(4); } void NewX509::setRequest() @@ -1004,7 +1006,8 @@ int NewX509::validateExtensions(QString nconf, QString &result) (void)nconf; try { el = getGuiExt(); - el += getNetscapeExt(); + if (!pki_x509::disable_netscape) + el += getNetscapeExt(); el.delInvalid(); } catch (errorEx &err) { errors += err.getString(); diff --git a/widgets/NewX509_ext.cpp b/widgets/NewX509_ext.cpp index 7b5cf830..26123568 100644 --- a/widgets/NewX509_ext.cpp +++ b/widgets/NewX509_ext.cpp @@ -267,7 +267,8 @@ extList NewX509::getAllExt() extList ne; ne = getGuiExt(); ne += getAdvanced(); - ne += getNetscapeExt(); + if (!pki_x509::disable_netscape) + ne += getNetscapeExt(); return ne; }