Commit Graph

323 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
Uli Schlachter
cce40e9f71 Move the EModuleType into CModInfo
This also renames the values to shorter and more "well sounding" names.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-21 16:30:36 +02:00
Kyle Fuller
f44f307b24 Add a config writer 2011-08-21 13:40:14 +01:00
Kyle Fuller
b2d8f2ed62 Add CModInfo::SupportsType(EModuleType) and supply a module type with CModules::LoadModule
This would allow a module support multiple module types but CModule's do
not support this currently
2011-08-21 13:34:23 +01:00
Kyle Fuller
c456d20b21 Merge CGlobalModule(s) into CModule(s) 2011-08-21 13:34:22 +01:00
Kyle Fuller
a4b155995c Create EModuleType, creating SetType which replaces SetGlobal 2011-08-21 13:34:22 +01:00
Uli Schlachter
dcf357b1f6 Stop asking for the host name in --makepem
Come on, it's a self-signed certificate, how much value does it have anyway?
Also, it gets rid of a question during --makeconf which confuses some people.

This should now use $HOSTNAME and fall back to "host.unknown" if that isn't set.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-08-03 22:05:21 +02:00
Alexey Sokolov
795126031b Fix verifying listener in --makeconf.
If ZNC is compiled with IPv6, ZNC tried to verify the listener using
IPv6 regardless of what user said.

Thanks to wodim for reporting this.
2011-07-19 08:48:57 +07:00
Un1matr1x
708366d9ae remove some more of the evil trailing white spaces & tabs 2011-06-09 21:29:13 +02: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
3f24f28736 Stop including FileUtils.h in any header
This causes every piece of code which wants to use CFile or CDir to have to
include FileUtils.h. This causes quite some noise.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-03 11:50:44 +02:00
Uli Schlachter
ac5c021c93 Move DEBUG() from Utils.h into new ZNCDebug.h
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-03 10:41:27 +02: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
3fa04f8c0a Handle Listeners after SSLCertFile
Else, the Listeners will ignore the SSLCertFile config option.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-03 09:27:08 +02:00
Uli Schlachter
f0bf7134ec Improve the handling of module load messages
Instead of doing ugly stuff to shorten the "Loaded Module [foo]" message, we now
just always generate the shorter version of that message. The code paths which
didn't do this shortening now prepend that message themselves.

The result is that every message looks the same as it did before, but the code
for generating these is a little nicer.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-02 16:52:52 +02:00
Uli Schlachter
90fb9e8c29 Re-add the ISpoof{File,Format} handling which was lost
Whoops, someone here failed at rebasing stuff.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-04-01 21:46:14 +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
ee9686e422 Fix a stupid memleak
Where's my brown paper back...?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 19:18:11 +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
Uli Schlachter
7f3e55e72f Check for errors while writing the config
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 18:21:36 +02:00
Uli Schlachter
bff969f404 CZNC::WriteNewConfig() check for errors
This code now errors out if there is any error while writing the config. I
tested this with a full file system (full tmpfs of size 4k).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 18:15:49 +02:00
Uli Schlachter
23fb4df67a Remove config-related module hooks
This removes the following module hooks:

OnConfigLine()
OnWriteConfig()
OnWriteUserConfig()
OnWriteChanConfig()

Modules could use these hooks for writing/reading their own stuff to/from
znc.conf. However, no module (ever?) did this and IMHO no module should ever do
this either. Modules can save stuff via SetNV(), module arguments (SetArgs())
and in their GetSavePath().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-31 17:29:49 +02:00
Kyle Fuller
64b89a7f49 Update old znc config to work with the new identfile module 2011-03-30 19:48:26 +01: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
Alexey Sokolov
36ffa163a8 Make znc.cpp to be compilable again.
This was broken since d735e9d881
2011-03-28 17:26:08 +07:00
Kyle Fuller
d735e9d881 Remove some pointless if statements 2011-03-27 23:35:41 +01:00
Uli Schlachter
f69aeff3d9 Some minor cleanup
This makes the code use GetISpoofFile() instead of accessing m_sISpoofFile
directly. Additonally, CFile::GetLongName() is used for printing the filepath.

(This also removes an useless if branch, because nothing here cares if
m_sISpoofFile is empty, we just need the lock file.)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-20 11:14:56 +01:00
Uli Schlachter
cd78225482 Don't expand ~ in ISpoofFile
This way, we can write the original value back to the config. Also, this "fixes"
a bug because webadmin didn't do this step.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-20 11:14:56 +01:00
Alexey Sokolov
92304835ef Show list of common modules in --makeconfig without any question before it.
"Don't ask to ask!"
2011-02-19 21:24:50 +06:00
Alexey Sokolov
f5fe9868e1 Provide link to wiki page from header comment of znc.conf 2011-02-19 10:04:25 +06:00
Uli Schlachter
32e89efa95 Fix some minor spelling weirdness
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-02-18 10:46:53 +01:00
Nick Bebout
087f01e99b Fix URL to not point to sourceforge 2011-02-15 20:48:49 -06: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
cflakes
8cadb672f0 Add some more infos to the recently introduced znc.conf warning header.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2237 726aef4b-f618-498e-8847-2d620e286838
2010-12-31 16:45:29 +00:00
cflakes
7bb4ed34bd Some grammar and capitalization fixes.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2233 726aef4b-f618-498e-8847-2d620e286838
2010-12-31 15:20:40 +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
psychon
128af8e893 Improve debug output for ISpoof
We now generate a DEBUG() message for all errors during ISpoof. Also, the
message from *status "ISpoof could not be written" now includes the expanded
ISpoofFile that we tried writing to.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2221 726aef4b-f618-498e-8847-2d620e286838
2010-12-30 21:11:40 +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
11ffe9dbd8 Verify the listener during --makeconf
We will now try to bind() the listener during --makeconf and only accept using
it if this works. This should make this kind of problem less annoying (=you
don't have to recreate the whole config with --makeconf).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2206 726aef4b-f618-498e-8847-2d620e286838
2010-12-24 16:09:30 +00:00
psychon
1023d868e4 Fix some warnings with -pedantic
"invoking macro GLOBALMODULECALL argument 4: empty macro arguments are undefined
in ISO C90 and ISO C++98"


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2177 726aef4b-f618-498e-8847-2d620e286838
2010-11-07 16:12:17 +00:00
psychon
16be1817d5 Improve the tip at the end of --makeconf
This now also tries to mention the needed ssl flag in the irc client and the big
change is that this prints the "address" of the web interface!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2176 726aef4b-f618-498e-8847-2d620e286838
2010-11-07 13:42:48 +00:00
psychon
612b61dada Remove CUser::ConnectPaused()
Once Upon A Time, this was the only mechanism that throttled users that wanted
to connect to IRC servers. ConnectDelay and ServerThrottle now do a much better
job on this problem.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2174 726aef4b-f618-498e-8847-2d620e286838
2010-11-06 16:52:19 +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
c9278e8f72 Revert r2159
Turns out that OpenBSD does define IPV6_V6ONLY, but setting that option fails.
So this commit was no good after all. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2161 726aef4b-f618-498e-8847-2d620e286838
2010-10-21 16:12:03 +00:00
psychon
7ab492ed22 Add a warning if IPV6_V6ONLY is not defined
Each time we hit a "Listener" config option and the current system doesn't have
IPV6_V6ONLY, we print a warning that "Listener4" and "Listener6" should be used
instead. The current "Listener" will then be interpreted as an IPV4 port.

--makeconf is changed so that it doesn't write out "Listener" lines when
IPV6_V6ONLY is not defined so that we don't trigger the warning like this.

The only "real OS" (windows doesn't count here) that is known to not have
IPV6_V6ONLY is OpenBSD.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2159 726aef4b-f618-498e-8847-2d620e286838
2010-10-17 08:42:07 +00:00
darthgandalf
9109df9227 Load global modules before users.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2118 726aef4b-f618-498e-8847-2d620e286838
2010-09-07 09:52:49 +00:00
darthgandalf
35ae34fa42 More text describing what are multiple servers per user in --makeconf.
Also, hello ZNC svn! :)

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2115 726aef4b-f618-498e-8847-2d620e286838
2010-09-02 16:32:11 +00:00