Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: znc/znc
base: 55ba59d
...
head fork: znc/znc
compare: 2985efb
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on May 13, 2011
@psychon psychon Warn if a *module message is ignored
Some modules (e.g. webadmin) don't handle messages to *module in any way. Make
it clear to the user why they didn't get any reply back in this case.

Signed-off-by: Uli Schlachter <psychon@znc.in>
eb22965
@psychon psychon Make it possible to use ExpandString-stuff in QuitMsg
You can now use "Uptime: %uptime%" as your quit message, yay!

Signed-off-by: Uli Schlachter <psychon@znc.in>
3034d1f
@psychon psychon Set errno in CListener::Listen()
CSocket doesn't necessarily set errno, but the callers of Listen() assume an
error message in errno.

Signed-off-by: Uli Schlachter <psychon@znc.in>
3e591e7
@psychon psychon Correctly handle excessive web sessions
The old code didn't actually destroy the session, but only made sure we couldn't
use it anymore. What a waste of memory.

This was tested by adding a DEBUG()-call to CWebSock::~CWebSock():

Before this patch:

 Page Request [/]
 Remote IP:   127.0.0.1; discarding session [ca104adaa54f933b6b8394e88e68ab0d22e0fc227ed23e93d1421e4d3fda8211]
 Auto generated session: [d40364e8d0a55432b86a1b2598865c2323e35cc6e77cade35b9a1b7605712ca6]

After this patch:

 Page Request [/]
 Remote IP:   127.0.0.1; discarding session [707e3b262fe47b93d8c796354574506c398cc5b5d84aa2972dc3d031d8f731f5]
 Destroying session [707e3b262fe47b93d8c796354574506c398cc5b5d84aa2972dc3d031d8f731f5, 127.0.0.1 for <unknown>
 Auto generated session: [47de1c82a8b6eaae54a9cc8c29163ab53ec2add7198cf1df7f80506ea1bda2b6]

Obviously, the destructor is only called after this change.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2985efb
Showing with 17 additions and 4 deletions.
  1. +5 −2 IRCSock.cpp
  2. +5 −0 Listener.cpp
  3. +6 −1 Modules.cpp
  4. +1 −1  WebModules.cpp
View
7 IRCSock.cpp
@@ -76,8 +76,11 @@ void CIRCSock::Quit(const CString& sQuitMsg) {
Close(CLT_NOW);
return;
}
- CString sMsg = (!sQuitMsg.empty()) ? sQuitMsg : m_pUser->GetQuitMsg();
- PutIRC("QUIT :" + sMsg);
+ if (!sQuitMsg.empty()) {
+ PutIRC("QUIT :" + sQuitMsg);
+ } else {
+ PutIRC("QUIT :" + m_pUser->ExpandString(m_pUser->GetQuitMsg()));
+ }
Close(CLT_AFTERWRITE);
}
View
5 Listener.cpp
@@ -16,6 +16,7 @@ CListener::~CListener() {
bool CListener::Listen() {
if (!m_uPort || m_pListener) {
+ errno = EINVAL;
return false;
}
@@ -29,6 +30,10 @@ bool CListener::Listen() {
}
#endif
+ // If e.g. getaddrinfo() fails, the following might not set errno.
+ // Make sure there is a consistent error message, not something random
+ // which might even be "Error: Success".
+ errno = EINVAL;
return CZNC::Get().GetManager().ListenHost(m_uPort, "_LISTENER", m_sBindHost, bSSL, SOMAXCONN,
m_pListener, 0, m_eAddr);
}
View
7 Modules.cpp
@@ -493,7 +493,12 @@ void CModule::OnModCommand(const CString& sCommand) {
HandleCommand(sCommand);
}
void CModule::OnUnknownModCommand(const CString& sLine) {
- if (!m_mCommands.empty())
+ if (m_mCommands.empty())
+ // This function is only called if OnModCommand wasn't
+ // overriden, so no false warnings for modules which don't use
+ // CModCommand for command handling.
+ PutModule("This module doesn't implement any commands.");
+ else
PutModule("Unknown command!");
}
View
2  WebModules.cpp
@@ -729,7 +729,7 @@ CSmartPtr<CWebSession> CWebSock::GetSession() {
if (Sessions.m_mIPSessions.count(GetRemoteIP()) > m_uiMaxSessions) {
mIPSessionsIterator it = Sessions.m_mIPSessions.find(GetRemoteIP());
DEBUG("Remote IP: " << GetRemoteIP() << "; discarding session [" << it->second->GetId() << "]");
- Sessions.m_mIPSessions.erase(it);
+ Sessions.m_mspSessions.RemItem(it->second->GetId());
}
CString sSessionID;

No commit comments for this range

Something went wrong with that request. Please try again.