Permalink
Browse files

Merge pull request #153 from stefanha/wahjamsrv-ssl-verify

  wahjamsrv: add SslVerify yes/no option
  • Loading branch information...
stefanha committed Aug 29, 2017
2 parents ce0ad78 + 7e39fcd commit 102531baabbbe1891623e7af87731b5979d54029
Showing with 21 additions and 0 deletions.
  1. +7 −0 server/Server.cpp
  2. +1 −0 server/Server.h
  3. +13 −0 server/ninjamsrv.cpp
View
@@ -96,6 +96,13 @@ bool Server::setConfig(ServerConfig *config_)
{
config = config_;
/* Enable/disable SSL certificate verification */
QSslConfiguration sslConfig = QSslConfiguration::defaultConfiguration();
sslConfig.setPeerVerifyMode(config->sslVerify ?
QSslSocket::AutoVerifyPeer :
QSslSocket::QueryPeer);
QSslConfiguration::setDefaultConfiguration(sslConfig);
group->m_max_users = config->maxUsers;
if (!group->m_topictext.Get()[0]) {
group->m_topictext.Set(config->defaultTopic.Get());
View
@@ -87,6 +87,7 @@ struct ServerConfig
WDL_PtrList<UserPassEntry> userlist;
QUrl jammrApiUrl;
QString jammrServerName;
bool sslVerify;
};
class Server : public QObject
View
@@ -425,6 +425,18 @@ static int ConfigOnToken(ServerConfig *config, LineParser *lp)
config->jammrApiUrl.setPassword(lp->gettoken_str(3));
config->jammrServerName = lp->gettoken_str(4);
}
else if (token == QString("SslVerify").toLower())
{
if (lp->getnumtokens() != 2) {
return -1;
}
int x=lp->gettoken_enum(1,"no\0yes\0");
if (x < 0) {
return -2;
}
config->sslVerify = x;
}
else return -3;
return 0;
}
@@ -468,6 +480,7 @@ static int ReadConfig(ServerConfig *config, char *configfile)
config->acl.clear();
config->jammrApiUrl.clear();
config->jammrServerName.clear();
config->sslVerify = true;
int x;
for(x=0; x < config->userlist.GetSize(); x++)

0 comments on commit 102531b

Please sign in to comment.