-/*
- * find_conf_entry
- *
- * - looks for a match on all given fields.
- */
-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])
-#ifdef USEONE
- && 0 != ircd_strcmp(bconf->passwd, "ONE")
-#endif
- && 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_local(const char* const* fields, int count)
-{
- if (count < 6 || EmptyString(fields[1]) || EmptyString(fields[5])) {
- log_write(LS_CONFIG, L_CRIT, 0, "Your M: line must have 6 fields!");
- return;
- }
- /*
- * these two can only be set the first time
- */
- if (0 == localConf.name) {
- if (string_is_hostname(fields[1]))
- DupString(localConf.name, fields[1]);
- }
- if (0 == localConf.numeric) {
- localConf.numeric = atoi(fields[5]);
- if (0 == localConf.numeric)
- log_write(LS_CONFIG, L_WARNING, 0,
- "Your M: line must have a Numeric value greater than 0");
- }
- /*
- * these two can be changed while the server is running
- */
- if (string_is_address(fields[2])) {
- if (INADDR_NONE == (localConf.vhost_address.s_addr = inet_addr(fields[2])))
- localConf.vhost_address.s_addr = INADDR_ANY;
- }
- MyFree(localConf.description);
- DupString(localConf.description, fields[3]);
- /*
- * XXX - shouldn't be setting these directly here
- */
- ircd_strncpy(me.info, fields[3], REALLEN);
- set_virtual_host(localConf.vhost_address);
-}
-
-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;
- }
-}
-