]> arthur.barton.de Git - ngircd.git/commitdiff
New config option NoDNS: disables all DNS queries.
authorFlorian Westphal <fw@strlen.de>
Thu, 25 Oct 2007 11:01:19 +0000 (11:01 +0000)
committerFlorian Westphal <fw@strlen.de>
Thu, 25 Oct 2007 11:01:19 +0000 (11:01 +0000)
man/ngircd.conf.5.tmpl
src/ngircd/client.c
src/ngircd/conf.c
src/ngircd/conf.h
src/ngircd/conn.c

index f2443671b1bebc809f2c3eae3f06d4b1dc46b1ea..8321900926d6218ec9ffb7ad34a3166a90f608dd 100644 (file)
@@ -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,6 +150,13 @@ by non-chanops as if they were coming from the server. Default: no.
 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
index 1e35fd81dc64994cfd7694e8d756d5a954352850..474ae4b6460c4be738b90e723065885ffa0a51ad 100644 (file)
@@ -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 );
 
index 3c7b42d5063d7d90b8d260a308af9db1bef1f98b..c9643dad491d75c5abefb7af49a7431ef31f1991 100644 (file)
@@ -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 );
index e927739d791091a55d0e36408d157e8c39ba5f76..ce09997c23ee8bffeb460c405a3791fa922b527c 100644 (file)
@@ -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 */
index f992bc25817df47070169b7608bda8f3b9f19710..8cd98ab0f2d0f2e8f31a1daabcb422bc39d977b4 100644 (file)
@@ -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 */