new command «certificate» to install CA certificate for SSL - file needs to be open ...

master
Marc Wäckerlin 10 years ago
parent 1a0a0ed0cd
commit 0838a24b51
  1. 3
      src/commands.hxx

@ -1421,7 +1421,8 @@ class Certificate: public Command {
Logger log(this, script); Logger log(this, script);
QString filename(script->replacevars(_filename)); QString filename(script->replacevars(_filename));
QFile cacertfile(filename); QFile cacertfile(filename);
if (!cacertfile.exists()) throw FileNotFound(filename); if (!cacertfile.exists() || !cacertfile.open(QIODevice::ReadOnly))
throw FileNotFound(filename);
QSslCertificate cacert(&cacertfile); QSslCertificate cacert(&cacertfile);
if (cacert.isNull()) throw NotACertificate(filename); if (cacert.isNull()) throw NotACertificate(filename);
QSslSocket::addDefaultCaCertificate(cacert); QSslSocket::addDefaultCaCertificate(cacert);

Loading…
Cancel
Save