#include "portab.h"
-static char UNUSED id[] = "$Id: conf.c,v 1.74 2005/03/20 15:00:25 fw Exp $";
+static char UNUSED id[] = "$Id: conf.c,v 1.79 2005/07/11 14:11:35 fw Exp $";
#include "imp.h"
#include <assert.h>
struct passwd *pwd;
struct group *grp;
- int i;
+ unsigned int i;
Use_Log = false;
Set_Defaults( true );
Read_Config( );
Validate_Config( true );
- /* If stdin is a valid tty wait for a key: */
- if( isatty( fileno( stdin )))
+ /* If stdin and stdout ("you can read our nice message and we can
+ * read in your keypress") are valid tty's, wait for a key: */
+ if( isatty( fileno( stdin )) && isatty( fileno( stdout )))
{
puts( "OK, press enter to see a dump of your service configuration ..." );
getchar( );
int i;
strcpy( Conf_ServerName, "" );
- sprintf( Conf_ServerInfo, "%s %s", PACKAGE_NAME, PACKAGE_VERSION );
+ snprintf( Conf_ServerInfo, sizeof Conf_ServerInfo, "%s %s", PACKAGE_NAME, PACKAGE_VERSION );
strcpy( Conf_ServerPwd, "" );
strcpy( Conf_ServerAdmin1, "" );
LOCAL void
Handle_OPERATOR( int Line, char *Var, char *Arg )
{
- unsigned int len;
assert( Line > 0 );
assert( Var != NULL );
assert( Arg != NULL );
if( strcasecmp( Var, "Mask" ) == 0 )
{
if (Conf_Oper[Conf_Oper_Count - 1].mask) return; /* Hostname already configured */
- len = strlen( Arg ) + 1;
- Conf_Oper[Conf_Oper_Count - 1].mask = malloc( len );
+ Conf_Oper[Conf_Oper_Count - 1].mask = strdup( Arg );
if (! Conf_Oper[Conf_Oper_Count - 1].mask) {
Config_Error( LOG_ERR, "%s, line %d: Cannot allocate memory for operator mask: %s", NGIRCd_ConfFile, Line, strerror(errno) );
return;
}
- strlcpy( Conf_Oper[Conf_Oper_Count - 1].mask, Arg, len);
return;
}
Config_Error( LOG_ERR, "%s, line %d (section \"Operator\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
/* No administrative information configured! */
Config_Error( LOG_WARNING, "No administrative information configured but required by RFC!" );
}
-#ifdef FD_SETSIZE
- if(( Conf_MaxConnections > (long)FD_SETSIZE ) || ( Conf_MaxConnections < 1 ))
- {
- Conf_MaxConnections = (long)FD_SETSIZE;
- Config_Error( LOG_ERR, "Setting MaxConnections to %ld, select() can't handle more file descriptors!", Conf_MaxConnections );
- }
-#else
- Config_Error( LOG_WARN, "Don't know how many file descriptors select() can handle on this system, don't set MaxConnections too high!" );
-#endif
-
#ifdef DEBUG
servers = servers_once = 0;
for( i = 0; i < MAX_SERVERS; i++ )