Commit Graph

232 Commits

Author SHA1 Message Date
cflakes
207478d38b Update to the makeconf procedure... We now only ask for 9 common modules, instead of for all 20 or 30.
This will keep people from loading the sample or saslauth (or away) modules and thereby avoid stupid questions.

Instead of listing and asking for all modules, we only show the most widely used ones plus "And X other (uncommon) modules. You can enable those later.".

To add a module, append its name to the array in CZNC::FilterUncommonModules().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1706 726aef4b-f618-498e-8847-2d620e286838
2010-01-11 12:49:00 +00:00
silverleo
6b07726e9b Partly revert r1702 and introduce a new setting ServerThrottle.
ServerThrottle determines how long znc waits before it tries to connect to the same server again.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1705 726aef4b-f618-498e-8847-2d620e286838
2010-01-10 18:50:39 +00:00
silverleo
752f19c96b Change ConnectDelay to be server specific and not global.
This way users that connect to different servers can connect faster.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1702 726aef4b-f618-498e-8847-2d620e286838
2010-01-10 12:32:34 +00:00
silverleo
07d7477dec It's 2010, where's my hoverboard?
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1693 726aef4b-f618-498e-8847-2d620e286838
2010-01-06 09:37:05 +00:00
psychon
d08829eecb Restart the CConnectUserTimer after a rehash
That way new ConnectDelay settings are applied immediately, not after the timer
is restart next due to sth else.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1679 726aef4b-f618-498e-8847-2d620e286838
2009-12-18 16:59:28 +00:00
psychon
ec6964cb2c ISpoofFormat: Go through ExpandString()
ISpoofFormat now can be used with e.g. %user% which allows some kind of
poor-man's DenySetIdent (force ident to be user name).

For backward compatibility, if ExpandString() doesn't change the string we just
replace all "%" with the user's ident.

Thanks to DarthGandalf for the idea and the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1670 726aef4b-f618-498e-8847-2d620e286838
2009-11-29 15:17:39 +00:00
psychon
c1ee724829 Rewrite znc.conf on SIGUSR1
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1666 726aef4b-f618-498e-8847-2d620e286838
2009-11-20 15:38:21 +00:00
psychon
3f493072b3 OnIRCConnecting(): Log abort-by-module
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1652 726aef4b-f618-498e-8847-2d620e286838
2009-10-20 16:53:22 +00:00
psychon
ade1ee5418 Add a new DCCVHost config option
If this option is set to an ip address, this one is used as the local address
for DCC connections. This can e.g. be used to "fix" DCC bouncing with ipv6
connections. Without it, this just more or less fails badly.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1647 726aef4b-f618-498e-8847-2d620e286838
2009-10-10 12:45:25 +00:00
psychon
d0a38e41ab Add a new module hook OnIRCConnecting
This hook is called just before some user tries to connect() to an IRC server.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1638 726aef4b-f618-498e-8847-2d620e286838
2009-09-26 14:49:15 +00:00
psychon
79212882e3 Fix a theoretical crash on shutdown
CZNC::~CZNC() set its pointer to the CConnectUserTimer to NULL and then called
the manager's Cleanup(). If some destructor that is called from here then calls
EnableConnectUser(), a new CConnectUserTimer is created and its address is
saved. But since the manager is destroying all timers, this pointer will soon
become dangling and might crash us later on.

This is solved by clearing CZNC's pointer in CConnectUserTimer's destructor.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1624 726aef4b-f618-498e-8847-2d620e286838
2009-09-10 18:27:56 +00:00
psychon
cd63bae006 Add sha256 support
This imports the sha256 code from http://www.ouah.org/ogay/sha2/ (The other
hashes from sha-2 were removed). sha256 is a much stronger hashing algorithm
than md5 is (There were successful birthday attacks against md5).

All the code now defaults to creating sha256 salted hashes (The salting used is
the same as before).

Old znc.conf files can still be read.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1618 726aef4b-f618-498e-8847-2d620e286838
2009-09-07 18:55:07 +00:00
psychon
6a36100447 Move CZNC::FindModPath() to CModules
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1611 726aef4b-f618-498e-8847-2d620e286838
2009-08-23 11:05:22 +00:00
psychon
4fd1b09f7f Fix some startup error messages
We should *never* use exit(0); on error and it doesn't hurt if our error
messages use a similar wording.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1585 726aef4b-f618-498e-8847-2d620e286838
2009-08-01 09:06:20 +00:00
psychon
165070019d Add new config option AnonIPLimit
This makes the limit added in r1561 configurable.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1563 726aef4b-f618-498e-8847-2d620e286838
2009-07-12 11:31:49 +00:00
psychon
b25e65dbb6 Add a limit of 10 unidentified connections per IP
Everything which isn't a CClient with a successful login counts as an
unidentified connection in this context. Modules who don't want this kind of
limit on their listening sockets can override CSocket::ConnectionFrom(), but
their sockets will still count towards this limit.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1561 726aef4b-f618-498e-8847-2d620e286838
2009-07-10 13:27:55 +00:00
psychon
aa5bd3b73b Fix a possible crash if users are deleted
If a user is deleted while it is trying to connect to an IRC server, the IRC
socket wasn't deleted together with the user. At some later point in time, the
IRC socket will try to use the user object, which was already freed by now.

Fix this by erasing IRC sockets together with their user object.

Thanks to cnu for reporting this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1557 726aef4b-f618-498e-8847-2d620e286838
2009-07-06 16:25:25 +00:00
psychon
85dce87d6a Traffic API breakage again
The last commit broke the order in which the traffic stats used to be displayed
and it turns out that KiNgMaR cannot live with that, so now we are back to the
old order.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1523 726aef4b-f618-498e-8847-2d620e286838
2009-05-27 10:49:48 +00:00
psychon
f36ad9e6e7 Change the API for getting traffic stats
We now have a central function CZNC::GetTrafficStats() which does all the ugly
stuff and just returns the data which the caller can then display. We now also
include all unknown sockets (e.g. imapauth or webadmin sockets) in the traffic
stats in the "<ZNC>" section.

The only downside to all this gloriousness is that this breaks the ordering of
/msg *status traffic which is now sorted alphabetically which means that <ZNC>
<Users> and <Total> aren't anymore in the places in which they used to be.
I hope one can live with that...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1521 726aef4b-f618-498e-8847-2d620e286838
2009-05-26 18:38:58 +00:00
psychon
a8f8fade57 Fix some color escapes in znc --no-color --makeconf
(Well, is bold a color?...)

Thanks to KiNgMaR for finding this and providing a patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1519 726aef4b-f618-498e-8847-2d620e286838
2009-05-26 11:54:21 +00:00
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