struct Client;
struct SLink;
-struct TRecord;
struct Message;
-
/*
* General defines
*/
* Macros
*/
-#define CONF_ILLEGAL 0x80000000
-#define CONF_MATCH 0x40000000
-#define CONF_CLIENT 0x0002
-#define CONF_SERVER 0x0004
-#define CONF_OPERATOR 0x0020
-#define CONF_LEAF 0x1000
-#define CONF_HUB 0x4000
-#define CONF_UWORLD 0x8000
+#define CONF_ILLEGAL 0x80000000 /**< Delete the ConfItem when no remaining clients. */
+#define CONF_CLIENT 0x0002 /**< ConfItem describes a Client block */
+#define CONF_SERVER 0x0004 /**< ConfItem describes a Connect block */
+#define CONF_OPERATOR 0x0020 /**< ConfItem describes an Operator block */
+#define CONF_LEAF 0x1000 /**< ConfItem describes a Server leaf */
+#define CONF_HUB 0x4000 /**< ConfItem describes a Server hub */
+#define CONF_UWORLD 0x8000 /**< ConfItem describes a Uworld server */
+/** Indicates ConfItem types that count associated clients. */
#define CONF_CLIENT_MASK (CONF_CLIENT | CONF_OPERATOR | CONF_SERVER)
+/** Checks whether the CONF_ILLEGAL bit is set on \a x. */
#define IsIllegal(x) ((x)->status & CONF_ILLEGAL)
/*
* Structures
*/
+/** Configuration item to limit peer or client access. */
struct ConfItem
{
- struct ConfItem *next;
- unsigned int status; /* If CONF_ILLEGAL, delete when no clients */
- unsigned int clients; /* Number of *LOCAL* clients using this */
- struct ConnectionClass *conn_class; /* Class of connection */
- struct irc_sockaddr origin; /* local address */
- struct irc_sockaddr address; /* ip and port */
- char *host;
- char *origin_name;
- char *passwd;
- char *name;
- time_t hold; /* Hold until this time (calendar time) */
- int dns_pending; /* a dns request is pending */
- unsigned char bits; /* Number of bits for ipkills. */
- struct Privs privs; /* Priviledges for opers. */
- /* Used to detect if a privilege has been touched. */
+ struct ConfItem *next; /**< Next ConfItem in #GlobalConfList */
+ unsigned int status; /**< Set of CONF_* bits. */
+ unsigned int clients; /**< Number of *LOCAL* clients using this */
+ struct ConnectionClass *conn_class; /**< Class of connection */
+ struct irc_sockaddr origin; /**< local address for outbound connections */
+ struct irc_sockaddr address; /**< ip and port */
+ char *host; /**< peer hostname */
+ char *origin_name; /**< text form of origin address */
+ char *passwd; /**< password field */
+ char *name; /**< name of peer */
+ time_t hold; /**< Earliest time to attempt an outbound connect on this ConfItem. */
+ int dns_pending; /**< a dns request is pending */
+ unsigned char bits; /**< Number of bits for ipkills. */
+ struct Privs privs; /**< Priviledges for opers. */
+ /** Used to detect if a privilege has been set by this ConfItem. */
struct Privs privs_dirty;
};
-struct ServerConf {
- struct ServerConf* next;
- char* hostname;
- char* passwd;
- char* alias;
- struct irc_in_addr address;
- int dns_pending;
- int connected;
- time_t hold;
- struct ConnectionClass* conn_class;
-};
-
+/** Channel quarantine structure. */
struct qline
{
- struct qline *next;
- char *chname;
- char *reason;
+ struct qline *next; /**< Next qline in #GlobalQuarantineList. */
+ char *chname; /**< Quarantined channel name. */
+ char *reason; /**< Reason for quarantine. */
};
+/** Local K-line structure. */
struct DenyConf {
- struct DenyConf* next;
- char* hostmask;
- char* message;
- char* usermask;
- struct irc_in_addr address;
- unsigned int flags;
- unsigned char bits; /* Number of bits for ipkills */
+ struct DenyConf* next; /**< Next DenyConf in #denyConfList. */
+ char* hostmask; /**< Mask for realname, IP or hostname. */
+ char* message; /**< Message to send to denied users. */
+ char* usermask; /**< Mask for client's username. */
+ struct irc_in_addr address; /**< Address for IP-based denies. */
+ unsigned int flags; /**< Interpretation flags for the above. */
+ unsigned char bits; /**< Number of bits for ipkills */
};
-#define DENY_FLAGS_FILE 0x0001 /* Comment is a filename */
-#define DENY_FLAGS_IP 0x0002 /* K-line by IP address */
-#define DENY_FLAGS_REALNAME 0x0004 /* K-line by real name */
+#define DENY_FLAGS_FILE 0x0001 /**< Comment is a filename */
+#define DENY_FLAGS_IP 0x0002 /**< K-line by IP address */
+#define DENY_FLAGS_REALNAME 0x0004 /**< K-line by real name */
-/*
- * A line: A:<line 1>:<line 2>:<line 3>
- */
+/** Local server configuration. */
struct LocalConf {
- char* name;
- char* description;
- unsigned int numeric;
- char* location1;
- char* location2;
- char* contact;
-};
-
-struct MotdItem {
- char line[82];
- struct MotdItem *next;
-};
-
-struct MotdConf {
- struct MotdConf* next;
- char* hostmask;
- char* path;
+ char* name; /**< Name of server. */
+ char* description; /**< Description of server. */
+ unsigned int numeric; /**< Globally assigned server numnick. */
+ char* location1; /**< First line of location information. */
+ char* location2; /**< Second line of location information. */
+ char* contact; /**< Admin contact information. */
};
enum {
- CRULE_AUTO = 1,
- CRULE_ALL = 2,
+ CRULE_AUTO = 1, /**< CRule applies to automatic connections. */
+ CRULE_ALL = 2, /**< CRule applies to oper-requested connections. */
CRULE_MASK = 3
};
-struct CRuleNode;
-
+/** Connection rule configuration. */
struct CRuleConf {
- struct CRuleConf* next;
- char* hostmask;
- char* rule;
- int type;
- struct CRuleNode* node;
-};
-
-struct TRecord {
- struct TRecord *next;
- char *hostmask;
- struct MotdItem *tmotd;
- struct tm tmotd_tm;
+ struct CRuleConf* next; /**< Next CRule in cruleConfList. */
+ char* hostmask; /**< Mask of affected server names. */
+ char* rule; /**< Text version of the rule. */
+ int type; /**< One of CRULE_AUTO or CRULE_ALL. */
+ struct CRuleNode* node; /**< Parsed form of the rule. */
};
+/** Authorization check result. */
enum AuthorizationCheckResult {
- ACR_OK,
- ACR_NO_AUTHORIZATION,
- ACR_TOO_MANY_IN_CLASS,
- ACR_TOO_MANY_FROM_IP,
- ACR_ALREADY_AUTHORIZED,
- ACR_BAD_SOCKET
+ ACR_OK, /**< User accepted. */
+ ACR_NO_AUTHORIZATION, /**< No matching ConfItem for the user. */
+ ACR_TOO_MANY_IN_CLASS, /**< Connection class was already full. */
+ ACR_TOO_MANY_FROM_IP, /**< User's IP already has max connections. */
+ ACR_ALREADY_AUTHORIZED, /**< User already had an attached ConfItem. */
+ ACR_BAD_SOCKET /**< Client has bad file descriptor. */
};
+/** Target description for service commands. */
struct nick_host {
- struct nick_host *next;
- int nicklen; /* offset of @ part of server string */
- char nick[1]; /* start of nick@server string */
+ struct nick_host *next; /**< Next nick_host struct in struct s_map. */
+ int nicklen; /**< offset of @ part of server string */
+ char nick[1]; /**< start of nick@server string */
};
+/** Target set for a service pseudo-command. */
struct s_map {
- struct s_map *next;
- struct Message *msg;
- char *name;
- char *command;
- char *prepend;
- struct nick_host *services;
+ struct s_map *next; /**< Next element in #GlobalServiceMapList. */
+ struct Message *msg; /**< Message element formed for this mapping. */
+ char *name; /**< Text name of the mapping. */
+ char *command; /**< Command name to use. */
+ char *prepend; /**< Extra text to prepend to user's text. */
+ struct nick_host *services; /**< Linked list of possible targets. */
};
*/
extern struct ConfItem* GlobalConfList;
extern int GlobalConfCount;
-extern struct tm motd_tm;
-extern struct MotdItem* motd;
-extern struct MotdItem* rmotd;
-extern struct TRecord* tdata;
extern struct s_map* GlobalServiceMapList;
extern struct qline* GlobalQuarantineList;
extern int init_conf(void);
extern const struct LocalConf* conf_get_local(void);
-extern const struct MotdConf* conf_get_motd_list(void);
extern const struct CRuleConf* conf_get_crule_list(void);
extern const struct DenyConf* conf_get_deny_list(void);
extern void read_tlines(void);
extern int find_kill(struct Client *cptr);
extern int find_restrict(struct Client *cptr);
-extern struct MotdItem* read_motd(const char* motdfile);
extern const char *find_quarantine(const char* chname);
extern void lookup_confhost(struct ConfItem *aconf);
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
+ */
+/** @file
+ * @brief ircd configuration file driver
+ * @version $Id$
*/
#include "config.h"
#include <sys/stat.h>
#include <unistd.h>
-struct ConfItem *GlobalConfList = 0;
-int GlobalConfCount = 0;
-struct s_map *GlobalServiceMapList = 0;
-struct qline *GlobalQuarantineList = 0;
+/** Global list of all ConfItem structures. */
+struct ConfItem *GlobalConfList;
+/** Count of items in #GlobalConfLis. */
+int GlobalConfCount;
+/** Global list of service mappings. */
+struct s_map *GlobalServiceMapList;
+/** Global list of channel quarantines. */
+struct qline *GlobalQuarantineList;
-void yyparse(void);
-int conf_fd, lineno;
+/** Current line number in scanner input. */
+int lineno;
+/** Configuration information for #me. */
struct LocalConf localConf;
+/** Global list of connection rules. */
struct CRuleConf* cruleConfList;
-/* struct ServerConf* serverConfList; */
+/** Global list of K-lines. */
struct DenyConf* denyConfList;
-/*
- * output the reason for being k lined from a file - Mmmm
- * sptr is client being dumped
- * filename is the file that is to be output to the K lined client
+/** Tell a user that they are banned, dumping the message from a file.
+ * @param sptr Client being rejected
+ * @param filename Send this file's contents to \a sptr
*/
static void killcomment(struct Client* sptr, const char* filename)
{
fbclose(file);
}
+/** Allocate a new struct ConfItem.
+ * @return Newly allocated structure.
+ */
struct ConfItem* make_conf(void)
{
struct ConfItem* aconf;
return aconf;
}
-void delist_conf(struct ConfItem *aconf)
-{
- if (aconf == GlobalConfList)
- GlobalConfList = GlobalConfList->next;
- else {
- struct ConfItem *bconf;
-
- for (bconf = GlobalConfList; aconf != bconf->next; bconf = bconf->next)
- ;
- bconf->next = aconf->next;
- }
- aconf->next = 0;
-}
-
+/** Free a struct ConfItem and any resources it owns.
+ * @param aconf Item to free.
+ */
void free_conf(struct ConfItem *aconf)
{
Debug((DEBUG_DEBUG, "free_conf: %s %s %d",
#endif
}
-/*
- * detach_conf - Disassociate configuration from the client.
+/** Disassociate configuration from the client.
+ * @param cptr Client to operate on.
+ * @param aconf ConfItem to detach.
*/
static void detach_conf(struct Client* cptr, struct ConfItem* aconf)
{
}
}
-/*
- * conf_dns_callback - called when resolver query finishes
- * if the query resulted in a successful search, hp will contain
- * a non-null pointer, otherwise hp will be null.
- * if successful save hp in the conf item it was called with
+/** Copies a completed DNS query into its ConfItem.
+ * @param vptr Pointer to struct ConfItem for the block.
+ * @param hp DNS reply, or NULL if the lookup failed.
*/
static void conf_dns_callback(void* vptr, struct DNSReply* hp)
{
}
}
-/*
- * conf_dns_lookup - do a nameserver lookup of the conf host
- * if the conf entry is currently doing a ns lookup do nothing, otherwise
- * if the lookup returns a null pointer, set the conf dns_pending flag
+/** Start a nameserver lookup of the conf host. If the conf entry is
+ * currently doing a lookup, do nothing.
+ * @param aconf ConfItem for which to start a request.
*/
static void conf_dns_lookup(struct ConfItem* aconf)
{
}
-/*
- * lookup_confhost
- *
- * Do (start) DNS lookups of all hostnames in the conf line and convert
- * an IP addresses in a.b.c.d number for to IP#s.
+/** Start lookups of all addresses in the conf line. The origin must
+ * be a numeric IP address. If the remote host field is not an IP
+ * address, start a DNS lookup for it.
+ * @param aconf Connection to do lookups for.
*/
void
lookup_confhost(struct ConfItem *aconf)
conf_dns_lookup(aconf);
}
-/*
- * conf_find_server - find a server by name or hostname
- * returns a server conf item pointer if found, 0 otherwise
- *
- * NOTE: at some point when we don't have to scan the entire
- * list it may be cheaper to look for server names and host
- * names in separate loops (original code did it that way)
+/** Find a server by name or hostname.
+ * @param name Server name to find.
+ * @return Pointer to the corresponding ConfItem, or NULL if none exists.
*/
struct ConfItem* conf_find_server(const char* name)
{
return 0;
}
-/*
- * conf_eval_crule - evaluate connection rules
- * returns the name of the rule triggered if found, 0 otherwise
- *
- * Evaluate connection rules... If no rules found, allow the
- * connect. Otherwise stop with the first true rule (ie: rules
- * are ored together. Oper connects are effected only by D
- * lines (CRULE_ALL) not d lines (CRULE_AUTO).
+/** Evaluate connection rules.
+ * @param name Name of server to check
+ * @param mask Filter for CRule types (only consider if type & \a mask != 0).
+ * @return Name of rule that forbids the connection; NULL if no prohibitions.
*/
const char* conf_eval_crule(const char* name, int mask)
{
return 0;
}
-/*
- * Remove all conf entries from the client except those which match
+/** Remove all conf entries from the client except those which match
* the status field mask.
+ * @param cptr Client to operate on.
+ * @param mask ConfItem types to keep.
*/
void det_confs_butmask(struct Client* cptr, int mask)
{
}
}
-/*
- * check_limit_and_attach - check client limits and attach I:line
- *
- * Made it accept 1 charactor, and 2 charactor limits (0->99 now),
- * and dislallow more than 255 people here as well as in ipcheck.
- * removed the old "ONE" scheme too.
- * -- Isomer 2000-06-22
+/** Check client limits and attach Client block.
+ * If the password field consists of one or two digits, use that
+ * as the per-IP connection limit; otherwise use 255.
+ * @param cptr Client getting \a aconf.
+ * @param aconf Configuration item to attach.
+ * @return Authorization check result.
*/
static enum AuthorizationCheckResult
check_limit_and_attach(struct Client* cptr, struct ConfItem* aconf)
return attach_conf(cptr, aconf);
}
-/*
- * Find the first (best) I line to attach.
+/** Find the first (best) Client block to attach.
+ * @param cptr Client for whom to check rules.
+ * @return Authorization check result.
*/
enum AuthorizationCheckResult attach_iline(struct Client* cptr)
{
struct ConfItem* aconf;
static char uhost[HOSTLEN + USERLEN + 3];
static char fullname[HOSTLEN + 1];
- struct DNSReply* hp = 0;
+ struct DNSReply* hp;
assert(0 != cptr);
- if (cli_dns_reply(cptr))
- hp = cli_dns_reply(cptr);
-
+ hp = cli_dns_reply(cptr);
for (aconf = GlobalConfList; aconf; aconf = aconf->next) {
if (aconf->status != CONF_CLIENT)
continue;
return ACR_NO_AUTHORIZATION;
}
+/** Check whether a particular ConfItem is already attached to a
+ * Client.
+ * @param aconf ConfItem to search for
+ * @param cptr Client to check
+ * @return Non-zero if \a aconf is attached to \a cptr, zero if not.
+ */
static int is_attached(struct ConfItem *aconf, struct Client *cptr)
{
struct SLink *lp;
return 0;
}
-/*
- * attach_conf
- *
- * Associate a specific configuration entry to a *local*
- * client (this is the one which used in accepting the
- * connection). Note, that this automaticly changes the
- * attachment if there was an old one...
+/** Associate a specific configuration entry to a *local* client (this
+ * is the one which used in accepting the connection). Note, that this
+ * automaticly changes the attachment if there was an old one...
+ * @param cptr Client to attach \a aconf to
+ * @param aconf ConfItem to attach
+ * @return Authorization check result.
*/
enum AuthorizationCheckResult attach_conf(struct Client *cptr, struct ConfItem *aconf)
{
return ACR_OK;
}
+/** Return our LocalConf configuration structure.
+ * @return A pointer to #localConf.
+ */
const struct LocalConf* conf_get_local(void)
{
return &localConf;
}
-/*
- * attach_confs_byname
- *
- * Attach a CONF line to a client if the name passed matches that for
- * the conf file (for non-C/N lines) or is an exact match (C/N lines
- * only). The difference in behaviour is to stop C:*::* and N:*::*.
+/** Attach ConfItems to a client if the name passed matches that for
+ * the ConfItems or is an exact match for them.
+ * @param cptr Client getting the ConfItem attachments.
+ * @param name Filter to match ConfItem::name.
+ * @param statmask Filter to limit ConfItem::status.
+ * @return First ConfItem attached to \a cptr.
*/
struct ConfItem* attach_confs_byname(struct Client* cptr, const char* name,
int statmask)
return first;
}
-/*
- * Added for new access check meLazy
+/** Attach ConfItems to a client if the host passed matches that for
+ * the ConfItems or is an exact match for them.
+ * @param cptr Client getting the ConfItem attachments.
+ * @param host Filter to match ConfItem::host.
+ * @param statmask Filter to limit ConfItem::status.
+ * @return First ConfItem attached to \a cptr.
*/
struct ConfItem* attach_confs_byhost(struct Client* cptr, const char* host,
int statmask)
return first;
}
-/*
- * find a conf entry which matches the hostname and has the same name.
+/** Find a ConfItem that has the same name and user+host fields as
+ * specified. Requires an exact match for \a name.
+ * @param name Name to match
+ * @param user User part of match (or NULL)
+ * @param host Hostname part of match
+ * @param statmask Filter for ConfItem::status
+ * @return First found matching ConfItem.
*/
struct ConfItem* find_conf_exact(const char* name, const char* user,
const char* host, int statmask)
return 0;
}
+/** Find a ConfItem from a list that has a name that matches \a name.
+ * @param lp List to search in.
+ * @param name Filter for ConfItem::name field; matches either exactly
+ * or as a glob.
+ * @param statmask Filter for ConfItem::status.
+ * @return First matching ConfItem from \a lp.
+ */
struct ConfItem* find_conf_byname(struct SLink* lp, const char* name,
int statmask)
{
return 0;
}
-/*
- * Added for new access check meLazy
+/** Find a ConfItem from a list that has a host that matches \a host.
+ * @param lp List to search in.
+ * @param host Filter for ConfItem::host field; matches as a glob.
+ * @param statmask Filter for ConfItem::status.
+ * @return First matching ConfItem from \a lp.
*/
struct ConfItem* find_conf_byhost(struct SLink* lp, const char* host,
int statmask)
return 0;
}
-/*
- * find_conf_ip
- *
- * Find a conf line using the IP# stored in it to search upon.
- * Added 1/8/92 by Avalon.
+/** Find a ConfItem from a list that has an address equal to \a ip.
+ * @param lp List to search in.
+ * @param ip Filter for ConfItem::address field; matches exactly.
+ * @param statmask Filter for ConfItem::status.
+ * @return First matching ConfItem from \a lp.
*/
struct ConfItem* find_conf_byip(struct SLink* lp, const struct irc_in_addr* ip,
int statmask)
return 0;
}
-/*
- * find_conf_entry
- *
- * - looks for a match on all given fields.
- */
-#if 0
-static struct ConfItem *find_conf_entry(struct ConfItem *aconf,
- unsigned int mask)
-{
- struct ConfItem *bconf;
- assert(0 != aconf);
-
- mask &= ~CONF_ILLEGAL;
-
- for (bconf = GlobalConfList; bconf; bconf = bconf->next) {
- if (!(bconf->status & mask) || (bconf->port != aconf->port))
- continue;
-
- if ((EmptyString(bconf->host) && !EmptyString(aconf->host)) ||
- (EmptyString(aconf->host) && !EmptyString(bconf->host)))
- continue;
- if (!EmptyString(bconf->host) && 0 != ircd_strcmp(bconf->host, aconf->host))
- continue;
-
- if ((EmptyString(bconf->passwd) && !EmptyString(aconf->passwd)) ||
- (EmptyString(aconf->passwd) && !EmptyString(bconf->passwd)))
- continue;
- if (!EmptyString(bconf->passwd) && (!IsDigit(*bconf->passwd) || bconf->passwd[1])
- && 0 != ircd_strcmp(bconf->passwd, aconf->passwd))
- continue;
-
- if ((EmptyString(bconf->name) && !EmptyString(aconf->name)) ||
- (EmptyString(aconf->name) && !EmptyString(bconf->name)))
- continue;
- if (!EmptyString(bconf->name) && 0 != ircd_strcmp(bconf->name, aconf->name))
- continue;
- break;
- }
- return bconf;
-}
-
-/*
- * If conf line is a class definition, create a class entry
- * for it and make the conf_line illegal and delete it.
- */
-void conf_add_class(const char* const* fields, int count)
-{
- if (count < 6)
- return;
- add_class(atoi(fields[1]), atoi(fields[2]), atoi(fields[3]),
- atoi(fields[4]), atoi(fields[5]));
-}
-
-void conf_add_listener(const char* const* fields, int count)
-{
- int is_server = 0;
- int is_hidden = 0;
-
- /*
- * need a port
- */
- if (count < 5 || EmptyString(fields[4]))
- return;
-
- if (!EmptyString(fields[3])) {
- const char* x = fields[3];
- if ('S' == ToUpper(*x))
- is_server = 1;
- ++x;
- if ('H' == ToUpper(*x))
- is_hidden = 1;
- }
- /* port vhost mask */
- add_listener(atoi(fields[4]), fields[2], fields[1], is_server, is_hidden);
-}
-
-void conf_add_admin(const char* const* fields, int count)
-{
- /*
- * if you have one, it MUST have 3 lines
- */
- if (count < 4) {
- log_write(LS_CONFIG, L_CRIT, 0, "Your A: line must have 4 fields!");
- return;
- }
- MyFree(localConf.location1);
- DupString(localConf.location1, fields[1]);
-
- MyFree(localConf.location2);
- DupString(localConf.location2, fields[2]);
-
- MyFree(localConf.contact);
- DupString(localConf.contact, fields[3]);
-}
-
-/*
- * conf_add_crule - Create expression tree from connect rule and add it
- * to the crule list
- */
-void conf_add_crule(const char* const* fields, int count, int type)
-{
- struct CRuleNode* node;
- assert(0 != fields);
-
- if (count < 4 || EmptyString(fields[1]) || EmptyString(fields[3]))
- return;
-
- if ((node = crule_parse(fields[3]))) {
- struct CRuleConf* p = (struct CRuleConf*) MyMalloc(sizeof(struct CRuleConf));
- assert(0 != p);
-
- DupString(p->hostmask, fields[1]);
- collapse(p->hostmask);
-
- DupString(p->rule, fields[3]);
-
- p->type = type;
- p->node = node;
- p->next = cruleConfList;
- cruleConfList = p;
- }
-}
-#endif
-
+/** Free all CRules from #cruleConfList. */
void conf_erase_crule_list(void)
{
struct CRuleConf* next;
cruleConfList = 0;
}
+/** Return #cruleConfList.
+ * @return #cruleConfList
+ */
const struct CRuleConf* conf_get_crule_list(void)
{
return cruleConfList;
}
+/** Free all deny rules from #denyConfList. */
void conf_erase_deny_list(void)
{
struct DenyConf* next;
denyConfList = 0;
}
+/** Return #denyConfList.
+ * @return #denyConfList
+ */
const struct DenyConf* conf_get_deny_list(void)
{
return denyConfList;
}
+/** Find any existing quarantine for the named channel.
+ * @param chname Channel name to search for.
+ * @return Reason for channel's quarantine, or NULL if none exists.
+ */
const char*
find_quarantine(const char *chname)
{
return NULL;
}
+/** Free all qline structs from #GlobalQuarantineList. */
void clear_quarantines(void)
{
struct qline *qline;
}
}
-
-/*
- * read_configuration_file
- *
- * Read configuration file.
- *
- * returns 0, if file cannot be opened
- * 1, if file read
- */
-
-#define MAXCONFLINKS 150
-
+/** When non-zero, indicates that a configuration error has been seen in this pass. */
static int conf_error;
+/** When non-zero, indicates that the configuration file was loaded at least once. */
static int conf_already_read;
extern FILE *yyin;
-void init_lexer(void);
+extern void yyparse(void);
+extern void init_lexer(void);
+/** Read configuration file.
+ * @return Zero on failure, non-zero on success. */
int read_configuration_file(void)
{
conf_error = 0;
return 1;
}
+/** Report an error message about the configuration file.
+ * @param msg The error to report.
+ */
void
yyerror(const char *msg)
{
conf_error = 1;
}
-/*
- * rehash
- *
- * Actual REHASH service routine. Called with sig == 0 if it has been called
- * as a result of an operator issuing this command, else assume it has been
- * called as a result of the server receiving a HUP signal.
+/** Reload the configuration file.
+ * @param cptr Client that requested rehash (if a signal, &me).
+ * @param sig Type of rehash (0 = oper-requested, 1 = signal, 2 =
+ * oper-requested but do not restart resolver)
+ * @return CPTR_KILLED if any client was K/G-lined because of the
+ * rehash; otherwise 0.
*/
int rehash(struct Client *cptr, int sig)
{
return ret;
}
-/*
- * init_conf
- *
- * Read configuration file.
- *
- * returns 0, if file cannot be opened
- * 1, if file read
+/** Read configuration file for the very first time.
+ * @return Non-zero on success, zero on failure.
*/
int init_conf(void)
return 0;
}
-/*
- * find_kill
- * input:
- * client pointer
- * returns:
- * 0: Client may continue to try and connect
- * -1: Client was K/k:'d - sideeffect: reason was sent.
- * -2: Client was G/g:'d - sideeffect: reason was sent.
- * sideeffects:
- * Client may have been sent a reason why they are denied, as above.
+/** Searches for a K/G-line for a client. If one is found, notify the
+ * user and disconnect them.
+ * @param cptr Client to search for.
+ * @return 0 if client is accepted; -1 if client was locally denied
+ * (K-line); -2 if client was globally denied (G-line).
*/
int find_kill(struct Client *cptr)
{
return -1;
if (agline)
return -2;
-
+
return 0;
}
-/*
- * Ordinary client access check. Look for conf lines which have the same
- * status as the flags passed.
+/** Attempt to attach Client blocks to \a cptr. If attach_iline()
+ * fails for the client, emit a debugging message.
+ * @param cptr Client to check for access.
+ * @return Access check result.
*/
enum AuthorizationCheckResult conf_check_client(struct Client *cptr)
{
return ACR_OK;
}
-/*
- * check_server()
- *
- * Check access for a server given its name (passed in cptr struct).
+/** Check access for a server given its name (passed in cptr struct).
* Must check for all C/N lines which have a name which matches the
* name given and a host which matches. A host alias which is the
* same as the server name is also acceptable in the host field of a
* C/N line.
- *
- * Returns
- * 0 = Success
- * -1 = Access denied
- * -2 = Bad socket.
+ * @param cptr Peer server to check.
+ * @return 0 if accepted, -1 if access denied.
*/
int conf_check_server(struct Client *cptr)
{