Commit Graph

284 Commits

Author SHA1 Message Date
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
psychon
1fcb7b2bce Fix a NULL pointer dereference with traffic stats
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
2010-06-13 17:14:52 +00:00
psychon
83d01ae0db Write MaxBufferSize to the config
r2020 added a new config option but forgot to actually write that setting back
to the config. Whoops!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2025 726aef4b-f618-498e-8847-2d620e286838
2010-06-13 07:58:28 +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
a3ef9b2d40 Allow leading/trailing spaces in the config
This is especially useful for all those ASCII-art-in-the-MOTD guys.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2010 726aef4b-f618-498e-8847-2d620e286838
2010-06-06 09:47:30 +00:00
psychon
e80bf15cb9 Add and use new config option "Listener"
This is what each option does:

Listen on ipv4 and ipv6: Listener, Listen6
Listen on ipv4 only:     Listener4, Listen4, Listen
Listen on ipv6 only:     Listener6
Removed:     ListenPort (not used since at least 0.047)

(ZNC will only ever use Listener* by itself)

This was done to preserve the old meaning of "Listen" and "Listen6", so that
user configs don't break after update.

Thanks to DarthGandalf for thinking about and implementing this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1977 726aef4b-f618-498e-8847-2d620e286838
2010-05-10 17:45:15 +00:00
cflakes
6bc45bf80f Partly undo psychon's last commit in favor of just removing all the
setter methods. Suggested by psychon himself.
The second and more important part of this patch adds an optional
web_only/irc_only token to the Listen config setting. Using this,
you can make Listen ports listen for IRC or Web/HTTP connections
only (or for both if you don't add any of the _only tokens).
Examples:
Listen = irc_only 3000
Listen4 = web_only +3001
Listen6 = ::1 6000
and so on.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1973 726aef4b-f618-498e-8847-2d620e286838
2010-05-09 18:55:13 +00:00
psychon
99f1efc843 Some more fun with tabs
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1966 726aef4b-f618-498e-8847-2d620e286838
2010-05-02 08:36:57 +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
a836dcd778 Add an alias for discon_kick
discon_kick is now called disconkick, so load that one instead when we see a
config line with "LoadModule = discon_kick".

Idea by BrianC.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1957 726aef4b-f618-498e-8847-2d620e286838
2010-05-01 11:36:42 +00:00
psychon
20c79083de Don't use "ip:port" but "ip port" for display purposes
With ipv6 addresses, ip:port just looks wrong.

Found by KiNgMaR, thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1955 726aef4b-f618-498e-8847-2d620e286838
2010-04-30 10:50:33 +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
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