Add option for disabling the very very legacy Netscape extensions

Maybe this setting will become the default in future releases....
This commit is contained in:
Christian Hohnstaedt 2015-04-09 17:23:02 +02:00
parent c5833ebe69
commit 698c10216f
7 changed files with 36 additions and 2 deletions

View File

@ -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:

View File

@ -19,6 +19,8 @@
#include <openssl/rand.h>
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)

View File

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

View File

@ -115,6 +115,13 @@ Especially EC and DSA are only defined with SHA1 in the PKCS#11 specification.</
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="disableNetscape">
<property name="text">
<string>Disable legacy Netscape extensions</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">

View File

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

View File

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

View File

@ -267,7 +267,8 @@ extList NewX509::getAllExt()
extList ne;
ne = getGuiExt();
ne += getAdvanced();
ne += getNetscapeExt();
if (!pki_x509::disable_netscape)
ne += getNetscapeExt();
return ne;
}