2001-12-12 18:18:20 +01:00
|
|
|
/*
|
|
|
|
* ngIRCd -- The Next Generation IRC Daemon
|
2011-03-19 16:58:29 +01:00
|
|
|
* Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors.
|
2001-12-12 18:18:20 +01:00
|
|
|
*
|
2002-12-12 12:26:08 +01:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
* Please read the file COPYING, README and AUTHORS for more information.
|
2001-12-12 18:18:20 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __conf_h__
|
|
|
|
#define __conf_h__
|
|
|
|
|
2010-12-27 17:14:14 +01:00
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Configuration management (header)
|
|
|
|
*/
|
|
|
|
|
2002-01-02 03:44:36 +01:00
|
|
|
#include <time.h>
|
|
|
|
|
2002-03-12 15:37:51 +01:00
|
|
|
#include "defines.h"
|
2005-07-28 18:23:55 +02:00
|
|
|
#include "array.h"
|
2005-03-19 19:43:48 +01:00
|
|
|
#include "portab.h"
|
2008-02-26 23:50:35 +01:00
|
|
|
#include "tool.h"
|
|
|
|
#include "ng_ipaddr.h"
|
2010-05-18 17:38:12 +02:00
|
|
|
#include "proc.h"
|
2008-09-13 15:10:32 +02:00
|
|
|
#include "conf-ssl.h"
|
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/**
|
|
|
|
* Configured IRC operator.
|
|
|
|
* Please note the the name of the IRC operaor and his nick have nothing to
|
|
|
|
* do with each other! The IRC operator is only identified by the name and
|
|
|
|
* password configured in this structure.
|
|
|
|
*/
|
2009-11-07 12:14:37 +01:00
|
|
|
struct Conf_Oper {
|
2010-12-27 17:25:48 +01:00
|
|
|
char name[CLIENT_PASS_LEN]; /**< Name (ID) */
|
|
|
|
char pwd[CLIENT_PASS_LEN]; /**< Password */
|
|
|
|
char *mask; /**< Allowed host mask */
|
2009-11-07 12:14:37 +01:00
|
|
|
};
|
2002-01-02 03:44:36 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/**
|
|
|
|
* Configured server.
|
|
|
|
* Peers to which this daemon should establish an outgoing server link must
|
|
|
|
* have set a port number; all other servers are allowed to connect to this one.
|
|
|
|
*/
|
2002-01-02 03:44:36 +01:00
|
|
|
typedef struct _Conf_Server
|
|
|
|
{
|
2010-12-27 17:25:48 +01:00
|
|
|
char host[HOST_LEN]; /**< Hostname */
|
|
|
|
char name[CLIENT_ID_LEN]; /**< IRC client ID */
|
|
|
|
char pwd_in[CLIENT_PASS_LEN]; /**< Password which must be received */
|
|
|
|
char pwd_out[CLIENT_PASS_LEN]; /**< Password to send to the peer */
|
|
|
|
UINT16 port; /**< Server port to connect to */
|
|
|
|
int group; /**< Group ID of this server */
|
|
|
|
time_t lasttry; /**< Time of last connection attempt */
|
|
|
|
PROC_STAT res_stat; /**< Status of the resolver */
|
|
|
|
int flags; /**< Server flags */
|
|
|
|
CONN_ID conn_id; /**< ID of server connection or NONE */
|
|
|
|
ng_ipaddr_t bind_addr; /**< Source address to use for outgoing
|
|
|
|
connections */
|
|
|
|
ng_ipaddr_t dst_addr[2]; /**< List of addresses to connect to */
|
2008-09-13 15:10:32 +02:00
|
|
|
#ifdef SSL_SUPPORT
|
2010-12-27 17:25:48 +01:00
|
|
|
bool SSLConnect; /**< Establish connection using SSL? */
|
2008-09-13 15:10:32 +02:00
|
|
|
#endif
|
2010-12-27 17:25:48 +01:00
|
|
|
char svs_mask[CLIENT_ID_LEN]; /**< Mask of nick names that should be
|
|
|
|
treated and counted as services */
|
2002-01-02 03:44:36 +01:00
|
|
|
} CONF_SERVER;
|
|
|
|
|
2008-09-13 15:10:32 +02:00
|
|
|
|
|
|
|
#ifdef SSL_SUPPORT
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Configuration options required for SSL support */
|
2008-09-13 15:10:32 +02:00
|
|
|
struct SSLOptions {
|
2010-12-27 17:25:48 +01:00
|
|
|
char *KeyFile; /**< SSL key file */
|
|
|
|
char *CertFile; /**< SSL certificate file */
|
|
|
|
char *DHFile; /**< File containing DH parameters */
|
|
|
|
array ListenPorts; /**< Array of listening SSL ports */
|
|
|
|
array KeyFilePassword; /**< Key file password */
|
2008-09-13 15:10:32 +02:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Pre-defined channels */
|
2008-11-24 22:59:10 +01:00
|
|
|
struct Conf_Channel {
|
2010-12-27 17:25:48 +01:00
|
|
|
char name[CHANNEL_NAME_LEN]; /**< Name of the channel */
|
|
|
|
char modes[CHANNEL_MODE_LEN]; /**< Initial channel modes */
|
|
|
|
char key[CLIENT_PASS_LEN]; /**< Channel key ("password", mode "k" ) */
|
|
|
|
char topic[COMMAND_LEN]; /**< Initial topic */
|
|
|
|
char keyfile[512]; /**< Path and name of channel key file */
|
|
|
|
unsigned long maxusers; /**< User limit for this channel, mode "l" */
|
2008-11-24 22:59:10 +01:00
|
|
|
};
|
2002-05-21 02:10:16 +02:00
|
|
|
|
2002-01-02 03:44:36 +01:00
|
|
|
|
2002-12-31 17:12:50 +01:00
|
|
|
#define CONF_SFLAG_ONCE 1 /* Delete this entry after next disconnect */
|
|
|
|
#define CONF_SFLAG_DISABLED 2 /* This server configuration entry is disabled */
|
|
|
|
|
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Name (ID, "nick") of this server */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
|
2002-01-02 03:44:36 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Server info text */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN];
|
2001-12-12 18:18:20 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Global server passwort */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN];
|
2002-01-03 03:27:20 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Administrative information */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN];
|
|
|
|
GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN];
|
|
|
|
GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN];
|
2002-09-16 11:13:40 +02:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Message of the day (MOTD) of this server */
|
2010-08-11 22:52:06 +02:00
|
|
|
GLOBAL array Conf_Motd;
|
2004-05-07 13:19:20 +02:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Array of ports this server should listen on */
|
2005-07-29 11:29:47 +02:00
|
|
|
GLOBAL array Conf_ListenPorts;
|
2001-12-26 23:48:53 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Address to which sockets should be bound to or empty (=all) */
|
2008-05-19 00:12:41 +02:00
|
|
|
GLOBAL char *Conf_ListenAddress;
|
2003-09-11 14:05:28 +02:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** User and group ID this daemon should run with */
|
2006-05-10 23:24:01 +02:00
|
|
|
GLOBAL uid_t Conf_UID;
|
|
|
|
GLOBAL gid_t Conf_GID;
|
2002-03-29 23:53:59 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** The directory to chroot() into */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char Conf_Chroot[FNAME_LEN];
|
2004-05-07 13:19:20 +02:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Full path and name of a file to which the PID of daemon should be written */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char Conf_PidFile[FNAME_LEN];
|
2005-02-04 15:24:20 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Timeout (in seconds) for PING commands */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL int Conf_PingTimeout;
|
2010-12-27 17:25:48 +01:00
|
|
|
|
|
|
|
/** Timeout (in seconds) for PONG replies */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL int Conf_PongTimeout;
|
2001-12-26 23:48:53 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Seconds between connection attempts to other servers */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL int Conf_ConnectRetry;
|
2001-12-26 23:48:53 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Array of configured IRC operators */
|
2009-11-07 12:14:37 +01:00
|
|
|
GLOBAL array Conf_Opers;
|
2001-12-31 03:18:51 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Array of configured IRC servers */
|
2002-01-02 03:44:36 +01:00
|
|
|
GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
|
2001-12-26 04:19:57 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Array of pre-defined channels */
|
2008-11-24 22:59:10 +01:00
|
|
|
GLOBAL array Conf_Channels;
|
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Flag indicating if only pre-defined channels are allowed (true) or not */
|
2006-11-05 14:03:46 +01:00
|
|
|
GLOBAL bool Conf_PredefChannelsOnly;
|
2002-05-21 02:10:16 +02:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Flag indicating if IRC operators are allowed to always use MODE (true) */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL bool Conf_OperCanMode;
|
2001-12-26 04:19:57 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/**
|
|
|
|
* If true, mask channel MODE commands of IRC operators to the server.
|
|
|
|
* Background: ircd2 will ignore channel MODE commands if an IRC operator
|
|
|
|
* gives chanel operator privileges to someone without being a channel operator
|
|
|
|
* himself. This enables a workaround: it masks the MODE command as coming
|
|
|
|
* from the IRC server and not the IRC operator.
|
|
|
|
*/
|
2008-04-13 16:39:08 +02:00
|
|
|
GLOBAL bool Conf_OperServerMode;
|
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Flag indicating if remote IRC operators are allowed to manage this server */
|
2008-04-13 16:39:08 +02:00
|
|
|
GLOBAL bool Conf_AllowRemoteOper;
|
|
|
|
|
2011-03-19 16:58:29 +01:00
|
|
|
/** Cloaked hostname of the clients */
|
|
|
|
GLOBAL char Conf_CloakHost[CLIENT_ID_LEN];
|
|
|
|
|
|
|
|
/** Use nick name as user name? */
|
|
|
|
GLOBAL bool Conf_CloakUserToNick;
|
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Enable all DNS functions? */
|
config: deprecate NoXX-Options
ngircd unfortunately uses several options using double-negation, e.g.
NoIdent = No, NoPam = No, etc.
This renames all options by dropping the "No" prefix, e.g.
"NoIdent = no" becomes "Ident = yes".
The old options will continue to work, but will cause a warning
message.
Also update man pages and default config.
To prevent silly
'Ident = yes' from appearing in --configtest output in the
'ident support not compiled in and Ident Option not used' case,
make default value depend on feature availability.
If feature is available, enable by default, otherwise disable.
We might consider moving these options to a new
[Feature]
section, or something like that, because none of these options are
essential.
Another possible improvement:
'Ident = yes' option in ngircd.conf causes a warning if ngircd was
built without ident support.
This does not happen with e.g. zeroconf....
2011-01-08 15:56:14 +01:00
|
|
|
GLOBAL bool Conf_DNS;
|
2007-10-25 13:01:19 +02:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Enable IDENT lookups, even when compiled with support for it */
|
config: deprecate NoXX-Options
ngircd unfortunately uses several options using double-negation, e.g.
NoIdent = No, NoPam = No, etc.
This renames all options by dropping the "No" prefix, e.g.
"NoIdent = no" becomes "Ident = yes".
The old options will continue to work, but will cause a warning
message.
Also update man pages and default config.
To prevent silly
'Ident = yes' from appearing in --configtest output in the
'ident support not compiled in and Ident Option not used' case,
make default value depend on feature availability.
If feature is available, enable by default, otherwise disable.
We might consider moving these options to a new
[Feature]
section, or something like that, because none of these options are
essential.
Another possible improvement:
'Ident = yes' option in ngircd.conf causes a warning if ngircd was
built without ident support.
This does not happen with e.g. zeroconf....
2011-01-08 15:56:14 +01:00
|
|
|
GLOBAL bool Conf_Ident;
|
2008-11-19 19:11:39 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Enable all usage of PAM, even when compiled with support for it */
|
config: deprecate NoXX-Options
ngircd unfortunately uses several options using double-negation, e.g.
NoIdent = No, NoPam = No, etc.
This renames all options by dropping the "No" prefix, e.g.
"NoIdent = no" becomes "Ident = yes".
The old options will continue to work, but will cause a warning
message.
Also update man pages and default config.
To prevent silly
'Ident = yes' from appearing in --configtest output in the
'ident support not compiled in and Ident Option not used' case,
make default value depend on feature availability.
If feature is available, enable by default, otherwise disable.
We might consider moving these options to a new
[Feature]
section, or something like that, because none of these options are
essential.
Another possible improvement:
'Ident = yes' option in ngircd.conf causes a warning if ngircd was
built without ident support.
This does not happen with e.g. zeroconf....
2011-01-08 15:56:14 +01:00
|
|
|
GLOBAL bool Conf_PAM;
|
2010-07-13 15:10:35 +02:00
|
|
|
|
2011-03-25 12:08:36 +01:00
|
|
|
/** Enable NOTICE AUTH messages on connect */
|
|
|
|
GLOBAL bool Conf_NoticeAuth;
|
|
|
|
|
2008-04-21 00:45:19 +02:00
|
|
|
/*
|
|
|
|
* try to connect to remote systems using the ipv6 protocol,
|
|
|
|
* if they have an ipv6 address? (default yes)
|
|
|
|
*/
|
|
|
|
GLOBAL bool Conf_ConnectIPv6;
|
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Try to connect to remote systems using the IPv4 protocol (true) */
|
2008-04-21 00:45:19 +02:00
|
|
|
GLOBAL bool Conf_ConnectIPv4;
|
2008-02-26 23:50:35 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Maximum number of simultaneous connections to this server */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL long Conf_MaxConnections;
|
2002-11-02 23:58:41 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Maximum number of channels a user can join */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL int Conf_MaxJoins;
|
2002-12-13 18:32:33 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Maximum number of connections per IP address */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL int Conf_MaxConnectionsIP;
|
2003-11-05 22:41:01 +01:00
|
|
|
|
2010-12-27 17:25:48 +01:00
|
|
|
/** Maximum length of a nick name */
|
2007-11-21 13:16:33 +01:00
|
|
|
GLOBAL unsigned int Conf_MaxNickLength;
|
2002-11-02 23:58:41 +01:00
|
|
|
|
2011-03-27 19:33:48 +02:00
|
|
|
#ifndef STRICT_RFC
|
|
|
|
|
|
|
|
/** Require "AUTH PING-PONG" on login */
|
|
|
|
GLOBAL bool Conf_AuthPing;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2010-09-24 17:39:11 +02:00
|
|
|
#ifdef SYSLOG
|
|
|
|
|
|
|
|
/* Syslog "facility" */
|
|
|
|
GLOBAL int Conf_SyslogFacility;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2005-11-21 17:31:30 +01:00
|
|
|
GLOBAL void Conf_Init PARAMS((void));
|
2008-03-18 21:12:47 +01:00
|
|
|
GLOBAL bool Conf_Rehash PARAMS((void));
|
2005-11-21 17:31:30 +01:00
|
|
|
GLOBAL int Conf_Test PARAMS((void));
|
2001-12-12 18:18:20 +01:00
|
|
|
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx ));
|
|
|
|
GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx ));
|
|
|
|
GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx ));
|
2002-12-30 01:01:42 +01:00
|
|
|
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL bool Conf_EnableServer PARAMS(( const char *Name, UINT16 Port ));
|
2007-06-28 07:15:12 +02:00
|
|
|
GLOBAL bool Conf_EnablePassiveServer PARAMS((const char *Name));
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL bool Conf_DisableServer PARAMS(( const char *Name ));
|
|
|
|
GLOBAL bool Conf_AddServer PARAMS(( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd ));
|
2002-12-31 17:12:50 +01:00
|
|
|
|
2009-04-12 01:09:42 +02:00
|
|
|
GLOBAL bool Conf_IsService PARAMS((int ConfServer, const char *Nick));
|
2008-08-16 02:36:30 +02:00
|
|
|
|
2010-02-11 00:01:53 +01:00
|
|
|
/* Password required by WEBIRC command */
|
|
|
|
GLOBAL char Conf_WebircPwd[CLIENT_PASS_LEN];
|
|
|
|
|
2008-04-09 19:03:24 +02:00
|
|
|
#ifdef DEBUG
|
|
|
|
GLOBAL void Conf_DebugDump PARAMS((void));
|
|
|
|
#endif
|
|
|
|
|
2001-12-12 18:18:20 +01:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
/* -eof- */
|