]> jfr.im git - irc/rizon/znc.git/log
irc/rizon/znc.git
15 years agoIncrease the version number to 0.068 znc-0.068
psychon [Sun, 29 Mar 2009 11:41:27 +0000 (11:41 +0000)] 
Increase the version number to 0.068

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1446 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdd defines.h for Csocket and make Csocket use ZNC's DEBUG()
psychon [Wed, 25 Mar 2009 17:56:29 +0000 (17:56 +0000)] 
Add defines.h for Csocket and make Csocket use ZNC's DEBUG()

This adds a new file defines.h and moves all the Csocket specific stuff from
main.h into this new file.

Then this makes Csocket use ZNC's DEBUG() macro for its debug output which
means this can now also be enabled by running znc --debug.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1445 726aef4b-f618-498e-8847-2d620e286838

15 years agoUpdate to latest Csocket
psychon [Wed, 25 Mar 2009 15:38:11 +0000 (15:38 +0000)] 
Update to latest Csocket

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1444 726aef4b-f618-498e-8847-2d620e286838

15 years agoUse -D instead of -g as a short form for --debug
psychon [Tue, 24 Mar 2009 18:50:11 +0000 (18:50 +0000)] 
Use -D instead of -g as a short form for --debug

This also cleans up some minor #ifdef for the initial value for bForeground.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1443 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdd znc --debug / znc -g
psychon [Tue, 24 Mar 2009 18:45:03 +0000 (18:45 +0000)] 
Add znc --debug / znc -g

This enables the debug output you get with --enable-debug on --disable-debug
builds. The behaviour if znc was compiled with --disable-debug isn't changed.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1442 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdd znc -f / --foreground
psychon [Tue, 24 Mar 2009 12:03:51 +0000 (12:03 +0000)] 
Add znc -f / --foreground

This argument makes znc not fork into the background. It has no effect if
configure is called with --enable-debug, znc will always stay in the foreground
in this case.

The hunk at the end of main.cpp is just whitespace stuff. The only difference
in there is that #ifdef _DEBUG #else #endif is changed into
if (bForeground) { } else { } (which makes this whitespace stuff necessary).

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1441 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdmin module: some cosmetic fixes
sebastinas [Mon, 23 Mar 2009 20:43:11 +0000 (20:43 +0000)] 
Admin module: some cosmetic fixes

Use ToUInt to convert the string, since we're actually using an
unsigned integer. And use ToBool for consistency.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1440 726aef4b-f618-498e-8847-2d620e286838

15 years agoFix some compiler warnings with -Wmissing-declarations
psychon [Mon, 23 Mar 2009 15:26:26 +0000 (15:26 +0000)] 
Fix some compiler warnings with -Wmissing-declarations

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1439 726aef4b-f618-498e-8847-2d620e286838

15 years agoFix a crash bug with recursion in module calls
psychon [Sun, 22 Mar 2009 19:05:34 +0000 (19:05 +0000)] 
Fix a crash bug with recursion in module calls

This was found via partyline and notify_connect. notify_connect calls
CZNC::Broadcast() in OnClientLogin() which calls the OnBroadcast() module call.
When returning from this module calls, m_pUser and m_pClient was reset to NULL
and all the following modules got their OnClientLogin() called with m_pUser and
m_pClient set to NULL.

This patch fixes this by resetting those vars to their old values instead to
NULL when returning from a module call.

This patch also fixes the bug that m_pUser and m_pClient in modules were reset
to NULL after they caused a module call which called back into the current
module. The fix looks similar to the other one (this one is the Modules.h part).

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1438 726aef4b-f618-498e-8847-2d620e286838

15 years agoRemove some useless tags from a non-tty output.
silverleo [Sun, 22 Mar 2009 14:41:04 +0000 (14:41 +0000)] 
Remove some useless tags from a non-tty output.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1437 726aef4b-f618-498e-8847-2d620e286838

15 years agoSome minor stuff, again found via icc's "remarks"
psychon [Sat, 21 Mar 2009 09:32:50 +0000 (09:32 +0000)] 
Some minor stuff, again found via icc's "remarks"

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1436 726aef4b-f618-498e-8847-2d620e286838

15 years agoRemove/fix some dead code
psychon [Fri, 20 Mar 2009 10:00:31 +0000 (10:00 +0000)] 
Remove/fix some dead code

All of this was found via warnings ("remarks") from icc.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1435 726aef4b-f618-498e-8847-2d620e286838

15 years agoChange CZNC::Loop()'s return type to void
psychon [Thu, 19 Mar 2009 16:25:33 +0000 (16:25 +0000)] 
Change CZNC::Loop()'s return type to void

CZNC::Loop() never returns a value, the only way it can return is through
some throws (e.g. for restart or shutdown).

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1434 726aef4b-f618-498e-8847-2d620e286838

15 years agofixed bug in wrong iterator increment that causes infinite loop
imaginos [Wed, 18 Mar 2009 23:55:56 +0000 (23:55 +0000)] 
fixed bug in wrong iterator increment that causes infinite loop

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1433 726aef4b-f618-498e-8847-2d620e286838

15 years agoGet rid of znc.conf-backup
psychon [Wed, 18 Mar 2009 15:45:43 +0000 (15:45 +0000)] 
Get rid of znc.conf-backup

The old code created a copy of the config file before writing a new version.
This backup is now gone.

With this patch the config is written to a temporary file znc.conf~ and then
fsync()d to make sure the data safely is on the disk. Then the real config file
znc.conf is overwritten with this temporary file via a rename() call.

This should be safer than the old way, plus it gets rid of a unneeded file.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1432 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdd CFile::Sync()
psychon [Wed, 18 Mar 2009 15:40:05 +0000 (15:40 +0000)] 
Add CFile::Sync()

This adds a simple wrapper for fsync() to CFileUtils.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1431 726aef4b-f618-498e-8847-2d620e286838

15 years agoMove the saslauth copyright notice back into saslauth.cpp
psychon [Mon, 16 Mar 2009 11:59:36 +0000 (11:59 +0000)] 
Move the saslauth copyright notice back into saslauth.cpp

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1430 726aef4b-f618-498e-8847-2d620e286838

15 years agoRemove a pretty much useless usleep() on shutdown
psychon [Sun, 15 Mar 2009 07:44:07 +0000 (07:44 +0000)] 
Remove a pretty much useless usleep() on shutdown

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1429 726aef4b-f618-498e-8847-2d620e286838

15 years agoFix an implicit (CFile *) false (this should have been NULL for sure)
psychon [Sat, 14 Mar 2009 18:17:42 +0000 (18:17 +0000)] 
Fix an implicit (CFile *) false (this should have been NULL for sure)

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1428 726aef4b-f618-498e-8847-2d620e286838

15 years agoMakefile: Add -Wno-redundant-decls to modperlFLAGS
psychon [Sat, 14 Mar 2009 14:48:26 +0000 (14:48 +0000)] 
Makefile: Add -Wno-redundant-decls to modperlFLAGS

While experimenting with some warning flags I found another one which breaks
the perl headers. This warning is triggered by code like this:

 void bla();
 void bla();

Sadly, the perl headers do this for some weird reason :(

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1427 726aef4b-f618-498e-8847-2d620e286838

15 years agoRegenerate configure with the newer autoconf 2.63 (was 2.61 before)
psychon [Sat, 14 Mar 2009 11:12:18 +0000 (11:12 +0000)] 
Regenerate configure with the newer autoconf 2.63 (was 2.61 before)

This removes svn:eol-style from configure since it now contains
this in line 4122 (\r is a literal mac line ending):
 ac_cr='\r'
This confused subversion. Bad svn, bad!

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1426 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdded raw 432 processing for illegal and erroneous nicks and changed the condition...
silverleo [Fri, 13 Mar 2009 17:24:36 +0000 (17:24 +0000)] 
Added raw 432 processing for illegal and erroneous nicks and changed the condition to trigger SendAltNick() since ircds like to interpret the standards.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1425 726aef4b-f618-498e-8847-2d620e286838

15 years agoMy bad. Fixed the build error.
sebastinas [Wed, 11 Mar 2009 21:11:58 +0000 (21:11 +0000)] 
My bad. Fixed the build error.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1424 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdmin module: added 'Set Password'
sebastinas [Wed, 11 Mar 2009 19:24:30 +0000 (19:24 +0000)] 
Admin module: added 'Set Password'

The admin module is now able to set a user's password. Furthermore
fixed a bug if now username was specified for the 'Get' or 'Set'
command.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1423 726aef4b-f618-498e-8847-2d620e286838

15 years agoFix for CSmartPtr::GetCount
sebastinas [Wed, 11 Mar 2009 14:32:12 +0000 (14:32 +0000)] 
Fix for CSmartPtr::GetCount

Since CSmartPtr::GetCount returns a pointer to unsigned int it's
possible to manually change the reference count from outside.
Increasing the reference count will result in a memory leak and
decreasing will produce undefined behaviour.

GetCount now returns a pointer to const unsigned int to fix this.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1422 726aef4b-f618-498e-8847-2d620e286838

15 years agoPulled in changes for CSmartPtr which include GetClientCount(), operator bool(),...
prozacx [Tue, 10 Mar 2009 19:36:24 +0000 (19:36 +0000)] 
Pulled in changes for CSmartPtr which include GetClientCount(), operator bool(), and ability to Attach() to NULL pointers

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1421 726aef4b-f618-498e-8847-2d620e286838

15 years agoCheck if the version of a module matches when querying info about it
psychon [Tue, 10 Mar 2009 19:15:08 +0000 (19:15 +0000)] 
Check if the version of a module matches when querying info about it

When the module was compiled for a wrong ZNC version it's description will
say so. Everything which displays a list of available modules together with
their description will display this (--makeconf, /msg *status listavailmods,
webadmin).

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1420 726aef4b-f618-498e-8847-2d620e286838

15 years agoMeh. Today is not a good day -.-
psychon [Mon, 9 Mar 2009 17:42:12 +0000 (17:42 +0000)] 
Meh. Today is not a good day -.-

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1419 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdd /msg *status UpdateMod[ule] which reloads an user module on all users
psychon [Mon, 9 Mar 2009 17:37:35 +0000 (17:37 +0000)] 
Add /msg *status UpdateMod[ule] which reloads an user module on all users

This command allows admins to really reload a module when they have updated it.
Because the dynamic linker does not really reload a shared object until all
handles to this object where dlclose()'d, this new command is necessary.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1418 726aef4b-f618-498e-8847-2d620e286838

15 years agoRemove a mostly unused flag from CModInfo
psychon [Mon, 9 Mar 2009 17:21:01 +0000 (17:21 +0000)] 
Remove a mostly unused flag from CModInfo

Nobody cares if a module is found in ~/.znc/modules or in /usr/lib/znc/, right?

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1417 726aef4b-f618-498e-8847-2d620e286838

15 years agoFix my previous commit and also display the remote IP for the failed login
psychon [Sat, 7 Mar 2009 12:44:11 +0000 (12:44 +0000)] 
Fix my previous commit and also display the remote IP for the failed login

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1416 726aef4b-f618-498e-8847-2d620e286838

15 years agoAlways notify the user when someone else tried to login but was rejected
psychon [Sat, 7 Mar 2009 12:37:38 +0000 (12:37 +0000)] 
Always notify the user when someone else tried to login but was rejected

Before this, you only got a message from *status when someone tried to login
with a bad password and no auth module (imapauth/saslauth) was loaded.
With this patch every failed login will generate a message.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1415 726aef4b-f618-498e-8847-2d620e286838

15 years agowatch: Removed a bit too much in r1413.
silverleo [Sat, 7 Mar 2009 11:24:34 +0000 (11:24 +0000)] 
watch: Removed a bit too much in r1413.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1414 726aef4b-f618-498e-8847-2d620e286838

15 years agowatch: Save the module settings as soon as they are changed.
silverleo [Sat, 7 Mar 2009 11:16:28 +0000 (11:16 +0000)] 
watch: Save the module settings as soon as they are changed.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1413 726aef4b-f618-498e-8847-2d620e286838

15 years agowebadmin: Restrict skins to be located inside the skins dir
psychon [Fri, 6 Mar 2009 14:24:47 +0000 (14:24 +0000)] 
webadmin: Restrict skins to be located inside the skins dir

One needs to be admin to change the current skin dir, but it still sounds
like a good idea to be careful...
Plus, this wont deny symlinks anyway!

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1412 726aef4b-f618-498e-8847-2d620e286838

15 years agoChange the default Join Tries from unlimited to 10 to prevent join floods when a...
silverleo [Fri, 6 Mar 2009 13:30:09 +0000 (13:30 +0000)] 
Change the default Join Tries from unlimited to 10 to prevent join floods when a user can't join a channel.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1411 726aef4b-f618-498e-8847-2d620e286838

15 years agoFix some weird behavior in CString::Base64Decode and wrapped strings
sebastinas [Wed, 4 Mar 2009 18:20:08 +0000 (18:20 +0000)] 
Fix some weird behavior in CString::Base64Decode and wrapped strings

With the current implementation of CString::Base64Decode the following
code would fail (meaning b would be false):

    CString t = "some very long string ...";
    bool b = (t == t.Base64Encode_n(true).Base64Decode_n());

The same code without wrapping the base64 output would give b = true
as expected.

The new implementation removes all new lines before decoding so
decoding a wrapped base64 text gives the expected result.

Furthermore replaced malloc and free with new and delete and removed
the check for p in CString::Base64Encode since new will throw if it
failed.

The changes don't affect any existing code.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1410 726aef4b-f618-498e-8847-2d620e286838

15 years agoSwap some lines in CHTTPSock::ReadLine
sebastinas [Wed, 4 Mar 2009 18:19:29 +0000 (18:19 +0000)] 
Swap some lines in CHTTPSock::ReadLine

Copying sData and trimming it can be omitted if the function is left
because m_bGotHeader is true.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1409 726aef4b-f618-498e-8847-2d620e286838

15 years agoHTTPSock: Remove some code which makes no sense
psychon [Tue, 3 Mar 2009 17:10:52 +0000 (17:10 +0000)] 
HTTPSock: Remove some code which makes no sense

Thanks to sebastinas

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1408 726aef4b-f618-498e-8847-2d620e286838

15 years agoUpdate to latest Csocket
psychon [Tue, 3 Mar 2009 11:09:44 +0000 (11:09 +0000)] 
Update to latest Csocket

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1407 726aef4b-f618-498e-8847-2d620e286838

15 years agoCZNC::AddUser(): Always set the error return on a useful value
psychon [Sun, 1 Mar 2009 16:43:58 +0000 (16:43 +0000)] 
CZNC::AddUser(): Always set the error return on a useful value

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1406 726aef4b-f618-498e-8847-2d620e286838

15 years agoOnly add WALLOPS to the buffer if no client is attached
psychon [Sun, 1 Mar 2009 13:07:11 +0000 (13:07 +0000)] 
Only add WALLOPS to the buffer if no client is attached

Thanks to flakes for finding this.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1405 726aef4b-f618-498e-8847-2d620e286838

15 years agoCFile::IsDir failed for the root directory "/". This patch fixes that special case.
silverleo [Fri, 27 Feb 2009 20:58:34 +0000 (20:58 +0000)] 
CFile::IsDir failed for the root directory "/". This patch fixes that special case.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1404 726aef4b-f618-498e-8847-2d620e286838

15 years agoZNC usernames can't have a : and passwords that have a : can break anyways so we...
silverleo [Fri, 27 Feb 2009 19:52:31 +0000 (19:52 +0000)] 
ZNC usernames can't have a : and passwords that have a : can break anyways so we can chomp it from the beginning to please CGames.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1403 726aef4b-f618-498e-8847-2d620e286838

15 years agoMake watch module use ExpandString in pattern matching and split some long lines...
silverleo [Fri, 27 Feb 2009 16:11:53 +0000 (16:11 +0000)] 
Make watch module use ExpandString in pattern matching and split some long lines in the code.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1402 726aef4b-f618-498e-8847-2d620e286838

15 years agoFix a cd bug that prevented users from changing dirs with the shell module.
silverleo [Fri, 27 Feb 2009 15:53:38 +0000 (15:53 +0000)] 
Fix a cd bug that prevented users from changing dirs with the shell module.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1401 726aef4b-f618-498e-8847-2d620e286838

15 years agoconfigure: Add the module path defines as late as possible
psychon [Wed, 25 Feb 2009 16:35:50 +0000 (16:35 +0000)] 
configure: Add the module path defines as late as possible

In some (weird?) cases these flags could make the libperl and libsasl2
checks fail.

Thanks to darix for reporting this.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1400 726aef4b-f618-498e-8847-2d620e286838

15 years agoIncrease the version number to 0.067
psychon [Tue, 24 Feb 2009 16:41:22 +0000 (16:41 +0000)] 
Increase the version number to 0.067

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1399 726aef4b-f618-498e-8847-2d620e286838

15 years agoIncrease the version number to 0.066 znc-0.066
psychon [Tue, 24 Feb 2009 16:15:28 +0000 (16:15 +0000)] 
Increase the version number to 0.066

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1397 726aef4b-f618-498e-8847-2d620e286838

15 years agoDon't write unexpected newlines to znc.conf
psychon [Tue, 24 Feb 2009 16:02:35 +0000 (16:02 +0000)] 
Don't write unexpected newlines to znc.conf

This patch fixes the same bug as the last commit and also makes sure that
similar bugs can't happen again.

Thanks to cnu for finding and reporting this bug.
Thanks to kroimon for patch review.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1396 726aef4b-f618-498e-8847-2d620e286838

15 years agoHandle newlines in CHTTPSock::GetParam() and strip them out.
psychon [Tue, 24 Feb 2009 16:00:11 +0000 (16:00 +0000)] 
Handle newlines in CHTTPSock::GetParam() and strip them out.

There was a bug in webadmin which allowed any users to write arbitrary strings
to znc.conf by setting e.g. their quit message to:
  Some quit message
  Admin = true
  LoadModule = shell
  </User>
  ISpoofFile = /home/<user>/.ssh/authorited_keys
  ISpoofFormat = <some ssh key>
  <User a>
(The newlines must be sent as newlines to webadmin)

This commit fixes this by stripping all newlines from all the data fields
by default. Since some fields (e.g. CTCPReplies and Servers) do need newlines,
there is a new function CHTTPSock::GetRawParam() which doesn't do the stripping.

Thanks to cnu for finding and reporting this bug.
Thanks to kroimon for patch review.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1395 726aef4b-f618-498e-8847-2d620e286838

15 years agoCheck the return value of strftime()
psychon [Tue, 24 Feb 2009 15:52:43 +0000 (15:52 +0000)] 
Check the return value of strftime()

strftime() returns zero for errors and the state of the buffer we passed to it
is undefined in this case. This lead to a non-null-terminated string being
used.
The impact of this bug should be low, no writing was done and you were only
able to get a partial stack dump. A crash through this is quite unlikely.

Thanks to cnu for finding and reporting this.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1394 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdd cnu to AUTHORS
psychon [Tue, 24 Feb 2009 14:55:44 +0000 (14:55 +0000)] 
Add cnu to AUTHORS

He found the recent privilege escalation bug, is very... 'active' in our IRC
channel and keeps testing SVN versions.
Thanks for your work :)

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1393 726aef4b-f618-498e-8847-2d620e286838

15 years agoFix some "uninitialized variable" compiler warning
psychon [Mon, 23 Feb 2009 19:24:41 +0000 (19:24 +0000)] 
Fix some "uninitialized variable" compiler warning

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1392 726aef4b-f618-498e-8847-2d620e286838

15 years agoFix some minor XSS bug in webadmin's default skin
psychon [Sun, 22 Feb 2009 15:22:37 +0000 (15:22 +0000)] 
Fix some minor XSS bug in webadmin's default skin

For some reason it didn't escape module descriptions...

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1391 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdd fail2ban module
psychon [Sat, 21 Feb 2009 16:50:40 +0000 (16:50 +0000)] 
Add fail2ban module

This is a slightly modified version of the connect_throttle from znc-extra.

If a login attempt fails, all further login attempts from that source IP are
blocked for some time (by default one minute).

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1390 726aef4b-f618-498e-8847-2d620e286838

15 years agoCall OnFailedLogin() for all failed logins, not only those on the irc port
psychon [Sat, 21 Feb 2009 16:48:28 +0000 (16:48 +0000)] 
Call OnFailedLogin() for all failed logins, not only those on the irc port

This breaks CAuthBase's API for modules that want to auth users.
Instead of overloading AcceptLogin() and RefuseLogin(), they now have to
overload AcceptedLogin() and RefusedLogin().

Modules that auth users (e.g. imapauth) still call AcceptLogin() and
RefuseLogin() which is where OnFailedLogin() gets called.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1389 726aef4b-f618-498e-8847-2d620e286838

15 years agoDon't ever ask for a password via stdin in away and savebuff
psychon [Fri, 20 Feb 2009 19:15:31 +0000 (19:15 +0000)] 
Don't ever ask for a password via stdin in away and savebuff

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1388 726aef4b-f618-498e-8847-2d620e286838

15 years agoGet rid of all extra lines, not just the first one
prozacx [Fri, 20 Feb 2009 05:50:36 +0000 (05:50 +0000)] 
Get rid of all extra lines, not just the first one

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1387 726aef4b-f618-498e-8847-2d620e286838

15 years agoSome stuff for the admin module
psychon [Thu, 19 Feb 2009 16:40:21 +0000 (16:40 +0000)] 
Some stuff for the admin module

- No longer a global module, why was it ever one?
- Fix '/msg *admin set  ident a' to error out instead of modifying my own user.
- Document '$me'.
- Other, minor stuff.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1386 726aef4b-f618-498e-8847-2d620e286838

15 years agoGet rid of the DEBUG_ONLY define
psychon [Wed, 18 Feb 2009 16:10:32 +0000 (16:10 +0000)] 
Get rid of the DEBUG_ONLY define

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1385 726aef4b-f618-498e-8847-2d620e286838

15 years agoMake savebuff also do it's thing without KeepBuffer enabled
psychon [Tue, 17 Feb 2009 16:56:46 +0000 (16:56 +0000)] 
Make savebuff also do it's thing without KeepBuffer enabled

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1384 726aef4b-f618-498e-8847-2d620e286838

15 years agoSome cleanup to CFile
psychon [Tue, 17 Feb 2009 15:29:06 +0000 (15:29 +0000)] 
Some cleanup to CFile

Remove CFile::SetFD() which was unused and made FD leaks way too easy.

Remove CFile::CFile(int fd, const CString& sLongName) since it's unused and
it was the only reason we needed the m_bClose member which is now also gone.

Call ClearBuffer() in Close() in case someone reuses CFile instances.

Thanks to Sebastinas.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1383 726aef4b-f618-498e-8847-2d620e286838

15 years agoCalculate VERSION from VERSION_MAJOR and VERSION_MINOR
psychon [Tue, 17 Feb 2009 13:14:49 +0000 (13:14 +0000)] 
Calculate VERSION from VERSION_MAJOR and VERSION_MINOR

One less place where the version number needs to be updated...

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1382 726aef4b-f618-498e-8847-2d620e286838

15 years agoRemove some completely unused code in Modules.cpp
psychon [Mon, 16 Feb 2009 17:36:52 +0000 (17:36 +0000)] 
Remove some completely unused code in Modules.cpp

Modules.cpp is capsuled in a huge #ifdef _MODULES block (see r767), but some
code in there still uses #ifndef _MODULES, which is never going to be used.

Thanks to Sebastinas for finding this.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1381 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdd sebastinas to the AUTHORS file
psychon [Mon, 16 Feb 2009 17:29:39 +0000 (17:29 +0000)] 
Add sebastinas to the AUTHORS file

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1380 726aef4b-f618-498e-8847-2d620e286838

15 years agoImport the admin module
psychon [Mon, 16 Feb 2009 17:26:46 +0000 (17:26 +0000)] 
Import the admin module

This module basically does the same things webadmin does, but via
an IRC query interface.

Thanks to sebastinas for writing the original version of this module.
Thanks to kroimon for making this suite ZNC's coding style better and porting
it to newer ZNC versions.
Finally, I added a DelUser command and ported it again to laters versions.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1379 726aef4b-f618-498e-8847-2d620e286838

15 years agoIncrease the version number to 0.065
psychon [Mon, 16 Feb 2009 15:44:57 +0000 (15:44 +0000)] 
Increase the version number to 0.065

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1378 726aef4b-f618-498e-8847-2d620e286838

15 years agoIncrease the version number to 0.064 znc-0.064
psychon [Mon, 16 Feb 2009 15:42:22 +0000 (15:42 +0000)] 
Increase the version number to 0.064

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1376 726aef4b-f618-498e-8847-2d620e286838

15 years agowebadmin: Dont force opening a seperate listening port if irc port sharing is on
psychon [Fri, 6 Feb 2009 16:47:16 +0000 (16:47 +0000)] 
webadmin: Dont force opening a seperate listening port if irc port sharing is on

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1375 726aef4b-f618-498e-8847-2d620e286838

15 years agoHTTPSock: Don't transfer endless static files in PrintFile()
psychon [Thu, 5 Feb 2009 17:11:45 +0000 (17:11 +0000)] 
HTTPSock: Don't transfer endless static files in PrintFile()

This limits the max file size to 16 MiB and makes the read loop stop after
it has read as many bytes as GetSize() said the file is long. This fixes
an endless loop when trying to transfer endless files like /dev/zero.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1374 726aef4b-f618-498e-8847-2d620e286838

15 years agoMake webadmin's debug output for ETags more readable
psychon [Thu, 5 Feb 2009 15:33:48 +0000 (15:33 +0000)] 
Make webadmin's debug output for ETags more readable

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1373 726aef4b-f618-498e-8847-2d620e286838

15 years agoMake some functions in CHTTPSock pure virtual where it makes sense
psychon [Wed, 4 Feb 2009 16:29:06 +0000 (16:29 +0000)] 
Make some functions in CHTTPSock pure virtual where it makes sense

Or do you seriously expect anyone to set up a http which always replies
with 404 File not found errors?

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1372 726aef4b-f618-498e-8847-2d620e286838

15 years agoCBuffer: If the allowed buffer size is lowered, shrink the buffer
psychon [Wed, 4 Feb 2009 15:47:36 +0000 (15:47 +0000)] 
CBuffer: If the allowed buffer size is lowered, shrink the buffer

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1371 726aef4b-f618-498e-8847-2d620e286838

15 years agoshell: Use CString::Replace() -.-
psychon [Tue, 3 Feb 2009 19:43:35 +0000 (19:43 +0000)] 
shell: Use CString::Replace() -.-

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1370 726aef4b-f618-498e-8847-2d620e286838

15 years agoMake the shell module generate error messages if fork() or pipe() fail
psychon [Tue, 3 Feb 2009 19:42:40 +0000 (19:42 +0000)] 
Make the shell module generate error messages if fork() or pipe() fail

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1369 726aef4b-f618-498e-8847-2d620e286838

15 years agoMake webadmin handle HTTP requests to the IRC port
psychon [Tue, 3 Feb 2009 19:08:15 +0000 (19:08 +0000)] 
Make webadmin handle HTTP requests to the IRC port

This can be disable with -noircport in webadmin's arguments

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1368 726aef4b-f618-498e-8847-2d620e286838

15 years agoImprove the error messages we give for failed connect attempts... again
psychon [Tue, 3 Feb 2009 18:21:33 +0000 (18:21 +0000)] 
Improve the error messages we give for failed connect attempts... again

EADDRNOTAVAIL is generated for these failed vhosts instead of EDOM as it did
before. Yay for Csocket.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1367 726aef4b-f618-498e-8847-2d620e286838

15 years agoMake CFile::ReadFile() actually honour the max file size we give it
psychon [Tue, 3 Feb 2009 18:18:05 +0000 (18:18 +0000)] 
Make CFile::ReadFile() actually honour the max file size we give it

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1366 726aef4b-f618-498e-8847-2d620e286838

15 years agoRemove this unused definition of strcasestr()
psychon [Tue, 3 Feb 2009 18:15:56 +0000 (18:15 +0000)] 
Remove this unused definition of strcasestr()

No idea why we provide this definition for __sun (solaris?), but it doesn't
look like anything uses this and we don't compile on those weird boxes anyway.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1365 726aef4b-f618-498e-8847-2d620e286838

15 years agoHTTPSock: Use TrimLeft() instead of a combination of Left() and LeftChomp()
psychon [Mon, 2 Feb 2009 15:24:48 +0000 (15:24 +0000)] 
HTTPSock: Use TrimLeft() instead of a combination of Left() and LeftChomp()

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1364 726aef4b-f618-498e-8847-2d620e286838

15 years agoUse find() instead of walking strings 'by hand' in IsValidHostName
psychon [Mon, 2 Feb 2009 15:23:03 +0000 (15:23 +0000)] 
Use find() instead of walking strings 'by hand' in IsValidHostName

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1363 726aef4b-f618-498e-8847-2d620e286838

15 years agoMake CExecSock generate error messages if execvp() fails to find sh
psychon [Mon, 2 Feb 2009 15:20:44 +0000 (15:20 +0000)] 
Make CExecSock generate error messages if execvp() fails to find sh

I doubt this will ever happen, but let's better be sure...

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1362 726aef4b-f618-498e-8847-2d620e286838

15 years agoRemove that useless and more or less unused enum for open() modes
psychon [Mon, 2 Feb 2009 15:03:32 +0000 (15:03 +0000)] 
Remove that useless and more or less unused enum for open() modes

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1361 726aef4b-f618-498e-8847-2d620e286838

15 years agoRemove CNick::Concat which isn't used anywhere
psychon [Mon, 2 Feb 2009 14:55:45 +0000 (14:55 +0000)] 
Remove CNick::Concat which isn't used anywhere

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1360 726aef4b-f618-498e-8847-2d620e286838

15 years agoJust. Do. Not. Ask.
psychon [Thu, 29 Jan 2009 19:59:02 +0000 (19:59 +0000)] 
Just. Do. Not. Ask.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1359 726aef4b-f618-498e-8847-2d620e286838

15 years agoChange the names of all the module entry points to be more ZNC specific
psychon [Thu, 29 Jan 2009 19:39:21 +0000 (19:39 +0000)] 
Change the names of all the module entry points to be more ZNC specific

Some of them (eg. GetVersion) where so generic that we even had symbol
clashes (well, on no real worls OS (only windows), but still that's not nice).

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1358 726aef4b-f618-498e-8847-2d620e286838

15 years agoSome fixes to modperl, most notable no with time increasing memory usage
psychon [Thu, 29 Jan 2009 19:11:53 +0000 (19:11 +0000)] 
Some fixes to modperl, most notable no with time increasing memory usage

Because some ENTER/LEAVE pair was missing, the stack perl uses for passing
arguments grew and grew.
Besides adding those calls this also fixes some more of the callback calling
code to look a little closer to the examples from perldoc.
This also fixes some warnings perl threw at us when unloading by not
making ZNC::{CONTINUE,HALT{,MODS,CORE}} mortal.

Thanks to tomaw and AnMaster for reporting and helping me debug this mem issue.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1357 726aef4b-f618-498e-8847-2d620e286838

15 years agoJust ignore this
psychon [Thu, 29 Jan 2009 15:41:38 +0000 (15:41 +0000)] 
Just ignore this

This commit never happened.
You must be dreaming.
Really, there is nothing to see here.
Still here? Go away!
Ok, I suck, feeling better now?

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1356 726aef4b-f618-498e-8847-2d620e286838

15 years agoMake CFile::IsDir() work on those weird OS that don't like trailing slashes
psychon [Thu, 29 Jan 2009 15:39:26 +0000 (15:39 +0000)] 
Make CFile::IsDir() work on those weird OS that don't like trailing slashes

Yeah, I'm talking windows here.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1355 726aef4b-f618-498e-8847-2d620e286838

15 years agoUse O_BINARY when opening files if it is available
psychon [Wed, 28 Jan 2009 09:55:32 +0000 (09:55 +0000)] 
Use O_BINARY when opening files if it is available

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1354 726aef4b-f618-498e-8847-2d620e286838

15 years agoCFile::TryExLock(): Add O_CREAT to the default parameters
psychon [Tue, 27 Jan 2009 19:56:05 +0000 (19:56 +0000)] 
CFile::TryExLock(): Add O_CREAT to the default parameters

The old code in CLockFile automatically created the file too.
(Well, it also removed in in this case latter, but meh, so what?)

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1353 726aef4b-f618-498e-8847-2d620e286838

15 years agoOpen the ISpoofFile with mode 'O_RDWR|O_CREAT' instead of '(int)true'
psychon [Tue, 27 Jan 2009 19:54:38 +0000 (19:54 +0000)] 
Open the ISpoofFile with mode 'O_RDWR|O_CREAT' instead of '(int)true'

This fixes a bug from r1337

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1352 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdd the necessary makefile magic for compiling on cygwin
psychon [Mon, 26 Jan 2009 19:57:34 +0000 (19:57 +0000)] 
Add the necessary makefile magic for compiling on cygwin

This also works with make install (thanks to rpath).

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1351 726aef4b-f618-498e-8847-2d620e286838

15 years agoInclude Utils.h in less headers and move some code out of the header
psychon [Sun, 25 Jan 2009 20:07:14 +0000 (20:07 +0000)] 
Include Utils.h in less headers and move some code out of the header

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1350 726aef4b-f618-498e-8847-2d620e286838

15 years agoUse that new define everywhere
psychon [Sun, 25 Jan 2009 16:51:54 +0000 (16:51 +0000)] 
Use that new define everywhere

Now there are no uses of DEBUG_ONLY() left :(

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1349 726aef4b-f618-498e-8847-2d620e286838

15 years agoAdd a DEBUG() define which can be used for outputting debug info
psychon [Sun, 25 Jan 2009 16:50:40 +0000 (16:50 +0000)] 
Add a DEBUG() define which can be used for outputting debug info

DEBUG_ONLY() is only ever used for debug output, so adding a separate define
for this sounds like a good idea.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1348 726aef4b-f618-498e-8847-2d620e286838

15 years agosavebuff: substr() could throw an exception, use Left() instead
psychon [Sun, 25 Jan 2009 15:33:47 +0000 (15:33 +0000)] 
savebuff: substr() could throw an exception, use Left() instead

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1347 726aef4b-f618-498e-8847-2d620e286838

15 years agoCheck in CZNC::AddUser() if the username is still available
psychon [Sun, 25 Jan 2009 11:12:36 +0000 (11:12 +0000)] 
Check in CZNC::AddUser() if the username is still available

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1346 726aef4b-f618-498e-8847-2d620e286838

15 years agoSavebuff: Don't reload old channel buffers
psychon [Sat, 24 Jan 2009 19:10:05 +0000 (19:10 +0000)] 
Savebuff: Don't reload old channel buffers

Channel buffers are loaded from disk when we join a channel (OnJoin) and when
the module is loaded (OnBoot(), called from OnLoad()) and only if KeepBuffer
for that channel is turned on. So every case is handled.
If we now also load channel buffers in SaveBufferToDisk() we will only reload
old channel buffers which were deleted since then
(e.g. /msg *status clearallchannelbuffers).

Thanks to Julian for finding this bug and helping me debug.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1345 726aef4b-f618-498e-8847-2d620e286838