CZNC::ExpandConfigPath() handles an empty string as its argument quite well, so
make all those other places use this.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1469 726aef4b-f618-498e-8847-2d620e286838
Without this the restart after the config is written fails, because the file
name it wants to open went through ExpandConfigPath() twice. This lead to a
path like ./some-dir/configs/some-dir/configs.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1468 726aef4b-f618-498e-8847-2d620e286838
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
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
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
This patch fixes the same bug as the last commit and also makes sure that
similar bugs can't happen again.
Thanks to cnu for finding and reporting this bug.
Thanks to kroimon for patch review.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1396 726aef4b-f618-498e-8847-2d620e286838
This shouldn't contain any major behaviour change, but there are some minor
ones. Also, the API for a shared lock wasn't used and thus is dropped.
Thanks to cnu for this idea.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1337 726aef4b-f618-498e-8847-2d620e286838
The old versions didn't do this either and thus we used two slashes.
While this doesn't hurt, it doesn't look good either.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1299 726aef4b-f618-498e-8847-2d620e286838
If the config dir (<datadir>/configs) didn't exist yet, ZNC didn't bother
creating it and thus failed to do write a config.
Thanks to m4v for testing a nightly and for reporting this bug.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1292 726aef4b-f618-498e-8847-2d620e286838
This adds AddVHost, RemVHost and ListVHosts.
If this vhost list (which is the same webadmin uses for displaying drop-down
lists) is none-empty, then users can only set one of these vhosts via SetVHost.
If the list is empty, everything is allowed.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1256 726aef4b-f618-498e-8847-2d620e286838
This should hopefully fix a couple of 'Excess flood' problems we were having.
Thanks to SilverLeo for finally writing this :P
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1177 726aef4b-f618-498e-8847-2d620e286838
I think this is intended to make this more user-friendly. If it is not, well
I think this patch does exactly this, so what?
Thanks to kroimon for the patch.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1173 726aef4b-f618-498e-8847-2d620e286838
The old code used a timer. That timer needed to be restarted if the user list
was changed (adding / removing of users), because it saved an iterator into
that map between runs, which would become invalid.
The new code in CConnectUserTimer::RunJob() is actually more complicated now,
but the iterator is gone. This also means no need to restart that timer
more or less always. ;) (This also means one theoretical source of bugs less)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1143 726aef4b-f618-498e-8847-2d620e286838
This also removes all the code catching those exceptions. There was nothing
which justified these exceptions and removing them doesn't hurt.
ByeBye CException::EX_BadModVersion
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1137 726aef4b-f618-498e-8847-2d620e286838
These changes the format of the 'Pass' config option. The old format is
still accepted. The new format is:
Pass = plain#<plain text password>
Pass = md5#<password hash>
Pass = md5#<hash of password with salt appended>#<salt>#
This also makes ZNC only write configs in the new format.
znc --makeconf and znc --makepass now always generate salted hashes.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1127 726aef4b-f618-498e-8847-2d620e286838
Trim() always removes all trailing and leading spaces and line endings from
that string, so there is no point in this main loop. It will always run once,
anyway.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1124 726aef4b-f618-498e-8847-2d620e286838
CZNC::GetVersion() returns something like '0.057-r1234'.
This also cleans up CZNC::GetTag() a little. A theoretical buffer overflow
less and some higher speed is the result.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1097 726aef4b-f618-498e-8847-2d620e286838
This rephrases one of the questions asked and adds a section to the README that
explains two unclear questions.
This patch is based on a patch from Patrick Matthaei from debian.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1093 726aef4b-f618-498e-8847-2d620e286838
Rehashing didn't always properly restart the connect user timer.
This happened e.g. if rehashing fails because the config file doesn't exist.
To fix this, we restart this timer now in the CZNC::RehashConfig() where it
will *always* happen.
This commit fixes a crash bug! (using an invalid iterator)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1073 726aef4b-f618-498e-8847-2d620e286838