New config option NoDNS: disables all DNS queries.

This commit is contained in:
Florian Westphal 2007-10-25 11:01:19 +00:00
parent b861f536b2
commit 001c00b273
5 changed files with 30 additions and 12 deletions

View 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

View 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 );

View 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 );

View 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 */

View 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 */