]> jfr.im git - irc/znc/znc.git/log
irc/znc/znc.git
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

15 years agoAdd a ModHandle typedef instead of using void* directly
psychon [Sat, 24 Jan 2009 09:11:50 +0000 (09:11 +0000)] 
Add a ModHandle typedef instead of using void* directly

This makes it clearer what this variable is and it makes porting to windows
easier, because we can just change the typedef to HMODULE.

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

15 years agoMake GetPass() return a CString instead of a char*
psychon [Fri, 23 Jan 2009 18:46:39 +0000 (18:46 +0000)] 
Make GetPass() return a CString instead of a char*

In theory this could lead to extra copies of the password in memory, but since
no caller actually makes sure that those passwords are forgotten as fast as
possible, I don't see why this should be done the Old Way(tm).

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

15 years agoUse unsigned int instead of uint in the one place where it is currently used
psychon [Fri, 23 Jan 2009 14:20:24 +0000 (14:20 +0000)] 
Use unsigned int instead of uint in the one place where it is currently used

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

15 years agoCleanup: Remove an unnecessary scope operator
psychon [Fri, 23 Jan 2009 13:50:53 +0000 (13:50 +0000)] 
Cleanup: Remove an unnecessary scope operator

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

15 years agoFix a bug where ZNC would fail to send out its own ip for DCC bouncing
psychon [Thu, 22 Jan 2009 17:52:35 +0000 (17:52 +0000)] 
Fix a bug where ZNC would fail to send out its own ip for DCC bouncing

CUtils::GetLongIP() had a bug where it would overflow an integer for IPs
which started which a number higher than 127.
This is now fixed by using unsigned integers and doing that shift on a long.

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

15 years agoCheck if lstat() is available and use stat() instead if it isn't
psychon [Thu, 22 Jan 2009 11:19:42 +0000 (11:19 +0000)] 
Check if lstat() is available and use stat() instead if it isn't

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

15 years agoDon't build the znc binary with position independent code
psychon [Wed, 21 Jan 2009 13:30:07 +0000 (13:30 +0000)] 
Don't build the znc binary with position independent code

This is only needed for code that ends up in a shared object which is the
module code for us.

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

15 years agoRemove CLockFile and let CFile do its job
psychon [Tue, 20 Jan 2009 13:21:29 +0000 (13:21 +0000)] 
Remove CLockFile and let CFile do its job

This shouldn't contain any major behaviour change, but there are some minor
ones. Also, the API for a shared lock wasn't used and thus is dropped.

Thanks to cnu for this idea.

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

15 years agoMake O_RDONLY the default mode when opening files through CFile
psychon [Mon, 19 Jan 2009 15:55:41 +0000 (15:55 +0000)] 
Make O_RDONLY the default mode when opening files through CFile

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

15 years agoUpdate to latest Csocket
psychon [Sun, 18 Jan 2009 10:32:16 +0000 (10:32 +0000)] 
Update to latest Csocket

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

15 years agoMD5: Dunno if this makes the code better or worse...
psychon [Sat, 17 Jan 2009 10:25:09 +0000 (10:25 +0000)] 
MD5: Dunno if this makes the code better or worse...

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

15 years agoWatch: Add timestamps to the cached messages
psychon [Fri, 16 Jan 2009 11:36:27 +0000 (11:36 +0000)] 
Watch: Add timestamps to the cached messages

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

15 years agoUse RTLD_NOW instead of RTLD_LAZY when dlopen()ing modules
psychon [Thu, 15 Jan 2009 18:56:36 +0000 (18:56 +0000)] 
Use RTLD_NOW instead of RTLD_LAZY when dlopen()ing modules

Now a module with unresolved symbols will fail to load instead of
potentially getting ZNC killed when an undefined symbol was used.

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

15 years agowebadmin: reload global modules whose settings were changed
psychon [Wed, 14 Jan 2009 15:17:30 +0000 (15:17 +0000)] 
webadmin: reload global modules whose settings were changed

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

15 years agoRemove maxlength="16" from the password input boxes in webadmin
psychon [Tue, 13 Jan 2009 17:10:05 +0000 (17:10 +0000)] 
Remove maxlength="16" from the password input boxes in webadmin

This lead to silently truncated passwords which made logins a no-go.

Thanks to Julian for finding this one.

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

15 years agoMove SetArgs above the OnLoad module calls so a module can reset the args.
silverleo [Mon, 12 Jan 2009 16:15:29 +0000 (16:15 +0000)] 
Move SetArgs above the OnLoad module calls so a module can reset the args.

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

15 years agoMakefile: Use @includedir@ instead of @prefix@/include
psychon [Mon, 12 Jan 2009 16:02:20 +0000 (16:02 +0000)] 
Makefile: Use @includedir@ instead of @prefix@/include

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

15 years agoHandle JOIN redirects due to +L
psychon [Sun, 11 Jan 2009 08:47:27 +0000 (08:47 +0000)] 
Handle JOIN redirects due to +L

Without this, ZNC would keep trying to join the channel which is full
and which caused the redirect.

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

15 years agoSome updates to the README file
psychon [Sat, 10 Jan 2009 10:12:10 +0000 (10:12 +0000)] 
Some updates to the README file

The biggest change is that it now knows that rehashing is possible
and that we have a module data directory.

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

15 years agoUpdate channel buffers for detached channels
psychon [Fri, 9 Jan 2009 17:22:15 +0000 (17:22 +0000)] 
Update channel buffers for detached channels

Now ZNC produces a normal buffer playback if you re-attach a detached channel.

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

15 years agoAdd CUtils::SaltedHash() for doing salted hashes and do some cleanup
psychon [Thu, 8 Jan 2009 15:57:32 +0000 (15:57 +0000)] 
Add CUtils::SaltedHash() for doing salted hashes and do some cleanup

The stuff in CUtils::GetHashPass() and CUtils::GetSaltedHashPass() shouldn't
hurt, since we don't do such stuff in other places for passwords either.

This should improve the readability of the code a lot.

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

15 years agoAlways allow /msg *status setbuffer <chan>, even if we are not in <chan>
psychon [Wed, 7 Jan 2009 17:38:49 +0000 (17:38 +0000)] 
Always allow /msg *status setbuffer <chan>, even if we are not in <chan>

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

15 years agoMake CString::Trim*() faster
psychon [Tue, 6 Jan 2009 09:43:18 +0000 (09:43 +0000)] 
Make CString::Trim*() faster

Before, they would remove one character at a time.
Now they do everything at once.

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

15 years agoUse CString::TrimRight() to make this code more readable
psychon [Mon, 5 Jan 2009 11:45:12 +0000 (11:45 +0000)] 
Use CString::TrimRight() to make this code more readable

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

15 years agoGet rid of most strtoul() and atoi() calls and use CString's features instead
psychon [Sun, 4 Jan 2009 10:48:02 +0000 (10:48 +0000)] 
Get rid of most strtoul() and atoi() calls and use CString's features instead

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

15 years agoAdd back substitute for @VERSION@ to configure
psychon [Sat, 3 Jan 2009 09:55:21 +0000 (09:55 +0000)] 
Add back substitute for @VERSION@ to configure

znc-config.in wants @VERSION@ and should also get it.

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

15 years agoaccess() is evil and we never want a controlling TTY
psychon [Fri, 2 Jan 2009 17:48:20 +0000 (17:48 +0000)] 
access() is evil and we never want a controlling TTY

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

15 years agoHappy New Year 2009 everyone!
psychon [Thu, 1 Jan 2009 12:22:21 +0000 (12:22 +0000)] 
Happy New Year 2009 everyone!

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

15 years agoUse fchmod() instead of chmod() if the file is already open
psychon [Wed, 31 Dec 2008 14:34:55 +0000 (14:34 +0000)] 
Use fchmod() instead of chmod() if the file is already open

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

15 years agoShow client IP in debug when username is not available.
silverleo [Wed, 31 Dec 2008 13:49:29 +0000 (13:49 +0000)] 
Show client IP in debug when username is not available.

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

15 years agoAdd OnUnknownUserRaw() global module call.
silverleo [Wed, 31 Dec 2008 12:22:38 +0000 (12:22 +0000)] 
Add OnUnknownUserRaw() global module call.

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

15 years agoFixed awaynick so it doesnt evaluate the awaynick multiple times. Also fixed a timer...
silverleo [Tue, 30 Dec 2008 23:17:50 +0000 (23:17 +0000)] 
Fixed awaynick so it doesnt evaluate the awaynick multiple times. Also fixed a timer problem if the client disconnected before the backnicktimer fired.

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

15 years agoAllow custom compiler flags for znc-buildmod via environment variables. Patch from...
silverleo [Tue, 30 Dec 2008 18:49:47 +0000 (18:49 +0000)] 
Allow custom compiler flags for znc-buildmod via environment variables. Patch from flakes.

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

15 years agoRemove some code duplications and move functions into classes
psychon [Tue, 30 Dec 2008 13:05:04 +0000 (13:05 +0000)] 
Remove some code duplications and move functions into classes

This removes ReadFile(), WriteFile(), ReadLine(), Lower() and Upper() from
Utils.h and adds CFile::ReadFile().

The biggest part of this patch fixes modules to use CFile and CString instead
of these global functions.

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

15 years agoShow arguments used to load the module instead of the description in listmods.
silverleo [Mon, 29 Dec 2008 18:46:39 +0000 (18:46 +0000)] 
Show arguments used to load the module instead of the description in listmods.

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

15 years agoBlock pong replies that we requested.
silverleo [Mon, 29 Dec 2008 18:43:47 +0000 (18:43 +0000)] 
Block pong replies that we requested.

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

15 years agoAppend an * to the current server in *status listservers
silverleo [Mon, 29 Dec 2008 18:11:17 +0000 (18:11 +0000)] 
Append an * to the current server in *status listservers

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

15 years agoMake CChan::AddNicks() easier to understand and probably a little faster
psychon [Mon, 29 Dec 2008 09:32:36 +0000 (09:32 +0000)] 
Make CChan::AddNicks() easier to understand and probably a little faster

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

15 years agoImprove CFile::ReadLine() a little
psychon [Sun, 28 Dec 2008 13:03:43 +0000 (13:03 +0000)] 
Improve CFile::ReadLine() a little

IMHO it is now a little clearer how this function works and it might be
a little faster. Biggest change is that we now read 4k of the file at once
instead of reading it in 64byte chunks. I doubt that this causes a lot more
memory usage, because CFile instances usually dont live for long, but it
should really lower the number of syscalls we need for reading a file.

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

15 years agoUse CSocket instead of Csock in the email module
psychon [Sat, 27 Dec 2008 09:06:49 +0000 (09:06 +0000)] 
Use CSocket instead of Csock in the email module

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

15 years agoMake watch save its settings and add CModule::ClearNV()
psychon [Fri, 26 Dec 2008 15:12:25 +0000 (15:12 +0000)] 
Make watch save its settings and add CModule::ClearNV()

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

15 years agoSome cleanup and fixes to schat
psychon [Thu, 25 Dec 2008 08:48:59 +0000 (08:48 +0000)] 
Some cleanup and fixes to schat

- schat now works again (yay)
- it now uses CSocket instead of Csock directly
- list only displays schat's own sockets
- other minor stuff

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

15 years agoMake CNick smaller
psychon [Wed, 24 Dec 2008 10:34:07 +0000 (10:34 +0000)] 
Make CNick smaller

This removes some not-so-important cache and uses a CString instead of a
set<unsigned char> for saving the flags this nick has (op, voice, ...).
set is huge!

Before the virtual removal (r1300), CNick had 144 bytes, without the virtuals
it only took 112 bytes. Now after this commit it is down to 40 bytes. (amd64)

Happy Christmas tomaw ;)

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

15 years agoMake CChan smaller
psychon [Tue, 23 Dec 2008 10:07:54 +0000 (10:07 +0000)] 
Make CChan smaller

This is mostly done by removing unused members, but there is also removes a
cache which saved how many opped, voiced etc users are on a channel.
This shouldn't result in a big slowdown, since this data is only ever used
for /msg *status listchans.
Also, this replaces the API to access this data with a version which should
be faster especially for big channels.

On amd64 the size of CChan was 600 bytes before and is 400 bytes now.

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

15 years agoRemove virtual where it makes no sense
psychon [Mon, 22 Dec 2008 17:22:34 +0000 (17:22 +0000)] 
Remove virtual where it makes no sense

This commit actually saves memory, since some classes no longer contain a
pointer to their vtable!

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

15 years agoDon't append a slash to the paths returns from CZNC::Get*Path()
psychon [Sun, 21 Dec 2008 17:10:25 +0000 (17:10 +0000)] 
Don't append a slash to the paths returns from CZNC::Get*Path()

The old versions didn't do this either and thus we used two slashes.
While this doesn't hurt, it doesn't look good either.

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

15 years agoDont try to join our sticky channels when the irc connection is not available.
silverleo [Sun, 21 Dec 2008 09:05:16 +0000 (09:05 +0000)] 
Dont try to join our sticky channels when the irc connection is not available.

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

15 years agoChanged ping timers and timeout settings to use more reasonable values. Also changed...
silverleo [Sun, 21 Dec 2008 09:03:04 +0000 (09:03 +0000)] 
Changed ping timers and timeout settings to use more reasonable values. Also changed timeout type for irc and client sockets.

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