Commit Diff
Diff:
b861f536b29e2a7989f77b0dcb26287dae897885
001c00b27312289e40425db19ce9f7d957ffbbba
001c00b27312289e40425db19ce9f7d957ffbbba
Commit:
001c00b27312289e40425db19ce9f7d957ffbbba
Tree:
a3bbb36be8b63a4aa8fe5cc53b7846b7658cded4
Committer:
Florian Westphal <fw@strlen.de>
Date:
Thu Oct 25 11:01:19 2007
UTC
Message:
New config option NoDNS: disables all DNS queries.
--- man/ngircd.conf.5.tmpl
+++ man/ngircd.conf.5.tmpl
@@ -1,5 +1,5 @@
.\"
-.\" $Id: ngircd.conf.5.tmpl,v 1.4 2007/10/13 20:45:12 fw Exp $
+.\" $Id: ngircd.conf.5.tmpl,v 1.5 2007/10/25 11:01:19 fw Exp $
.\"
.TH ngircd.conf 5 "August 2005" ngircd "ngIRCd Manual"
.SH NAME
@@ -150,7 +150,14 @@ by non-chanops as if they were coming from the server.
If enabled, no new channels can be created. Useful if
you do not want to have channels other than those defined in
the config file.
+Default: No.
.TP
+\fBNoDNS\fR
+If enabled, ngircd will not make DNS lookups when clients connect.
+If you configure ngircd to connect to other servers, ngircd may still
+perform a DNS lookup if required.
+Default: No.
+.TP
\fBMaxConnections\fR
Maximum number of simultaneous connection the server is allowed to accept
(0: unlimited). Default: 0.
--- src/ngircd/client.c
+++ src/ngircd/client.c
@@ -17,7 +17,7 @@
#include "portab.h"
-static char UNUSED id[] = "$Id: client.c,v 1.95 2007/01/23 16:07:19 alex Exp $";
+static char UNUSED id[] = "$Id: client.c,v 1.96 2007/10/25 11:01:19 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -94,9 +94,10 @@ Client_Init( void )
This_Server->hops = 0;
gethostname( This_Server->host, CLIENT_HOST_LEN );
- h = gethostbyname( This_Server->host );
- if( h ) strlcpy( This_Server->host, h->h_name, sizeof( This_Server->host ));
-
+ if (!Conf_NoDNS) {
+ h = gethostbyname( This_Server->host );
+ if (h) strlcpy(This_Server->host, h->h_name, sizeof(This_Server->host));
+ }
Client_SetID( This_Server, Conf_ServerName );
Client_SetInfo( This_Server, Conf_ServerInfo );
--- src/ngircd/conf.c
+++ src/ngircd/conf.c
@@ -14,7 +14,7 @@
#include "portab.h"
-static char UNUSED id[] = "$Id: conf.c,v 1.100 2007/10/24 00:48:41 fw Exp $";
+static char UNUSED id[] = "$Id: conf.c,v 1.101 2007/10/25 11:01:19 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -205,6 +205,7 @@ Conf_Test( void )
printf( " OperCanUseMode = %s\n", Conf_OperCanMode == true ? "yes" : "no" );
printf( " OperServerMode = %s\n", Conf_OperServerMode == true? "yes" : "no" );
printf( " PredefChannelsOnly = %s\n", Conf_PredefChannelsOnly == true ? "yes" : "no" );
+ printf( " NoDNS = %s\n", Conf_NoDNS ? "yes" : "no");
printf( " MaxConnections = %ld\n", Conf_MaxConnections);
printf( " MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP);
printf( " MaxJoins = %d\n\n", Conf_MaxJoins);
@@ -444,6 +445,7 @@ Set_Defaults( bool InitServers )
Conf_Channel_Count = 0;
Conf_OperCanMode = false;
+ Conf_NoDNS = false;
Conf_PredefChannelsOnly = false;
Conf_OperServerMode = false;
@@ -783,6 +785,11 @@ Handle_GLOBAL( int Line, char *Var, char *Arg )
Conf_PredefChannelsOnly = Check_ArgIsTrue( Arg );
return;
}
+ if( strcasecmp( Var, "NoDNS" ) == 0 ) {
+ /* don't do reverse dns lookups when clients connect? */
+ Conf_NoDNS = Check_ArgIsTrue( Arg );
+ return;
+ }
if( strcasecmp( Var, "OperCanUseMode" ) == 0 ) {
/* Are IRC operators allowed to use MODE in channels they aren't Op in? */
Conf_OperCanMode = Check_ArgIsTrue( Arg );
--- src/ngircd/conf.h
+++ src/ngircd/conf.h
@@ -8,7 +8,7 @@
* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
- * $Id: conf.h,v 1.43 2007/06/28 05:15:18 fw Exp $
+ * $Id: conf.h,v 1.44 2007/10/25 11:01:19 fw Exp $
*
* Configuration management (header)
*/
@@ -118,6 +118,9 @@ GLOBAL bool Conf_PredefChannelsOnly;
/* Are IRC operators allowed to always use MODE? */
GLOBAL bool Conf_OperCanMode;
+/* Disable all DNS functions? */
+GLOBAL bool Conf_NoDNS;
+
/* If an IRC op gives chanop privileges without being a chanop,
* ircd2 will ignore the command. This enables a workaround:
* It masks the command as coming from the server */
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
@@ -17,7 +17,7 @@
#include "portab.h"
#include "io.h"
-static char UNUSED id[] = "$Id: conn.c,v 1.212 2007/10/04 15:03:56 alex Exp $";
+static char UNUSED id[] = "$Id: conn.c,v 1.213 2007/10/25 11:01:19 fw Exp $";
#include "imp.h"
#include <assert.h>
@@ -1039,11 +1039,11 @@ New_Connection( int Sock )
Client_SetHostname( c, My_Connections[new_sock].host );
- Resolve_Addr(&My_Connections[new_sock].res_stat, &new_addr,
- My_Connections[new_sock].sock, cb_Read_Resolver_Result);
+ if (!Conf_NoDNS)
+ Resolve_Addr(&My_Connections[new_sock].res_stat, &new_addr,
+ My_Connections[new_sock].sock, cb_Read_Resolver_Result);
- /* Penalty-Zeit setzen */
- Conn_SetPenalty( new_sock, 4 );
+ Conn_SetPenalty(new_sock, 4);
return new_sock;
} /* New_Connection */