Module: ngircd.git
Branch: master
Commit: 04e38f17ae671f84b93e06c6eefa9235dd71d6ce
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=04e38f17…
Author: Alexander Barton <alex(a)barton.de>
Date: Thu Aug 19 15:58:55 2010 +0200
Don't reset My_Connections[Idx].lastping when reading data
This fixes PING-PONG lag calculation (which resulted in "0" before).
The "lastping" time is still reset it if a time shift backwards has
been detected to prevent the daemon from miscalculating ping timeouts.
---
src/ngircd/conn.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c
index 58a3cbf..d0548c9 100644
--- a/src/ngircd/conn.c
+++ b/src/ngircd/conn.c
@@ -1507,7 +1507,7 @@ Read_Request( CONN_ID Idx )
* registered as a user, server or service connection. Don't update
* otherwise, so users have at least Conf_PongTimeout seconds time to
* register with the IRC server -- see Check_Connections().
- * Set "lastping", too, so we can handle time shifts backwards ... */
+ * Update "lastping", too, if time shifted backwards ... */
c = Conn_GetClient(Idx);
if (c && (Client_Type(c) == CLIENT_USER
|| Client_Type(c) == CLIENT_SERVER
@@ -1517,7 +1517,8 @@ Read_Request( CONN_ID Idx )
My_Connections[Idx].bps = 0;
My_Connections[Idx].lastdata = t;
- My_Connections[Idx].lastping = My_Connections[Idx].lastdata;
+ if (My_Connections[Idx].lastping > t)
+ My_Connections[Idx].lastping = t;
}
/* Look at the data in the (read-) buffer of this connection */
Module: ngircd.git
Branch: master
Commit: 2a4bf67aaceebd3567dcd0ac1db2b9027560f574
URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=2a4bf67a…
Author: Alexander Barton <alex(a)barton.de>
Date: Tue Aug 17 21:05:06 2010 +0200
Implement user mode "x": hostname cloaking (closes: #102)
When a client has user mode "x" set, its real hostname is cloaked
by substituting it with the server name (as configured in ngircd.conf).
Restricted clients (user mode "r") aren't allowed to change mode "x".
Please note that hostname cloaking is only in effect in server-client
communication! The server still uses the real hostname for its own
logging and for all server-server communication -- therefore all servers
in the network must support user mode "x" to prevent older servers
from leaking the real hostname of a cloaked client!
---
src/ngircd/defines.h | 2 +-
src/ngircd/irc-mode.c | 10 ++++++++++
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/src/ngircd/defines.h b/src/ngircd/defines.h
index 579d552..01b6037 100644
--- a/src/ngircd/defines.h
+++ b/src/ngircd/defines.h
@@ -80,7 +80,7 @@
#define RECONNECT_DELAY 3 /* Time to delay re-connect attempts
in seconds. */
-#define USERMODES "aciorsw" /* Supported user modes. */
+#define USERMODES "aciorswx" /* Supported user modes. */
#define CHANMODES "biIklmnoPstvz" /* Supported channel modes. */
#define CONNECTED true /* Internal status codes. */
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index 45defeb..df464a7 100644
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -185,6 +185,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
ERR_NOPRIVILEGES_MSG,
Client_ID(Origin));
break;
+
case 'o': /* IRC operator (only unsettable!) */
if(( ! set ) || ( Client_Type( Client ) == CLIENT_SERVER ))
{
@@ -199,6 +200,15 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
else ok = IRC_WriteStrClient( Origin, ERR_RESTRICTED_MSG, Client_ID( Origin ));
break;
+ case 'x': /* Cloak hostname */
+ if (Client_HasMode(Client, 'r'))
+ IRC_WriteStrClient(Origin,
+ ERR_RESTRICTED_MSG,
+ Client_ID(Origin));
+ else
+ x[0] = 'x';
+ break;
+
default:
Log( LOG_DEBUG, "Unknown mode \"%c%c\" from \"%s\"!?", set ? '+' : '-', *mode_ptr, Client_ID( Origin ));
if( Client_Type( Client ) != CLIENT_SERVER ) ok = IRC_WriteStrClient( Origin, ERR_UMODEUNKNOWNFLAG2_MSG, Client_ID( Origin ), set ? '+' : '-', *mode_ptr );