Commit Graph

1393 Commits

Author SHA1 Message Date
psychon
ea569a2bdc 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
2009-03-01 16:43:58 +00:00
psychon
e302611bd3 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
2009-03-01 13:07:11 +00:00
silverleo
ada9b8cf97 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
2009-02-27 20:58:34 +00:00
silverleo
35394275f2 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
2009-02-27 19:52:31 +00:00
silverleo
d7aa797a49 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
2009-02-27 16:11:53 +00:00
silverleo
ef22c446df 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
2009-02-27 15:53:38 +00:00
psychon
b0f94ba49c 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
2009-02-25 16:35:50 +00:00
psychon
e0a8f83e19 Increase the version number to 0.067
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1399 726aef4b-f618-498e-8847-2d620e286838
2009-02-24 16:41:22 +00:00
psychon
30699d0ebe Increase the version number to 0.066
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1397 726aef4b-f618-498e-8847-2d620e286838
znc-0.066
2009-02-24 16:15:28 +00:00
psychon
3188856a86 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
2009-02-24 16:02:35 +00:00
psychon
21120e2146 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
2009-02-24 16:00:11 +00:00
psychon
6499609608 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
2009-02-24 15:52:43 +00:00
psychon
9603da8e90 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
2009-02-24 14:55:44 +00:00
psychon
a7e8326300 Fix some "uninitialized variable" compiler warning
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1392 726aef4b-f618-498e-8847-2d620e286838
2009-02-23 19:24:41 +00:00
psychon
2430b5f6a6 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
2009-02-22 15:22:37 +00:00
psychon
b0994defb3 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
2009-02-21 16:50:40 +00:00
psychon
cbc27f5bb9 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
2009-02-21 16:48:28 +00:00
psychon
7a985ac077 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
2009-02-20 19:15:31 +00:00
prozacx
3d42554349 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
2009-02-20 05:50:36 +00:00
psychon
76bb08d0e8 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
2009-02-19 16:40:21 +00:00
psychon
6c87e17789 Get rid of the DEBUG_ONLY define
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1385 726aef4b-f618-498e-8847-2d620e286838
2009-02-18 16:10:32 +00:00
psychon
614999811f 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
2009-02-17 16:56:46 +00:00
psychon
70b60aa451 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
2009-02-17 15:29:06 +00:00
psychon
77e4ce400f 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
2009-02-17 13:14:49 +00:00
psychon
26fa234e05 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
2009-02-16 17:36:52 +00:00
psychon
0ad15ca2b1 Add sebastinas to the AUTHORS file
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1380 726aef4b-f618-498e-8847-2d620e286838
2009-02-16 17:29:39 +00:00
psychon
2c4d680cfd 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
2009-02-16 17:26:46 +00:00
psychon
77f1a0a52c Increase the version number to 0.065
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1378 726aef4b-f618-498e-8847-2d620e286838
2009-02-16 15:44:57 +00:00
psychon
25d172037f Increase the version number to 0.064
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1376 726aef4b-f618-498e-8847-2d620e286838
znc-0.064
2009-02-16 15:42:22 +00:00
psychon
5f60ce1906 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
2009-02-06 16:47:16 +00:00
psychon
8b15351aa2 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
2009-02-05 17:11:45 +00:00
psychon
8177a609d2 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
2009-02-05 15:33:48 +00:00
psychon
35458af905 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
2009-02-04 16:29:06 +00:00
psychon
0ac3466f75 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
2009-02-04 15:47:36 +00:00
psychon
4dd8802bf9 shell: Use CString::Replace() -.-
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1370 726aef4b-f618-498e-8847-2d620e286838
2009-02-03 19:43:35 +00:00
psychon
c7a98e7ec8 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
2009-02-03 19:42:40 +00:00
psychon
607bb4e1ce 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
2009-02-03 19:08:15 +00:00
psychon
ba5610654b 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
2009-02-03 18:21:33 +00:00
psychon
b17bfe7922 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
2009-02-03 18:18:05 +00:00
psychon
d3392e7f50 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
2009-02-03 18:15:56 +00:00
psychon
649dca204f 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
2009-02-02 15:24:48 +00:00
psychon
cd88623cbe 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
2009-02-02 15:23:03 +00:00
psychon
422ab3288e 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
2009-02-02 15:20:44 +00:00
psychon
a6995ba59a 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
2009-02-02 15:03:32 +00:00
psychon
aba7ae9973 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
2009-02-02 14:55:45 +00:00
psychon
3f00b9ef60 Just. Do. Not. Ask.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1359 726aef4b-f618-498e-8847-2d620e286838
2009-01-29 19:59:02 +00:00
psychon
ed43e95216 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
2009-01-29 19:39:21 +00:00
psychon
0f0463510c 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
2009-01-29 19:11:53 +00:00
psychon
9a8fbdb6e0 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
2009-01-29 15:41:38 +00:00
psychon
f7825e0016 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
2009-01-29 15:39:26 +00:00