Added some error checking and fixes a bug where the exclusive lock we use on
the config file was removed. This was because we made the kernel allocate a
new inode for the config while our lock was still on the old version of the
config file. This should now be fixed.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1457 726aef4b-f618-498e-8847-2d620e286838
This adds a new file defines.h and moves all the Csocket specific stuff from
main.h into this new file.
Then this makes Csocket use ZNC's DEBUG() macro for its debug output which
means this can now also be enabled by running znc --debug.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1445 726aef4b-f618-498e-8847-2d620e286838
This enables the debug output you get with --enable-debug on --disable-debug
builds. The behaviour if znc was compiled with --disable-debug isn't changed.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1442 726aef4b-f618-498e-8847-2d620e286838
This argument makes znc not fork into the background. It has no effect if
configure is called with --enable-debug, znc will always stay in the foreground
in this case.
The hunk at the end of main.cpp is just whitespace stuff. The only difference
in there is that #ifdef _DEBUG #else #endif is changed into
if (bForeground) { } else { } (which makes this whitespace stuff necessary).
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1441 726aef4b-f618-498e-8847-2d620e286838
Use ToUInt to convert the string, since we're actually using an
unsigned integer. And use ToBool for consistency.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1440 726aef4b-f618-498e-8847-2d620e286838
This was found via partyline and notify_connect. notify_connect calls
CZNC::Broadcast() in OnClientLogin() which calls the OnBroadcast() module call.
When returning from this module calls, m_pUser and m_pClient was reset to NULL
and all the following modules got their OnClientLogin() called with m_pUser and
m_pClient set to NULL.
This patch fixes this by resetting those vars to their old values instead to
NULL when returning from a module call.
This patch also fixes the bug that m_pUser and m_pClient in modules were reset
to NULL after they caused a module call which called back into the current
module. The fix looks similar to the other one (this one is the Modules.h part).
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1438 726aef4b-f618-498e-8847-2d620e286838
CZNC::Loop() never returns a value, the only way it can return is through
some throws (e.g. for restart or shutdown).
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1434 726aef4b-f618-498e-8847-2d620e286838
The old code created a copy of the config file before writing a new version.
This backup is now gone.
With this patch the config is written to a temporary file znc.conf~ and then
fsync()d to make sure the data safely is on the disk. Then the real config file
znc.conf is overwritten with this temporary file via a rename() call.
This should be safer than the old way, plus it gets rid of a unneeded file.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1432 726aef4b-f618-498e-8847-2d620e286838
While experimenting with some warning flags I found another one which breaks
the perl headers. This warning is triggered by code like this:
void bla();
void bla();
Sadly, the perl headers do this for some weird reason :(
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1427 726aef4b-f618-498e-8847-2d620e286838
This removes svn:eol-style from configure since it now contains
this in line 4122 (\r is a literal mac line ending):
ac_cr='\r'
This confused subversion. Bad svn, bad!
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1426 726aef4b-f618-498e-8847-2d620e286838
The admin module is now able to set a user's password. Furthermore
fixed a bug if now username was specified for the 'Get' or 'Set'
command.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1423 726aef4b-f618-498e-8847-2d620e286838
Since CSmartPtr::GetCount returns a pointer to unsigned int it's
possible to manually change the reference count from outside.
Increasing the reference count will result in a memory leak and
decreasing will produce undefined behaviour.
GetCount now returns a pointer to const unsigned int to fix this.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1422 726aef4b-f618-498e-8847-2d620e286838
When the module was compiled for a wrong ZNC version it's description will
say so. Everything which displays a list of available modules together with
their description will display this (--makeconf, /msg *status listavailmods,
webadmin).
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1420 726aef4b-f618-498e-8847-2d620e286838
This command allows admins to really reload a module when they have updated it.
Because the dynamic linker does not really reload a shared object until all
handles to this object where dlclose()'d, this new command is necessary.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1418 726aef4b-f618-498e-8847-2d620e286838
Before this, you only got a message from *status when someone tried to login
with a bad password and no auth module (imapauth/saslauth) was loaded.
With this patch every failed login will generate a message.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1415 726aef4b-f618-498e-8847-2d620e286838
One needs to be admin to change the current skin dir, but it still sounds
like a good idea to be careful...
Plus, this wont deny symlinks anyway!
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1412 726aef4b-f618-498e-8847-2d620e286838
With the current implementation of CString::Base64Decode the following
code would fail (meaning b would be false):
CString t = "some very long string ...";
bool b = (t == t.Base64Encode_n(true).Base64Decode_n());
The same code without wrapping the base64 output would give b = true
as expected.
The new implementation removes all new lines before decoding so
decoding a wrapped base64 text gives the expected result.
Furthermore replaced malloc and free with new and delete and removed
the check for p in CString::Base64Encode since new will throw if it
failed.
The changes don't affect any existing code.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1410 726aef4b-f618-498e-8847-2d620e286838