Commit Graph

254 Commits

Author SHA1 Message Date
psychon
e2b91a32c9 Move some common pid file code into new InitPidFile()
Patch by reed, thanks again. :)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1929 726aef4b-f618-498e-8847-2d620e286838
2010-04-24 08:34:33 +00:00
psychon
eb44919005 Move CListener and CRealListener into their own files
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1924 726aef4b-f618-498e-8847-2d620e286838
2010-04-15 16:52:30 +00:00
cflakes
f5c2528c87 Do not create empty directories if one does ./znc --datadir=NON_EXISTING_DIR
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1878 726aef4b-f618-498e-8847-2d620e286838
2010-04-04 15:58:04 +00:00
psychon
505bdd1e78 Entirely my fault, sorry :(
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1867 726aef4b-f618-498e-8847-2d620e286838
2010-04-01 08:41:57 +00:00
psychon
cac29752cf Add functions for modifing the ports on which znc listens
Patch is based on a patch from BrianC, thanks a lot.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1866 726aef4b-f618-498e-8847-2d620e286838
2010-04-01 08:39:10 +00:00
psychon
260c42fbe0 CRealListener: Inform CListener about being destroyed
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1865 726aef4b-f618-498e-8847-2d620e286838
2010-04-01 08:28:45 +00:00
cflakes
b9abdf06f4 Remember "automatically connect + reconnect" flag across restarts by writing it to the config file.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1852 726aef4b-f618-498e-8847-2d620e286838
2010-03-30 09:24:24 +00:00
psychon
72293bed64 Oh look, invisible, pink unicorns!
No really, over there! You really should take a look. Come on, I'm not messing
with you. There really are those IPU (invisible pink unicorns) right behind you.
DarthGandalf found them. Oh, now they flew away. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1850 726aef4b-f618-498e-8847-2d620e286838
2010-03-29 19:29:20 +00:00
psychon
5d2f3a03d0 Make OnConfigLine() a user module hook
It's only called for stuff defined in that user's section. The stuff outside of
a user section still can only be caught by global modules.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1849 726aef4b-f618-498e-8847-2d620e286838
2010-03-29 19:23:48 +00:00
psychon
c3728f4cb3 Fix a crash with WebMods and deleting User
If a user who is currently logged in to WebMods is deleted, his CWebSession
still kept a stale CUser pointer around. The next time he loaded a web page,
Bad Things(tm) happened.

This is fixed by deleting all of a user's sessions when that user is deleted.

Thanks to DarthGandalf for spotting the bug and writing the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1827 726aef4b-f618-498e-8847-2d620e286838
2010-03-11 17:29:36 +00:00
psychon
7bff1c4d7c Change the default ConnectDelay from 30s to 5s
Now that we have the new ServerThrottle, we should be able to live with this
higher connect rate. Connecting lots of users is still awfully slow. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1822 726aef4b-f618-498e-8847-2d620e286838
2010-03-10 13:28:15 +00:00
cflakes
ca48efc0a0 Fix previous commit. That's why I said let psychon do it. Hahaha.
Seriously though, why does stuff return TRUE when it fails and FALSE when everything's fine? Pretty weird.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1821 726aef4b-f618-498e-8847-2d620e286838
2010-03-10 01:35:47 +00:00
cflakes
28022ca771 Added a new module hook
EModRet OnAddUser(CUser& User, CString& sErrorRet)
for global modules. Idea by BrianC.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1820 726aef4b-f618-498e-8847-2d620e286838
2010-03-09 20:24:43 +00:00
psychon
2ca15364d4 Use Listen and Listen4 in --makeconf
Before this, --makeconf used "Listen" if you said "no" to "do you want ipv6?"
and "Listen6" else. Since yesterday, "Listen" means "v4 and v6 please" (thanks
to DarthGandalg) which means we now use "Listen4" for "no" and "Listen" else.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1817 726aef4b-f618-498e-8847-2d620e286838
2010-03-09 16:47:07 +00:00
psychon
6acaebf775 Add "Listen4" config option
"Listen6" and "Listen4" now do what the name implies and "Listen" listens on
both ipv4 and ipv6 (unless a bind host was set which forces something
different).

This also changes webadmin appropriately.

Thanks to DarthGandalf for the idea and the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1816 726aef4b-f618-498e-8847-2d620e286838
2010-03-08 17:23:53 +00:00
psychon
b0128cf130 Add new module calls for writing config entries
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1803 726aef4b-f618-498e-8847-2d620e286838
2010-03-04 13:20:44 +00:00
psychon
f72e2f8abd Remove --disable-modules
ZNC without modules is like rain without being inside,
you really don't want that!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1794 726aef4b-f618-498e-8847-2d620e286838
2010-02-25 12:29:40 +00:00
prozacx
ad92c58c42 Initial commit of webmods - still lots of work to be done
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1784 726aef4b-f618-498e-8847-2d620e286838
2010-02-22 07:40:22 +00:00
psychon
115b170890 Another patch by DarthGandalf, thanks
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1777 726aef4b-f618-498e-8847-2d620e286838
2010-02-19 17:06:42 +00:00
psychon
291ad47907 Use empty() instead of size() == 0 where appropriate
This was found by cppcheck (cppcheck.sf.net).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1761 726aef4b-f618-498e-8847-2d620e286838
2010-02-18 12:39:41 +00:00
psychon
702faeeed5 Revert r1738-1742
This broke webadmin, changed CString::Token()'s behavior possibly breaking a lot
of stuff just before a release and added an unused config entry.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1748 726aef4b-f618-498e-8847-2d620e286838
2010-02-08 13:49:44 +00:00
prozacx
166f08e671 Added global/user level skin settings which will be used by a future commit of webmods
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1742 726aef4b-f618-498e-8847-2d620e286838
2010-02-07 05:06:40 +00:00
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