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.
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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
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
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
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
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
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
"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
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
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
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
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
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
When something requested traffic statistics while there was an unauthenticated
connection to ZNC, there was a NULL pointer dereference. Fix this by making the
code saner and removing all NULL pointer dereferences. ;)
Thanks to various people who reported this. A special thank you goes to Woet who
helped debugging this.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2026 726aef4b-f618-498e-8847-2d620e286838