2001-12-12 18:18:20 +01:00
|
|
|
/*
|
|
|
|
* ngIRCd -- The Next Generation IRC Daemon
|
2010-02-11 00:01:53 +01:00
|
|
|
* Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
|
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"
|
|
|
|
|
2002-01-02 03:44:36 +01:00
|
|
|
|
2009-11-07 12:14:37 +01:00
|
|
|
struct Conf_Oper {
|
2005-03-19 19:43:48 +01:00
|
|
|
char name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */
|
|
|
|
char pwd[CLIENT_PASS_LEN]; /* Password */
|
2009-11-07 12:14:37 +01:00
|
|
|
char *mask; /* allowed host mask */
|
|
|
|
};
|
2002-01-02 03:44:36 +01:00
|
|
|
|
|
|
|
typedef struct _Conf_Server
|
|
|
|
{
|
2005-03-19 19:43: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 peer */
|
|
|
|
UINT16 port; /* Server port */
|
|
|
|
int group; /* Group of server */
|
2002-12-12 12:26:08 +01:00
|
|
|
time_t lasttry; /* Last connect attempt */
|
2010-05-18 17:38:12 +02:00
|
|
|
PROC_STAT res_stat; /* Status of the resolver */
|
2005-03-19 19:43:48 +01:00
|
|
|
int flags; /* Flags */
|
2002-12-30 01:01:42 +01:00
|
|
|
CONN_ID conn_id; /* ID of server connection or NONE */
|
2008-08-16 02:36:30 +02:00
|
|
|
ng_ipaddr_t bind_addr; /* source address to use for outgoing
|
|
|
|
connections */
|
2008-02-26 23:50:35 +01:00
|
|
|
ng_ipaddr_t dst_addr[2]; /* list of addresses to connect to */
|
2008-09-13 15:10:32 +02:00
|
|
|
#ifdef SSL_SUPPORT
|
|
|
|
bool SSLConnect; /* connect() using SSL? */
|
|
|
|
#endif
|
2008-08-16 02:36:30 +02:00
|
|
|
char svs_mask[CLIENT_ID_LEN]; /* Mask of nick names that are
|
|
|
|
services */
|
2002-01-02 03:44:36 +01:00
|
|
|
} CONF_SERVER;
|
|
|
|
|
2008-09-13 15:10:32 +02:00
|
|
|
|
|
|
|
#ifdef SSL_SUPPORT
|
|
|
|
struct SSLOptions {
|
|
|
|
char *KeyFile;
|
|
|
|
char *CertFile;
|
|
|
|
char *DHFile;
|
|
|
|
array ListenPorts;
|
|
|
|
array KeyFilePassword;
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-11-24 22:59:10 +01:00
|
|
|
struct Conf_Channel {
|
2005-03-19 19:43:48 +01:00
|
|
|
char name[CHANNEL_NAME_LEN]; /* Name of the channel */
|
|
|
|
char modes[CHANNEL_MODE_LEN]; /* Initial channel modes */
|
2006-12-29 15:09:48 +01:00
|
|
|
char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */
|
2008-11-24 22:59:10 +01:00
|
|
|
char topic[COMMAND_LEN]; /* Initial topic */
|
2009-01-01 22:26:13 +01:00
|
|
|
char keyfile[512]; /* Path and name of channel key file */
|
2006-12-29 15:09:48 +01:00
|
|
|
unsigned long maxusers; /* maximum usercount 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 */
|
|
|
|
|
|
|
|
|
2002-12-12 12:26:08 +01:00
|
|
|
/* Name ("Nick") of the servers */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char Conf_ServerName[CLIENT_ID_LEN];
|
2002-01-02 03:44:36 +01:00
|
|
|
|
2002-12-12 12:26:08 +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
|
|
|
|
2002-12-12 12:26:08 +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
|
|
|
|
2002-12-12 12:26:08 +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-08-11 22:52:06 +02:00
|
|
|
/* Message of the Day */
|
|
|
|
GLOBAL array Conf_Motd;
|
2004-05-07 13:19:20 +02:00
|
|
|
|
2002-12-12 12:26:08 +01:00
|
|
|
/* Ports the server should listen on */
|
2005-07-29 11:29:47 +02:00
|
|
|
GLOBAL array Conf_ListenPorts;
|
2001-12-26 23:48:53 +01:00
|
|
|
|
2003-09-11 14:05:28 +02:00
|
|
|
/* Address to which the socket should be bound or empty (=all) */
|
2008-05-19 00:12:41 +02:00
|
|
|
GLOBAL char *Conf_ListenAddress;
|
2003-09-11 14:05:28 +02:00
|
|
|
|
2002-12-12 12:26:08 +01:00
|
|
|
/* User and group ID the server 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
|
|
|
|
2004-05-07 13:19:20 +02:00
|
|
|
/* A directory to chroot() in */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char Conf_Chroot[FNAME_LEN];
|
2004-05-07 13:19:20 +02:00
|
|
|
|
2005-02-04 15:24:20 +01:00
|
|
|
/* File with PID of daemon */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL char Conf_PidFile[FNAME_LEN];
|
2005-02-04 15:24:20 +01:00
|
|
|
|
2002-12-12 12:26:08 +01:00
|
|
|
/* Timeouts for PING and PONG */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL int Conf_PingTimeout;
|
|
|
|
GLOBAL int Conf_PongTimeout;
|
2001-12-26 23:48:53 +01:00
|
|
|
|
2002-12-12 12:26:08 +01:00
|
|
|
/* Seconds between connect attempts to other servers */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL int Conf_ConnectRetry;
|
2001-12-26 23:48:53 +01:00
|
|
|
|
2002-12-12 12:26:08 +01:00
|
|
|
/* Operators */
|
2009-11-07 12:14:37 +01:00
|
|
|
GLOBAL array Conf_Opers;
|
2001-12-31 03:18:51 +01:00
|
|
|
|
2002-12-12 12:26:08 +01:00
|
|
|
/* Servers */
|
2002-01-02 03:44:36 +01:00
|
|
|
GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS];
|
2001-12-26 04:19:57 +01:00
|
|
|
|
2002-12-12 12:26:08 +01:00
|
|
|
/* Pre-defined channels */
|
2008-11-24 22:59:10 +01:00
|
|
|
GLOBAL array Conf_Channels;
|
|
|
|
|
2006-11-05 14:03:46 +01:00
|
|
|
/* Pre-defined channels only */
|
|
|
|
GLOBAL bool Conf_PredefChannelsOnly;
|
2002-05-21 02:10:16 +02:00
|
|
|
|
2002-12-12 12:26:08 +01:00
|
|
|
/* Are IRC operators allowed to always use MODE? */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL bool Conf_OperCanMode;
|
2001-12-26 04:19:57 +01:00
|
|
|
|
2008-04-13 16:39:08 +02:00
|
|
|
/* 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 */
|
|
|
|
GLOBAL bool Conf_OperServerMode;
|
|
|
|
|
|
|
|
/* Are remote IRC operators allowed to manage this server? */
|
|
|
|
GLOBAL bool Conf_AllowRemoteOper;
|
|
|
|
|
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
|
|
|
/* Enable all DNS functions? */
|
|
|
|
GLOBAL bool Conf_DNS;
|
2007-10-25 13:01:19 +02:00
|
|
|
|
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
|
|
|
/* Enable IDENT lookups, even when compiled with support for it */
|
|
|
|
GLOBAL bool Conf_Ident;
|
2008-11-19 19:11:39 +01:00
|
|
|
|
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
|
|
|
/* Enable all usage of PAM, even when compiled with support for it */
|
|
|
|
GLOBAL bool Conf_PAM;
|
2010-07-13 15:10:35 +02:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
/* same as above, but for ipv4 hosts, default: yes */
|
|
|
|
GLOBAL bool Conf_ConnectIPv4;
|
2008-02-26 23:50:35 +01:00
|
|
|
|
2002-12-12 12:26:08 +01:00
|
|
|
/* Maximum number of connections to this server */
|
2005-03-19 19:43:48 +01:00
|
|
|
GLOBAL long Conf_MaxConnections;
|
2002-11-02 23:58:41 +01:00
|
|
|
|
2002-12-13 18:32:33 +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
|
|
|
|
2003-11-05 22:41:01 +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
|
|
|
|
2007-11-21 13:16:33 +01:00
|
|
|
/* Maximum length of a nick name */
|
|
|
|
GLOBAL unsigned int Conf_MaxNickLength;
|
2002-11-02 23:58:41 +01:00
|
|
|
|
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- */
|