Commit Graph

212 Commits

Author SHA1 Message Date
psychon
b03f495b2b Remove znc --encrypt-pem
ZNC can't read encrypted pem files, so it's kinda pointless that it can
generate those...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1495 726aef4b-f618-498e-8847-2d620e286838
2009-04-24 16:47:49 +00:00
psychon
e553116891 Print more useful error messages when binding a listening port fails
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1483 726aef4b-f618-498e-8847-2d620e286838
2009-04-07 06:48:51 +00:00
psychon
ef27fee39b Remove some places where "znc.conf" is mentioned needlessly
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
2009-03-31 12:34:07 +00:00
psychon
de2f07ecc4 Make znc --datadir some-dir --makeconf work
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
2009-03-31 12:25:24 +00:00
psychon
eb0d9d439e Some changes to the code rewriting znc.conf
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
2009-03-30 18:28:09 +00:00
psychon
cfdf299ae4 Remove some unneeded stuff from the --makeconf code
The ".so" suffix was already stripped in GetAvailableMods().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1452 726aef4b-f618-498e-8847-2d620e286838
2009-03-29 16:25:17 +00:00
psychon
27a51fcec7 Some minor stuff, again found via icc's "remarks"
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1436 726aef4b-f618-498e-8847-2d620e286838
2009-03-21 09:32:50 +00:00
psychon
e64b2549f5 Change CZNC::Loop()'s return type to void
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
2009-03-19 16:25:33 +00:00
psychon
e51189ea43 Get rid of znc.conf-backup
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
2009-03-18 15:45:43 +00:00
psychon
994da49638 Remove a mostly unused flag from CModInfo
Nobody cares if a module is found in ~/.znc/modules or in /usr/lib/znc/, right?


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1417 726aef4b-f618-498e-8847-2d620e286838
2009-03-09 17:21:01 +00:00
psychon
0015098ab3 Always notify the user when someone else tried to login but was rejected
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
2009-03-07 12:37:38 +00:00
psychon
ea569a2bdc CZNC::AddUser(): Always set the error return on a useful value
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1406 726aef4b-f618-498e-8847-2d620e286838
2009-03-01 16:43:58 +00:00
psychon
3188856a86 Don't write unexpected newlines to znc.conf
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
2009-02-24 16:02:35 +00:00
psychon
7ef9f76bb0 Open the ISpoofFile with mode 'O_RDWR|O_CREAT' instead of '(int)true'
This fixes a bug from r1337


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1352 726aef4b-f618-498e-8847-2d620e286838
2009-01-27 19:54:38 +00:00
psychon
235b10c200 Use that new define everywhere
Now there are no uses of DEBUG_ONLY() left :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1349 726aef4b-f618-498e-8847-2d620e286838
2009-01-25 16:51:54 +00:00
psychon
48ee5c71c5 Check in CZNC::AddUser() if the username is still available
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1346 726aef4b-f618-498e-8847-2d620e286838
2009-01-25 11:12:36 +00:00
psychon
127347825e Remove CLockFile and let CFile do its job
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
2009-01-20 13:21:29 +00:00
psychon
607a7f1c16 Get rid of most strtoul() and atoi() calls and use CString's features instead
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1320 726aef4b-f618-498e-8847-2d620e286838
2009-01-04 10:48:02 +00:00
psychon
08ad0291ea Happy New Year 2009 everyone!
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1317 726aef4b-f618-498e-8847-2d620e286838
2009-01-01 12:22:21 +00:00
psychon
fd5dd4c3b6 Don't append a slash to the paths returns from CZNC::Get*Path()
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
2008-12-21 17:10:25 +00:00
psychon
804b259f69 Fix a bug introduced in r1289
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
2008-12-17 15:36:47 +00:00
psychon
4b1fbab6eb Remove CZNC::GetConfPath() and rework GetModPath() and GetUserPath()
This removes some unneeded variables.
Idea by kroimon.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1289 726aef4b-f618-498e-8847-2d620e286838
2008-12-12 15:38:57 +00:00
psychon
c03bd91589 Update to latest Csocket and use its new init interface
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1288 726aef4b-f618-498e-8847-2d620e286838
2008-12-10 15:53:07 +00:00
psychon
8db106bf6b Remove our only getcwd() call
We now no longer depend on PATH_MAX which is not defined by POSIX.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1286 726aef4b-f618-498e-8847-2d620e286838
2008-12-07 14:18:23 +00:00
psychon
ce31b29b68 Some changes to the vhost interface from *status
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
2008-10-20 13:00:54 +00:00
psychon
4bd90ab9df Make --makeconf check for znc.pem and generate it if it's missing
This patch is based on ideas and an actual patch from
the-me aka Patrick Matthäi. Thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1246 726aef4b-f618-498e-8847-2d620e286838
2008-10-11 15:43:30 +00:00
kroimon
5237a24747 Use CString::Equals() everywhere.
* (CString::CaseCmp() == 0) became CString::Equals()
* (CString::CaseCmp() != 0) became !CString::Equals()
* replaced some occurrences of strn?casecmp

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1234 726aef4b-f618-498e-8847-2d620e286838
2008-09-30 15:15:59 +00:00
kroimon
3b8134c3b0 Another whitespace/tab mixup fix.
Hopefully the last one...
Again, no functional changes in this commit.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1219 726aef4b-f618-498e-8847-2d620e286838
2008-09-27 14:42:34 +00:00
psychon
87a368cb64 Improve both, the code's and the debug output's easy-to-readyiness
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1198 726aef4b-f618-498e-8847-2d620e286838
2008-09-12 15:41:12 +00:00
psychon
92fb0ac62f Small cleanup, removed two unused variables
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1196 726aef4b-f618-498e-8847-2d620e286838
2008-09-12 12:55:03 +00:00
kroimon
d1b3c2b94d Removed AutoCycle from core
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1191 726aef4b-f618-498e-8847-2d620e286838
2008-09-07 11:23:57 +00:00
psychon
da8c892d4f Add a config option 'MaxJoins' to limit the number of joins ZNC does at once
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
2008-08-29 15:06:08 +00:00
psychon
cc5c771699 Some changes to CZNC::WriteNewConfig (znc --makeconf)
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
2008-08-26 13:54:17 +00:00
psychon
ef31d6e239 Connect and reconnect faster to IRC
The first reconnect now happens when the timer is created which is
possibly thanks to latest Csocket.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1161 726aef4b-f618-498e-8847-2d620e286838
2008-08-21 10:47:09 +00:00
psychon
03e34ac6e6 Remove KeepNick
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1151 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 11:34:11 +00:00
psychon
abeba8aea7 Simplify the connect user code a little
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
2008-07-22 11:34:38 +00:00
psychon
10210e4619 Don't throw any exceptions in CModules::LoadModule() on version mismatch
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
2008-07-17 12:01:44 +00:00
psychon
86924339a3 Add some 'const' attributes to various functions
No real changes in here, only way more constness...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1129 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 08:13:06 +00:00
psychon
bf2bd39769 Add supports for salted hashes to znc.conf
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
2008-07-13 15:32:27 +00:00
psychon
3b0a4dc4b5 Config reading: Apply a small (unnoticeable) optimization
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
2008-07-11 09:58:04 +00:00
psychon
0bd4927d2c Unify some of the webadmin and client authentication code in CZNC::AuthUser()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1114 726aef4b-f618-498e-8847-2d620e286838
2008-07-07 18:34:32 +00:00
psychon
5c7b586b2d Make it more clear where the 'IRCConnectEnabled'-flag is checked
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1111 726aef4b-f618-498e-8847-2d620e286838
2008-07-03 10:16:49 +00:00
psychon
b2512e55ea Display the uptime in a more readable way
This adds CString::ToTimeStr() which converts a number of seconds into
a human readable time string.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1107 726aef4b-f618-498e-8847-2d620e286838
2008-06-27 09:55:55 +00:00
psychon
bcf59c56ea Add and use CZNC::GetUptime() for getting the current uptime in human readable
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1098 726aef4b-f618-498e-8847-2d620e286838
2008-06-19 08:39:10 +00:00
psychon
d397cb8ad2 Add CZNC::GetVersion()
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
2008-06-17 08:25:04 +00:00
psychon
78f8cce2c6 Add 'Uptime' command to *znc
ToDo: Use some readable format for displaying the uptime. Seconds just
don't make it.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1095 726aef4b-f618-498e-8847-2d620e286838
2008-06-17 07:52:56 +00:00
psychon
b475f5d69e Make --makeconf more clear
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
2008-06-14 16:17:46 +00:00
psychon
e08cb72646 Also use /etc/passwd if $HOME is set but empty
Before this, we used ./.znc as datadir in this case. Not good.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1081 726aef4b-f618-498e-8847-2d620e286838
2008-06-03 06:32:18 +00:00
psychon
5c39502342 Fix restarting of the connect user timer during rehashing
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
2008-05-26 14:59:41 +00:00
psychon
d0f33f8b1c The instructions at the end of makeconf showed a wrong port
This was broken since r964 from Feb 2008.

Thanks to fred for finding this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1072 726aef4b-f618-498e-8847-2d620e286838
2008-05-26 14:56:23 +00:00