Commit Graph

130 Commits

Author SHA1 Message Date
Kyle Fuller
fec1a3fe91 Add CIRCNetwork which now hold each IRC Connection.
This allows a user to have multiple networks.

A user can login as a network by supplying PASS [user[/network]:]pass or
USER user[/network] on connect. A user can also switch between networks
by using /msg *status JumpNetwork <network>
2011-08-24 19:07:26 +01:00
Alexey Sokolov
88033a5b3e Save listeners as a section in znc.conf 2011-08-22 03:05:11 +07:00
Kyle Fuller
c456d20b21 Merge CGlobalModule(s) into CModule(s) 2011-08-21 13:34:22 +01:00
Michael Edgar
a9ba4020db Added a global config option for IP-based session protection.
The new setting defaults to true, and is settable in the web admin panel. When
set to false, IP address checks are ignored. For users behind proxies (students,
large corporate networks) that don't guarantee a consistent IP, this makes the
web admin panel much more usable.
2011-04-13 20:24:26 -04:00
Uli Schlachter
8e59f75125 Don't include FileUtils.h in znc.h or Modules.h
Both these headers only really need CFile* which can be handled with a forward
declaration.

To make this possible, some methods are moved from the header file into the
corresponding implementation file, because they used CFile or CDir static
members.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-03 10:21:59 +02:00
Uli Schlachter
70c7745899 Overhaul the config parsing
This moves stuff to a two-step model. First, the new class CConfig reads the
config file, parses it and creates a in-memory model of stuff. Only then do we
actually go forward and apply the stuff.

The upside of this is that some config errors are caught before we change
anything on the running upside.

Let's see how much stuff this broke...

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-01 21:43:05 +02:00
Uli Schlachter
a4d388b56d Improve lock file error handling
When we have an error during rehashing / config writing, we continue keeping the
old lock around since we haven't gotten rid of that one yet.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 19:07:36 +02:00
Kyle Fuller
703f2cd5bb Remove ident spoof from znc core 2011-03-30 19:16:53 +01:00
Uli Schlachter
000efa6be3 Don't try connecting users if the ISpoof is locked
This fixes various issues with slow connecting users. E.g. the users caused
themselves to be added to the ConnectThrottle map even though they didn't
actually try to connect.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-28 21:17:18 +02:00
Uli Schlachter
f9ffe6f417 Move m_sHomePath from CZNC to CFile
Thanks to this change, linking the following object files produces no unresolved
symbols: FileUtils.o Utils.o ZNCString.o MD5.o SHA256.o

The idea here is that ZNC is a little better modularized.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-28 21:05:39 +02:00
Uli Schlachter
ce10cee260 Correctly handle "~" in SSLCertFile
This works correctly because only the config writing/reading accesses
CZNC::m_sSSLCertFile directly, everything else goes through this getter.

This ChangeDir() call will also "sanitize" the path. E.g. "/foo//..//home///"
will be turned into "/home/" and stuff like that.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-20 11:14:56 +01:00
psychon
b9b0fd4c87 Oh, shiny... NOT
(Yes, it's that time of the year again)

Signed-off-by: Uli Schlachter <psychon@znc.in>

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2260 726aef4b-f618-498e-8847-2d620e286838
2011-01-14 17:03:24 +00:00
psychon
3ecbf13390 Use autoheader
This commit adds a zncconfig.h to ZNC that is automatically generated by
configure. This is done because the -DPACKAGE_STRING=\"znc\ 0.097\" that
configure adds to CXXFLAGS breaks znc-buildmod.

This means that we have to include zncconfig.h as the very first header in every
C++ file that is compiled. This commit kinda cheats and instead adds this
include as the very first thing to all header files we have. This should
hopefully mean that modules don't have to include this.

Because Csocket includes defines.h too late, this commit causes znc to divert
from upstream Csocket once again. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2250 726aef4b-f618-498e-8847-2d620e286838
2011-01-07 15:01:08 +00:00
psychon
0456e3f0f2 Add Getter/Setter for ConnectDelay, ServerThrottle and AnonIPLimit
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2228 726aef4b-f618-498e-8847-2d620e286838
2010-12-31 09:14:03 +00:00
darthgandalf
2472ea7a13 Add warning header to znc.conf
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2218 726aef4b-f618-498e-8847-2d620e286838
2010-12-30 18:29:15 +00:00
psychon
b359f96886 Avoid a possibly expensive FindSockByName() for finding IRC socks
While a user is connecting to an IRC server, the CUser instance didn't know
about the CIRCSock instance (due to historic reasons). This meant that we needed
to use FindSockByName() when we had to check if there is any CIRCSock associated
with this user. However, this is a bad idea since FindSockByName() is O(n) on
the number of sockets that the socket manager is managing.

Instead, we now already set CUser::m_pIRCSock when the CIRCSock is created so
that checking for an irc socket becomes O(1).

This was inspired by the results of profiling a znc instance with 900 users.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2171 726aef4b-f618-498e-8847-2d620e286838
2010-11-06 15:21:59 +00:00
psychon
341263f9ec Rename "vhost" to "bindhost"
"virtual host" seems to be confusing to users since they wonder why
i.am.superman doesn't work. Let's rename this to "bindhost" and perhaps it
becomes clearer what this setting does.

Thanks to SilverLeo!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2113 726aef4b-f618-498e-8847-2d620e286838
2010-08-30 08:58:29 +00:00
psychon
f82f3cf069 Rename SslPemFile to SSLCertFile
This is *NOT* backward compatible with the old name for that config option. If
you updated to the latest nightly in the last two days, well, you'll have to
fix your config by hand. Sorry.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2088 726aef4b-f618-498e-8847-2d620e286838
2010-07-16 21:11:10 +00:00
psychon
7f53cc810b Add a new config option SslPemFile
This option defines an alternate part for <datadir>/znc.pem.

Thanks to evaryont for the idea and the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2086 726aef4b-f618-498e-8847-2d620e286838
2010-07-14 18:51:12 +00:00
psychon
33ce80f476 Use fcntl() instead of flock() for locking the config file
fcntl() is more portable than flock() so this makes znc run on more systems
(everyone smile and say hi to solaris). The downside is that fcntl() locks are
lost if *any* fd referring to that file is closed (luckily we don't do that).

The big downside is that the child process after fork() does not inherit the
lock. To work around this, when znc forks into the background, the child process
immediately blocks and tries to get the lock on the config file. Once the parent
releases the lock by exiting, the child will get it.

This shouldn't cause races with other ZNCs, because in every other place we
don't block waiting for a lock but instead abort immediately if the file is
already locked.

Thanks to LeftWing aka Joshua M. Clulow for making znc work on solaris (and
automatically fixing some issues with NFS in the process).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2065 726aef4b-f618-498e-8847-2d620e286838
2010-07-05 16:13:23 +00:00
psychon
9c92d93ac4 Remove CZNC::GetUser()
CZNC::FindUser() does the same thing and we don't need two of these. GetUser()
was removed because FindUser() is used more than GetUser().

Thanks to Sthebig for noticing this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2046 726aef4b-f618-498e-8847-2d620e286838
2010-06-29 18:58:14 +00:00
psychon
e62ca4112d Add new global setting MaxBufferSize
Previously, /znc setbuffer had a hardcoded limit of 500, other ways of setting
the buffer size didn't have any limit built-in.

This patch makes that limit configurable and makes sure the various places
honour it.

Thanks to DarthGandalf for the idea with the bForce argument, I were too
small-minded to come up with it myself. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2020 726aef4b-f618-498e-8847-2d620e286838
2010-06-12 20:20:33 +00:00
psychon
f2d7ae1a08 Change a bunch of tabs into spaces
At the beginning of lines, one uses tabs for indenting. In the middle of the
line, you use spaces. If you want two different lines to line up with each
other, you start them with the same number of tabs and use spaces for the rest
of the indenting in the "other" line.

Really, that's how one does it!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1963 726aef4b-f618-498e-8847-2d620e286838
2010-05-01 20:15:01 +00:00
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
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
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
silverleo
aa9edc13b9 Added debug output for the listeners IsHostAllowed check.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1815 726aef4b-f618-498e-8847-2d620e286838
2010-03-08 16:51:00 +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
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
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
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
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
dfce94e39f Fix --disable-modules
This was broken since r1561


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1567 726aef4b-f618-498e-8847-2d620e286838
2009-07-18 15:44:32 +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
442aee2baf Add and use CZNCSock instead of Csock everywhere
This class will be used to implement async DNS in a later commit.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1550 726aef4b-f618-498e-8847-2d620e286838
2009-06-29 11:26:19 +00:00
psychon
65510446df Move CSockManager into Socket.h
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1549 726aef4b-f618-498e-8847-2d620e286838
2009-06-29 07:50:45 +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
08924f499f Add CListener::GetRealListener()
This allows access to the Csock* which does the actual listening


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1515 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 11:56:15 +00:00
psychon
9a7956f522 Revert rev 1510 "Ask SSL clients for a ssl cert"
This commit breaks webadmin. This was found with firefox. If you got any client
certificates imported into firefox, it will ask you to select which certificate
to use a couple of times per click (once per HTTP request which means also when
loading images etc).

Since webadmin by default shares the listen port with znc, we can't limit this
SSL_VERIFY_PEER to webadmin listening ports. The simplest solution is thus to
just drop this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1514 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 11:19:17 +00:00