Commit Graph

314 Commits

Author SHA1 Message Date
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
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
11f6483270 Complain about truncated config files
If we were in an user section when we reached the end of the config file, that
user was previously discarded. This makes reading the config file instead.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2083 726aef4b-f618-498e-8847-2d620e286838
2010-07-10 08:02:32 +00:00
psychon
e0dda30871 Properly show if we are connecting to a ssl server
Idea by DarthGandalf, crappy commit message by me.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2078 726aef4b-f618-498e-8847-2d620e286838
2010-07-10 06:53:10 +00:00
psychon
9ae959b800 Do all module calls through the macros
This commit should make sure that all module calls are done through either
MODULECALL, GLOBALMODULECALL or ALLMODULECALL. Also, in the process some module
calls where ("accidentally" ;) ) fixed to set correct values for a global
module's m_pUser during a module call.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2076 726aef4b-f618-498e-8847-2d620e286838
2010-07-08 16:43:23 +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
cflakes
b3d6a86f68 Changed some text strings in --makeconf, idea & first patch by DGandalf, thanks
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2045 726aef4b-f618-498e-8847-2d620e286838
2010-06-27 01:15:14 +00:00