Commit Graph

1153 Commits

Author SHA1 Message Date
psychon
ecabbd2bcd Fix some of the direct module calls in Client.cpp
OnModCTCP(), OnModCommand() and OnModNotice() are now called through a
preprocessor macro that does all the magic. This fixes a couple of bugs:
- the m_pUser member of global modules for OnModNotice() was wrong
- OnModCTCP() wasn't called for global modules
- Finally handle 'throw UNLOAD' for all of this three module calls


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1162 726aef4b-f618-498e-8847-2d620e286838
2008-08-22 12:48:56 +00:00
psychon
ef31d6e239 Connect and reconnect faster to IRC
The first reconnect now happens when the timer is created which is
possibly thanks to latest Csocket.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1161 726aef4b-f618-498e-8847-2d620e286838
2008-08-21 10:47:09 +00:00
psychon
ec58e6f183 Some cleanup and optimizations to CTable
CTable now caches the width of each column instead of recalculating it
each time it is needed. The code for this was there before, but it was not
used. Now the widths are calculated when the table is filled, not when the
width is needed the first time.

This caching leads to a huge speedup (3-4 times faster) if there are many rows
in the table.

This also cleans up the interface by making it possible to mark
GetColumnWidth and GetLine as const.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1160 726aef4b-f618-498e-8847-2d620e286838
2008-08-20 08:13:23 +00:00
psychon
c3b6a4b29a Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1159 726aef4b-f618-498e-8847-2d620e286838
2008-08-18 11:10:27 +00:00
imaginos
5f0846fc9a changing data types back to proper notation, and down cast the array passed in
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1158 726aef4b-f618-498e-8847-2d620e286838
2008-08-17 18:46:43 +00:00
imaginos
5fbc0aa538 remove const keywords for perl's sake
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1157 726aef4b-f618-498e-8847-2d620e286838
2008-08-17 18:02:09 +00:00
imaginos
03213ae279 fix arg to PERL_SYS_INIT3
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1156 726aef4b-f618-498e-8847-2d620e286838
2008-08-17 17:48:18 +00:00
imaginos
b3bfb1b9ba bug fix as reported by http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=495076, still needs to be tested
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1155 726aef4b-f618-498e-8847-2d620e286838
2008-08-17 14:53:18 +00:00
psychon
2f74755d7a Fix a bug where ZNC always thought all channels where empty
Due to the recent change that ZNC calls SetIsOn(true) when we receive the JOIN,
not the 'end of names' reply, the nick list of a channel was always ignored.
This fixes this bug.

Thanks to cnu for using a svn version and reporting this bug. :)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1154 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 18:49:52 +00:00
psychon
8fa9122cdb Fix the keepnick module
- Properly initialize that pointer-beast.
- Actually compile.

Yeah, I know, I fail...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1153 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 11:54:26 +00:00
psychon
5d58910d24 Add a new module that implements KeepNick
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1152 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 11:36:30 +00:00
psychon
03e34ac6e6 Remove KeepNick
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1151 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 11:34:11 +00:00
psychon
3ec3f07523 Move CClient's UserCommand() and HelpUser() into a new file ClientCommand.cpp
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1150 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:38:24 +00:00
psychon
30404699e3 Handle the on-connect 433 in an own function
When our primary nick is already taken, we try a couple of different nicks in
order to be able to connect to the IRC server. This code is now in an
own function.

BTW: CIRCSock::Readline() is still waaay too long.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1149 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:34:15 +00:00
psychon
cd2fb1b1b5 Move the forwarding of raw 353 into an own function
This also contains some minor changes to the code. One of those is that we now
also handle namesx and uhnames for channels we don't know.
BTW: CIRCSock::ReadLine() is waaay too long.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1148 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:22:17 +00:00
psychon
3106f3b90e modperl: Fail if modperl.pm can not be loaded
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1147 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:16:52 +00:00
psychon
13dd3996d5 Remove some unused arguments and unimplemented functions
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1146 726aef4b-f618-498e-8847-2d620e286838
2008-07-24 10:14:41 +00:00
psychon
48d53876d6 Even more weird and broken clients sending even more and broken stuff
PART :#channel... Why do IRCds even parse this correctly? :(
Oh and yeah, it's eggdrop.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1145 726aef4b-f618-498e-8847-2d620e286838
2008-07-23 15:05:35 +00:00
psychon
cd8318370a Some weird clients might send a nickmask prefix, handle this correctly
*cough* eggdrop is evil *cough*

Thanks to dare for debugging this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1144 726aef4b-f618-498e-8847-2d620e286838
2008-07-23 13:36:04 +00:00
psychon
abeba8aea7 Simplify the connect user code a little
The old code used a timer. That timer needed to be restarted if the user list
was changed (adding / removing of users), because it saved an iterator into
that map between runs, which would become invalid.

The new code in CConnectUserTimer::RunJob() is actually more complicated now,
but the iterator is gone. This also means no need to restart that timer
more or less always. ;) (This also means one theoretical source of bugs less)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1143 726aef4b-f618-498e-8847-2d620e286838
2008-07-22 11:34:38 +00:00
psychon
cc3d99515d awaynick: Disable KeepNick on load instead of failing to load
This should make someone in #znc really happy. :P
This is based on a patch from SilverLeo.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1142 726aef4b-f618-498e-8847-2d620e286838
2008-07-22 08:39:18 +00:00
psychon
1f6abb6468 partyline: Some fixes for users who are not connected to IRC
This was found via default channels (LoadModule = partyline ~#chan).

- Always use a valid (=non-empty) server name
- If a user is not connected to IRC, all clients might have a different idea of
  the current nick. Handle this for SendNickList() via a new function
  PutUserIRCNick() that uses the irc nick if we are connected to IRC and else
  correctly uses the nick that clients thinks it curretnly has.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1141 726aef4b-f618-498e-8847-2d620e286838
2008-07-21 13:58:24 +00:00
psychon
1a1cc4c756 We are in a channel when we received the JOIN for it, not it's "end of /names"
This moves some calls from the raw 366 handler to the JOIN handler and it might
even fix a bug (well, which no one would ever have triggered).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1140 726aef4b-f618-498e-8847-2d620e286838
2008-07-21 10:15:16 +00:00
psychon
1c2c52651a Make webadmin generate salted passwords, too
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1139 726aef4b-f618-498e-8847-2d620e286838
2008-07-20 15:06:33 +00:00
psychon
c07347b9a0 Enable some more debug flags with --enable-debug
See these links for info on these defines:
 http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt12ch29.html
 http://gcc.gnu.org/onlinedocs/libstdc++/manual/debug_mode.html


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1138 726aef4b-f618-498e-8847-2d620e286838
2008-07-18 09:37:11 +00:00
psychon
10210e4619 Don't throw any exceptions in CModules::LoadModule() on version mismatch
This also removes all the code catching those exceptions. There was nothing
which justified these exceptions and removing them doesn't hurt.

ByeBye CException::EX_BadModVersion


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1137 726aef4b-f618-498e-8847-2d620e286838
2008-07-17 12:01:44 +00:00
psychon
27c1a76cf8 Shell module: Don't give any stdin to executed apps
We now close the write end of the pipe that serves as stdin for the apps
we run. This means that any read attempts will return EOD (read() returns 0)
which should hopefully tell our apps that we don't have stdin for them.
Sadly vim doesn't care... (Only thing I tested that still broke)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1136 726aef4b-f618-498e-8847-2d620e286838
2008-07-17 10:30:32 +00:00
psychon
0003c28f7b Shell module: Small cleanup
We already have a special function for stripping of special chars, so
why does the shell module still do it 'by hand'?


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1135 726aef4b-f618-498e-8847-2d620e286838
2008-07-17 10:16:40 +00:00
psychon
3c1e610cf5 Make CClient::GetNickMask() always return a valid nickmask
The recent removal of CUser::m_bIRCConnected lead to a bug here which is now
fixed.
In addition to this, this function now also works properly for users without
a vhost.

Oh and in User.cpp: Make sure CUser::GetIRCServer() returns an empty string
when we are no longer connected to an IRCd.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1134 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 10:44:37 +00:00
psychon
3e2b71263f Fix a potential crash bug on channel part (CChan::RemNick())
This function didn't properly check it had a valid iterator *before* using
this iterator (.begin()->second).

Now we first check if that iterator is valid (size() is *not* zero) before we
run this. No behaviour is changed, but the bug is gone. Yay. ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1133 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 10:42:27 +00:00
psychon
f7dcfcfa6e Replace usage of getresuid() with getuid() and geteuid()
getresuid() is a non-standard extension and is actually not defined on
some (older) boxes. Since we gain nothing with also checking the saved user id,
we can use this instead and, voila, znc compiles again.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1132 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 08:58:54 +00:00
psychon
bf3acfe88a Remove CUser::m_bIRCConnected
CUser::GetIRCSock() != NULL is the replacement. This is a small chance in
sematics. Before this, a user only counted as connected to IRC when the 001
numeric was received. Now it already counts as connected when the connection
was established. This change doesn't hurt any of the current users of
CUser::IsIRCConnected() and so this change should be fine.

Yay, one var less ;)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1131 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 08:19:57 +00:00
psychon
7059bf02f6 CUser::GetIRCSock() only returns a member var, so it can be moved to the header
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1130 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 08:16:43 +00:00
psychon
86924339a3 Add some 'const' attributes to various functions
No real changes in here, only way more constness...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1129 726aef4b-f618-498e-8847-2d620e286838
2008-07-14 08:13:06 +00:00
psychon
4a62fca388 Fix CUser::Clone() to work with salted passwords
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1128 726aef4b-f618-498e-8847-2d620e286838
2008-07-13 16:25:53 +00:00
psychon
bf2bd39769 Add supports for salted hashes to znc.conf
These changes the format of the 'Pass' config option. The old format is
still accepted. The new format is:

  Pass = plain#<plain text password>
  Pass = md5#<password hash>
  Pass = md5#<hash of password with salt appended>#<salt>#

This also makes ZNC only write configs in the new format.

znc --makeconf and znc --makepass now always generate salted hashes.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1127 726aef4b-f618-498e-8847-2d620e286838
2008-07-13 15:32:27 +00:00
psychon
ac2caa0f22 znc-config: Don't link in any libraries
Any library the znc binary links to is automatically available to modules.
So there is no point in linking modules to @LIBS@ as znc is linked against
those already. modules/Makefile.in already does it this way, not also
znc-config does it


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1126 726aef4b-f618-498e-8847-2d620e286838
2008-07-12 21:43:47 +00:00
psychon
a35af71121 __GNU_LIBRARY__ doesn't seem to be needed on FreeBSD
This defines was added in rev 586 saying it's needed for 'older BSD boxes'.
I don't know how old 'old' is in this context, but since we don't compile
on FreeBSD 4 anyway (which really is old), because getopt_long is missing
(added in FreeBSD 5), we should give this a try.

I have no FreeBSD 5 box for testing if znc compiled/compiles there, so
suprise me!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1125 726aef4b-f618-498e-8847-2d620e286838
2008-07-12 07:26:56 +00:00
psychon
3b0a4dc4b5 Config reading: Apply a small (unnoticeable) optimization
Trim() always removes all trailing and leading spaces and line endings from
that string, so there is no point in this main loop. It will always run once,
anyway.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1124 726aef4b-f618-498e-8847-2d620e286838
2008-07-11 09:58:04 +00:00
psychon
b1cdf48d12 Increase the version number to 0.058
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1122 726aef4b-f618-498e-8847-2d620e286838
2008-07-10 13:14:14 +00:00
psychon
1903bf0e3d Increase the version number to 0.058
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1120 726aef4b-f618-498e-8847-2d620e286838
znc-0.058
2008-07-10 13:11:50 +00:00
psychon
e2cb9b41e0 Please just ignore this commit and pretend the previous commit already did this
I'm ashamed...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1119 726aef4b-f618-498e-8847-2d620e286838
2008-07-08 10:24:48 +00:00
psychon
b141ef44b6 Fix a crash with NAMESX
If we were joining a channel on a server with NAMESX support while a client was
connected that didn't know NAMESX and we received a raw 353 with a trailing
whitespace (UnrealIRCd does this), we were calling std::string::at(0) for an
empty string, which caused some assert to fail and ZNC to die.

This patch fixes this crash bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1118 726aef4b-f618-498e-8847-2d620e286838
2008-07-08 10:00:42 +00:00
psychon
9e5ec2d563 CIRCSock: Only say we are reconnecting if there is a server to connect to
If you '/msg *status delserver'd your last server, you would get a message
saying ZNC will reconnect, but it didn't. Now those messages look much better.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1117 726aef4b-f618-498e-8847-2d620e286838
2008-07-08 09:38:50 +00:00
psychon
a5dcb3ff77 webadmin: Use the new CZNC::AuthUser() API
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1116 726aef4b-f618-498e-8847-2d620e286838
2008-07-07 18:36:26 +00:00
psychon
31feec2c9f Use CZNC::Auth() to authenticate IRC clients
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1115 726aef4b-f618-498e-8847-2d620e286838
2008-07-07 18:35:41 +00:00
psychon
0bd4927d2c Unify some of the webadmin and client authentication code in CZNC::AuthUser()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1114 726aef4b-f618-498e-8847-2d620e286838
2008-07-07 18:34:32 +00:00
psychon
7965a12bd0 Fix a privilege escalation bug in webadmin if auth modules are used
auth modules = imapauth and saslauth

Some code in CWebAdminSock::OnLogin() is skipped if a module handles auth
and thus m_pUser stays NULL. Most checks for admin rights only check for
m_pUser being NULL and thus any user WHO ALREADY HAS A VALID LOGIN can edit
other users if they know their user name.
(=Change the password of an admin and log in using this info)

One of the major excpeptions are the templates which use m_bAdmin instead of
m_pUser for checking the privieleges, thus users still see the normal pages
and this bug stayed unnoticed for a while.

This patch now moves the code that sets m_pUser to some code which is executed
in both cases, when an auth module is in effect and when one isn't.
(Well, technically this isn't a move, but code duplication, but executing this
 twice won't hurt and one of the follow-up patches cleans this up.)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1113 726aef4b-f618-498e-8847-2d620e286838
2008-07-07 18:30:35 +00:00
psychon
5e0c652b9a Add the remote ip to the info CAuthBase got
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1112 726aef4b-f618-498e-8847-2d620e286838
2008-07-07 18:24:38 +00:00
psychon
5c7b586b2d Make it more clear where the 'IRCConnectEnabled'-flag is checked
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1111 726aef4b-f618-498e-8847-2d620e286838
2008-07-03 10:16:49 +00:00