summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/inspircd.h3
-rw-r--r--include/modules.h2
-rw-r--r--src/commands/cmd_oper.cpp2
-rw-r--r--src/configreader.cpp2
-rw-r--r--src/inspircd.cpp12
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp3
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp9
-rw-r--r--src/modules/m_sslinfo.cpp6
-rw-r--r--src/usermanager.cpp1
9 files changed, 30 insertions, 10 deletions
diff --git a/include/inspircd.h b/include/inspircd.h
index e2eaf8292..78348ed54 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -779,9 +779,10 @@ class CoreExport InspIRCd
/** Attempt to write the process id to a given file
* @param filename The PID file to attempt to write to
+ * @param exitonfail If true and the PID fail cannot be written log to stdout and exit, otherwise only log on failure
* @return This function may bail if the file cannot be written
*/
- void WritePID(const std::string &filename);
+ void WritePID(const std::string& filename, bool exitonfail = true);
/** This constructor initialises all the subsystems and reads the config file.
* @param argc The argument count passed to main()
diff --git a/include/modules.h b/include/modules.h
index 9857012fc..4d4d0871f 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -116,7 +116,7 @@ struct ModResult {
* and numerical comparisons in preprocessor macros if they wish to support
* multiple versions of InspIRCd in one file.
*/
-#define INSPIRCD_VERSION_API 9
+#define INSPIRCD_VERSION_API 10
/**
* This #define allows us to call a method in all
diff --git a/src/commands/cmd_oper.cpp b/src/commands/cmd_oper.cpp
index 1a5e7e178..95f6b98df 100644
--- a/src/commands/cmd_oper.cpp
+++ b/src/commands/cmd_oper.cpp
@@ -69,7 +69,7 @@ CmdResult CommandOper::HandleLocal(const std::vector<std::string>& parameters, L
snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(),user->GetIPString());
OperIndex::iterator i = ServerInstance->Config->oper_blocks.find(parameters[0]);
- if (i != ServerInstance->Config->oper_blocks.end())
+ if ((i != ServerInstance->Config->oper_blocks.end()) && (i->second->oper_block))
{
OperInfo* ifo = i->second;
ConfigTag* tag = ifo->oper_block;
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 5b298ddd8..301db14e8 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -729,7 +729,7 @@ void ServerConfig::Apply(ServerConfig* old, const std::string &useruid)
// write once here, to try it out and make sure its ok
if (valid)
- ServerInstance->WritePID(this->PID);
+ ServerInstance->WritePID(this->PID, !old);
if (old && valid)
{
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 656be220f..0fa90fca5 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -294,7 +294,7 @@ bool InspIRCd::DaemonSeed()
#endif
}
-void InspIRCd::WritePID(const std::string &filename)
+void InspIRCd::WritePID(const std::string& filename, bool exitonfail)
{
#ifndef _WIN32
std::string fname(filename);
@@ -307,10 +307,12 @@ void InspIRCd::WritePID(const std::string &filename)
outfile.close();
}
else
- {
- std::cout << "Failed to write PID-file '" << fname << "', exiting." << std::endl;
- this->Logs->Log("STARTUP",DEFAULT,"Failed to write PID-file '%s', exiting.",fname.c_str());
- Exit(EXIT_STATUS_PID);
+ {
+ if (exitonfail)
+ std::cout << "Failed to write PID-file '" << fname << "', exiting." << std::endl;
+ this->Logs->Log("STARTUP",DEFAULT,"Failed to write PID-file '%s'%s",fname.c_str(), (exitonfail ? ", exiting." : ""));
+ if (exitonfail)
+ Exit(EXIT_STATUS_PID);
}
#endif
}
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 813a8ecfa..2f4acf3f0 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -703,6 +703,9 @@ class ModuleSSLGnuTLS : public Module
if (ret > 0)
{
recvq.append(buffer, ret);
+ // Schedule a read if there is still data in the GnuTLS buffer
+ if (gnutls_record_check_pending(session->sess) > 0)
+ ServerInstance->SE->ChangeEventMask(user, FD_ADD_TRIAL_READ);
return 1;
}
else if (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index b21091d3f..9e6472ac3 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -591,8 +591,15 @@ class ModuleSSLOpenSSL : public Module
if (ret > 0)
{
recvq.append(buffer, ret);
+
+ int mask = 0;
+ // Schedule a read if there is still data in the OpenSSL buffer
+ if (SSL_pending(session->sess) > 0)
+ mask |= FD_ADD_TRIAL_READ;
if (session->data_to_write)
- ServerInstance->SE->ChangeEventMask(user, FD_WANT_POLL_READ | FD_WANT_SINGLE_WRITE);
+ mask |= FD_WANT_POLL_READ | FD_WANT_SINGLE_WRITE;
+ if (mask != 0)
+ ServerInstance->SE->ChangeEventMask(user, mask);
return 1;
}
else if (ret == 0)
diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp
index 2bfe0e1c4..083ac0f04 100644
--- a/src/modules/m_sslinfo.cpp
+++ b/src/modules/m_sslinfo.cpp
@@ -180,6 +180,9 @@ class ModuleSSLInfo : public Module
if (i != ServerInstance->Config->oper_blocks.end())
{
OperInfo* ifo = i->second;
+ if (!ifo->oper_block)
+ return MOD_RES_PASSTHRU;
+
ssl_cert* cert = cmd.CertExt.get(user);
if (ifo->oper_block->getBool("sslonly") && !cert)
@@ -220,6 +223,9 @@ class ModuleSSLInfo : public Module
for(OperIndex::iterator i = ServerInstance->Config->oper_blocks.begin(); i != ServerInstance->Config->oper_blocks.end(); i++)
{
OperInfo* ifo = i->second;
+ if (!ifo->oper_block)
+ continue;
+
std::string fp = ifo->oper_block->getString("fingerprint");
if (fp == cert->fingerprint && ifo->oper_block->getBool("autologin"))
user->Oper(ifo);
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index 76446c5b5..2cb7ad511 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -143,6 +143,7 @@ void UserManager::AddUser(int socket, ListenSocket* via, irc::sockets::sockaddrs
{
ServerInstance->Logs->Log("USERS", DEBUG,"Internal error on new connection");
this->QuitUser(New, "Internal error handling connection");
+ return;
}
/* NOTE: even if dns lookups are *off*, we still need to display this.