Commit Graph

494 Commits

Author SHA1 Message Date
psychon
9f1f8950f8 Fix crash bug in stickychan
When you are already in #znc and you did 'stick znc' (# prefix missing!),
stickychan caused segfaults or different weird behavior. This happened because
stickychan didn't handle errors from CUser::AddChan(). AddChan() can only error
out if the channel already exists, but since stickychan already checked this,
were does the error come from?
CChan's constructor does some sanity checks on the channel name. It
automatically adds the proper channel prefix (most likely #) if it's missing.
This means when stickychan checked for the channel "znc" it correctly didn't
find one. When it then tried to add "znc", it really tried adding "#znc" which
could fail if the channel was already added.

Thanks to DM8Mydog for finding this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1500 726aef4b-f618-498e-8847-2d620e286838
2009-04-27 18:56:03 +00:00
psychon
dfd95078dd modperl also needs -Wno-missing-declarations
Now ZNC compiles with -Wmissing-declarations :)
(BTW I hate the perl headers, could some fix them app so that they cause
less warnings?)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1499 726aef4b-f618-498e-8847-2d620e286838
2009-04-26 10:14:42 +00:00
psychon
c4972caafe fail2ban: Add number of allowed failed logins
This adds a new, second argument to fail2ban which is the number of failed
logins one is allowed before being banned. Each login attempt resets the
timeout. This value defaults to 2.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1489 726aef4b-f618-498e-8847-2d620e286838
2009-04-11 20:06:13 +00:00
psychon
424e6c1820 partyline: Fix the KICK sent for deleted users
Before this, the KICK message was missing a target which was kicked.
Now the user kicks himself. :)

Thanks to JoeK for reporting this bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1486 726aef4b-f618-498e-8847-2d620e286838
2009-04-09 08:22:20 +00:00
psychon
2f64dffee3 Partyline: Add defines for the used channel prefix
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1485 726aef4b-f618-498e-8847-2d620e286838
2009-04-07 16:14:14 +00:00
psychon
02d6546a0b Add support for per-channel settings to admin
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1484 726aef4b-f618-498e-8847-2d620e286838
2009-04-07 11:38:17 +00:00
psychon
3b9a9c2b80 Webadmin: Make this work with the browser cache
This moves all static webadmin files (images, css) to the data/ subdirectory
of the skin dir. The webadmin module is changed to redirect requests to
/<skin name>/ to that data directory. The skins are changed to use the
new URL when linking to their stuff. (I only needed to change the path to
the main.css file in each Header.tmpl. Since the .css and the images are now
in the same directory, relative URLs work just fine).

This means that we now generate different URLs after changing the webadmin
skins and the browser cache can do its thing.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1481 726aef4b-f618-498e-8847-2d620e286838
2009-04-06 16:00:23 +00:00
psychon
694b60d53b Admin: Use CString's constructor instead of reinventing the wheel
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1480 726aef4b-f618-498e-8847-2d620e286838
2009-04-06 06:45:19 +00:00
psychon
8bc4b736cd Fix a compiler warning in email
Now that GetMTime() returns a time_t...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1479 726aef4b-f618-498e-8847-2d620e286838
2009-04-05 19:09:03 +00:00
psychon
c80690a9fc admin: DelUser can now handle spaces in user names
The new CloneUser command allows one to create a user with a space in
its name and the code for reading znc.conf allows spaces too. So now
one can even get rid of this users again...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1478 726aef4b-f618-498e-8847-2d620e286838
2009-04-04 18:43:24 +00:00
psychon
5618aa2a47 admin: Add a CloneUser command
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1477 726aef4b-f618-498e-8847-2d620e286838
2009-04-04 18:41:14 +00:00
psychon
43e401d483 webadmin: Remove some completely useless argument to IsAdmin()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1473 726aef4b-f618-498e-8847-2d620e286838
2009-04-02 12:34:13 +00:00
psychon
63b437374d Don't ask me, I don't know
That false/true thing makes no sense and pUser was passed in to a bool
argument which means it was always true... weird...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1472 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 15:49:49 +00:00
psychon
a6300e37fa Some more const_iterator instead of iterator
Thanks KiNgMaR again.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1456 726aef4b-f618-498e-8847-2d620e286838
2009-03-30 14:42:03 +00:00
psychon
8429f1274f autoop: Use const_iterator instead of iterator where it makes sense
Thanks to KiNgMaR for the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1451 726aef4b-f618-498e-8847-2d620e286838
2009-03-29 12:23:59 +00:00
sebastinas
dcc49f9c6f 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
2009-03-23 20:43:11 +00:00
psychon
27a51fcec7 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
2009-03-21 09:32:50 +00:00
psychon
32ffc2b3d5 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
2009-03-16 11:59:36 +00:00
psychon
a743dd248e 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
2009-03-14 14:48:26 +00:00
sebastinas
accd7b26cc My bad. Fixed the build error.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1424 726aef4b-f618-498e-8847-2d620e286838
2009-03-11 21:11:58 +00:00
sebastinas
b170c83808 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
2009-03-11 19:24:30 +00:00
silverleo
f52f4b2746 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
2009-03-07 11:24:34 +00:00
silverleo
036a140290 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
2009-03-07 11:16:28 +00:00
psychon
e21afe5346 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
2009-03-06 14:24:47 +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
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
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
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
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
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
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
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
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
432a04e545 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
2009-01-26 19:57:34 +00:00
psychon
235b10c200 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
2009-01-25 16:51:54 +00:00
psychon
136a62707b 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
2009-01-25 15:33:47 +00:00
psychon
74f9f3e864 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
2009-01-24 19:10:05 +00:00
psychon
7ab0b8d959 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
2009-01-23 18:46:39 +00:00
psychon
6345ce12fa 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
2009-01-19 15:55:41 +00:00
psychon
55fcaa9489 Watch: Add timestamps to the cached messages
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1333 726aef4b-f618-498e-8847-2d620e286838
2009-01-16 11:36:27 +00:00
psychon
2efea2157a 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
2009-01-14 15:17:30 +00:00
psychon
6e880c5930 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
2009-01-13 17:10:05 +00:00
psychon
a3169af5bd 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
2009-01-08 15:57:32 +00:00
psychon
607a7f1c16 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
2009-01-04 10:48:02 +00:00