static rb_dlink_list yy_aconf_list;
static rb_dlink_list yy_oper_list;
-static rb_dlink_list yy_shared_list;
static rb_dlink_list yy_cluster_list;
static struct oper_conf *yy_oper = NULL;
static struct mode_table connect_table[] = {
{ "autoconn", SERVER_AUTOCONN },
- { "compressed", SERVER_COMPRESSED },
+ { "compressed", 0 },
{ "encrypted", SERVER_ENCRYPTED },
{ "topicburst", SERVER_TB },
{ "sctp", SERVER_SCTP },
{ "all", CLUSTER_ALL },
{NULL, 0}
};
-
-static struct mode_table shared_table[] =
-{
- { "kline", SHARED_PKLINE|SHARED_TKLINE },
- { "xline", SHARED_PXLINE|SHARED_TXLINE },
- { "resv", SHARED_PRESV|SHARED_TRESV },
- { "dline", SHARED_PDLINE|SHARED_TDLINE },
- { "tdline", SHARED_TDLINE },
- { "pdline", SHARED_PDLINE },
- { "undline", SHARED_UNDLINE },
- { "tkline", SHARED_TKLINE },
- { "unkline", SHARED_UNKLINE },
- { "txline", SHARED_TXLINE },
- { "unxline", SHARED_UNXLINE },
- { "tresv", SHARED_TRESV },
- { "unresv", SHARED_UNRESV },
- { "locops", SHARED_LOCOPS },
- { "rehash", SHARED_REHASH },
- { "grant", SHARED_GRANT },
- { "die", SHARED_DIE },
- { "module", SHARED_MODULE },
- { "all", SHARED_ALL },
- { "none", 0 },
- {NULL, 0}
-};
/* *INDENT-ON* */
static int
}
}
+static void
+parse_umodes(const char *pm, int *values, int *mask)
+{
+ int what = MODE_ADD, flag;
+
+ *values = 0;
+
+ if (NULL != mask)
+ *mask = 0;
+
+ for (; *pm; pm++)
+ {
+ switch (*pm)
+ {
+ case '+':
+ what = MODE_ADD;
+ break;
+ case '-':
+ what = MODE_DEL;
+ break;
+
+ /* don't allow +o */
+ case 'o':
+ case 'S':
+ case 'Z':
+ case ' ':
+ break;
+
+ default:
+ flag = user_modes[(unsigned char) *pm];
+ if (flag)
+ {
+ /* Proper value has probably not yet been set
+ * so don't check oper_only_umodes -- jilles */
+ if (what == MODE_ADD)
+ *values |= flag;
+ else
+ *values &= ~flag;
+
+ if (NULL != mask)
+ *mask |= flag;
+ }
+ break;
+ }
+ }
+}
+
static void
conf_set_privset_extends(void *data)
{
if(EmptyString(yy_class->class_name))
{
- conf_report_error("Ignoring connect block -- missing name.");
+ conf_report_error("Ignoring class block -- missing name.");
return 0;
}
yy_aconf->className = rb_strdup(data);
}
-/* ok, shared_oper handles the stacking, shared_flags handles adding
- * things.. so all we need to do when we start and end a shared block, is
- * clean up anything thats been left over.
- */
-static int
-conf_cleanup_shared(struct TopConf *tc)
-{
- rb_dlink_node *ptr, *next_ptr;
-
- RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_shared_list.head)
- {
- free_remote_conf(ptr->data);
- rb_dlinkDestroy(ptr, &yy_shared_list);
- }
-
- if(yy_shared != NULL)
- {
- free_remote_conf(yy_shared);
- yy_shared = NULL;
- }
-
- return 0;
-}
-
-static void
-conf_set_shared_oper(void *data)
-{
- conf_parm_t *args = data;
- const char *username;
- char *p;
-
- if(yy_shared != NULL)
- free_remote_conf(yy_shared);
-
- yy_shared = make_remote_conf();
-
- if(args->next != NULL)
- {
- if(CF_TYPE(args->type) != CF_QSTRING)
- {
- conf_report_error("Ignoring shared::oper -- server is not a qstring");
- return;
- }
-
- yy_shared->server = rb_strdup(args->v.string);
- args = args->next;
- }
- else
- yy_shared->server = rb_strdup("*");
-
- if(CF_TYPE(args->type) != CF_QSTRING)
- {
- conf_report_error("Ignoring shared::oper -- oper is not a qstring");
- return;
- }
-
- if((p = strchr(args->v.string, '@')) == NULL)
- {
- conf_report_error("Ignoring shard::oper -- oper is not a user@host");
- return;
- }
-
- username = args->v.string;
- *p++ = '\0';
-
- if(EmptyString(p))
- yy_shared->host = rb_strdup("*");
- else
- yy_shared->host = rb_strdup(p);
-
- if(EmptyString(username))
- yy_shared->username = rb_strdup("*");
- else
- yy_shared->username = rb_strdup(username);
-
- rb_dlinkAddAlloc(yy_shared, &yy_shared_list);
- yy_shared = NULL;
-}
-
static void
-conf_set_shared_flags(void *data)
+conf_set_auth_umodes(void *data)
{
- conf_parm_t *args = data;
- int flags = 0;
- rb_dlink_node *ptr, *next_ptr;
-
- if(yy_shared != NULL)
- free_remote_conf(yy_shared);
+ char *umodes = data;
- set_modes_from_table(&flags, "flag", shared_table, args);
-
- RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_shared_list.head)
- {
- yy_shared = ptr->data;
-
- yy_shared->flags = flags;
- rb_dlinkDestroy(ptr, &yy_shared_list);
- rb_dlinkAddTail(yy_shared, &yy_shared->node, &shared_conf_list);
- }
-
- yy_shared = NULL;
+ parse_umodes(umodes, &yy_aconf->umodes, &yy_aconf->umodes_mask);
}
static int
static int
conf_end_connect(struct TopConf *tc)
{
- if(EmptyString(yy_server->name))
+ if (EmptyString(yy_server->name))
{
conf_report_error("Ignoring connect block -- missing name.");
return 0;
}
- if(ServerInfo.name != NULL && !irccmp(ServerInfo.name, yy_server->name))
+ if (ServerInfo.name != NULL && !irccmp(ServerInfo.name, yy_server->name))
{
- conf_report_error("Ignoring connect block for %s -- name is equal to my own name.",
- yy_server->name);
+ conf_report_error("Ignoring connect block for %s -- name is "
+ "equal to my own name.", yy_server->name);
return 0;
}
- if((EmptyString(yy_server->passwd) || EmptyString(yy_server->spasswd)) && EmptyString(yy_server->certfp))
+ if ((EmptyString(yy_server->passwd) || EmptyString(yy_server->spasswd))
+ && EmptyString(yy_server->certfp))
{
- conf_report_error("Ignoring connect block for %s -- no fingerprint or password credentials provided.",
- yy_server->name);
+ conf_report_error("Ignoring connect block for %s -- no "
+ "fingerprint or password credentials "
+ "provided.", yy_server->name);
return 0;
}
- if((yy_server->flags & SERVER_SSL) && EmptyString(yy_server->certfp))
+ if ((yy_server->flags & SERVER_SSL) && EmptyString(yy_server->certfp))
{
- conf_report_error("Ignoring connect block for %s -- no fingerprint provided for SSL connection.",
- yy_server->name);
+ conf_report_error("Ignoring connect block for %s -- no "
+ "fingerprint provided for SSL "
+ "connection.", yy_server->name);
return 0;
}
- if(EmptyString(yy_server->connect_host)
- && GET_SS_FAMILY(&yy_server->connect4) != AF_INET
- && GET_SS_FAMILY(&yy_server->connect6) != AF_INET6
- )
+ if (! (yy_server->flags & SERVER_SSL) && ! EmptyString(yy_server->certfp))
{
- conf_report_error("Ignoring connect block for %s -- missing host.",
- yy_server->name);
+ conf_report_error("Ignoring connect block for %s -- "
+ "fingerprint authentication has "
+ "been requested; but the ssl flag "
+ "is not set.", yy_server->name);
return 0;
}
-#ifndef HAVE_LIBZ
- if(ServerConfCompressed(yy_server))
+ if (EmptyString(yy_server->connect_host)
+ && GET_SS_FAMILY(&yy_server->connect4) != AF_INET
+ && GET_SS_FAMILY(&yy_server->connect6) != AF_INET6)
{
- conf_report_error("Ignoring connect::flags::compressed -- zlib not available.");
- yy_server->flags &= ~SERVER_COMPRESSED;
+ conf_report_error("Ignoring connect block for %s -- missing "
+ "host.", yy_server->name);
+ return 0;
}
-#endif
add_server_conf(yy_server);
rb_dlinkAdd(yy_server, &yy_server->node, &server_conf_list);
rb_free(yy_server->spasswd);
}
- yy_server->spasswd = rb_strdup(data);
+ if (EmptyString((const char *) data))
+ {
+ yy_server->spasswd = NULL;
+ conf_report_warning("Invalid send_password for connect "
+ "block; must not be empty if provided");
+ }
+ else if (strpbrk(data, " :"))
+ {
+ yy_server->spasswd = NULL;
+ conf_report_error("Invalid send_password for connect "
+ "block; cannot contain spaces or colons");
+ }
+ else
+ yy_server->spasswd = rb_strdup(data);
}
static void
memset(yy_server->passwd, 0, strlen(yy_server->passwd));
rb_free(yy_server->passwd);
}
- yy_server->passwd = rb_strdup(data);
+
+ if (EmptyString((const char *) data))
+ {
+ yy_server->passwd = NULL;
+ conf_report_warning("Invalid accept_password for connect "
+ "block; must not be empty if provided");
+ }
+ else if (strpbrk(data, " :"))
+ {
+ yy_server->passwd = NULL;
+ conf_report_error("Invalid accept_password for connect "
+ "block; cannot contain spaces or colons");
+ }
+ else
+ yy_server->passwd = rb_strdup(data);
}
static void
{
conf_parm_t *args = data;
- /* note, we allow them to set compressed, then remove it later if
- * they do and LIBZ isnt available
- */
set_modes_from_table(&yy_server->flags, "flag", connect_table, args);
}
-static void
-conf_set_connect_hub_mask(void *data)
-{
- struct remote_conf *yy_hub;
-
- if(EmptyString(yy_server->name))
- return;
-
- yy_hub = make_remote_conf();
- yy_hub->flags = CONF_HUB;
-
- yy_hub->host = rb_strdup(data);
- yy_hub->server = rb_strdup(yy_server->name);
- rb_dlinkAdd(yy_hub, &yy_hub->node, &hubleaf_conf_list);
-}
-
-static void
-conf_set_connect_leaf_mask(void *data)
-{
- struct remote_conf *yy_leaf;
-
- if(EmptyString(yy_server->name))
- return;
-
- yy_leaf = make_remote_conf();
- yy_leaf->flags = CONF_LEAF;
-
- yy_leaf->host = rb_strdup(data);
- yy_leaf->server = rb_strdup(yy_server->name);
- rb_dlinkAdd(yy_leaf, &yy_leaf->node, &hubleaf_conf_list);
-}
-
static void
conf_set_connect_class(void *data)
{
}
static void
-conf_set_general_compression_level(void *data)
+conf_set_general_stats_l_oper_only(void *data)
{
-#ifdef HAVE_LIBZ
- ConfigFileEntry.compression_level = *(unsigned int *) data;
+ char *val = data;
- if((ConfigFileEntry.compression_level < 1) || (ConfigFileEntry.compression_level > 9))
- {
- conf_report_error
- ("Invalid general::compression_level %d -- using default.",
- ConfigFileEntry.compression_level);
- ConfigFileEntry.compression_level = 0;
- }
-#else
- conf_report_error("Ignoring general::compression_level -- zlib not available.");
-#endif
+ if(rb_strcasecmp(val, "yes") == 0)
+ ConfigFileEntry.stats_l_oper_only = STATS_L_OPER_ONLY_YES;
+ else if(rb_strcasecmp(val, "self") == 0)
+ ConfigFileEntry.stats_l_oper_only = STATS_L_OPER_ONLY_SELF;
+ else if(rb_strcasecmp(val, "no") == 0)
+ ConfigFileEntry.stats_l_oper_only = STATS_L_OPER_ONLY_NO;
+ else
+ conf_report_error("Invalid setting '%s' for general::stats_l_oper_only.", val);
}
static void
conf_set_general_default_umodes(void *data)
{
- char *pm;
- int what = MODE_ADD, flag;
+ char *umodes = data;
- ConfigFileEntry.default_umodes = 0;
- for (pm = (char *) data; *pm; pm++)
- {
- switch (*pm)
- {
- case '+':
- what = MODE_ADD;
- break;
- case '-':
- what = MODE_DEL;
- break;
-
- /* don't allow +o */
- case 'o':
- case 'S':
- case 'Z':
- case ' ':
- break;
-
- default:
- if ((flag = user_modes[(unsigned char) *pm]))
- {
- /* Proper value has probably not yet been set
- * so don't check oper_only_umodes -- jilles */
- if (what == MODE_ADD)
- ConfigFileEntry.default_umodes |= flag;
- else
- ConfigFileEntry.default_umodes &= ~flag;
- }
- break;
- }
- }
+ parse_umodes(umodes, &ConfigFileEntry.default_umodes, NULL);
}
static void
}
}
+static void
+conf_set_general_hidden_caps(void *data)
+{
+ size_t n = 0;
+
+ for (conf_parm_t *arg = data; arg; arg = arg->next)
+ n += 1;
+
+ if (ConfigFileEntry.hidden_caps != NULL)
+ {
+ for (n = 0; ConfigFileEntry.hidden_caps[n] != NULL; n++)
+ rb_free(ConfigFileEntry.hidden_caps[n]);
+ rb_free(ConfigFileEntry.hidden_caps);
+ }
+ ConfigFileEntry.hidden_caps = rb_malloc(sizeof *ConfigFileEntry.hidden_caps * (n + 1));
+
+ n = 0;
+ for (conf_parm_t *arg = data; arg; arg = arg->next)
+ {
+ ConfigFileEntry.hidden_caps[n++] = rb_strdup(arg->v.string);
+ }
+ ConfigFileEntry.hidden_caps[n] = NULL;
+}
+
static void
conf_set_serverhide_links_delay(void *data)
{
}
ierror("\"%s\", line %d: %s", current_file, lineno + 1, msg);
- sendto_realops_snomask(SNO_GENERAL, L_ALL, "error: \"%s\", line %d: %s", current_file, lineno + 1, msg);
+ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "error: \"%s\", line %d: %s", current_file, lineno + 1, msg);
}
void
}
iwarn("\"%s\", line %d: %s", current_file, lineno + 1, msg);
- sendto_realops_snomask(SNO_GENERAL, L_ALL, "warning: \"%s\", line %d: %s", current_file, lineno + 1, msg);
+ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "warning: \"%s\", line %d: %s", current_file, lineno + 1, msg);
}
int
{ "redirserv", CF_QSTRING, conf_set_auth_redir_serv, 0, NULL },
{ "redirport", CF_INT, conf_set_auth_redir_port, 0, NULL },
{ "flags", CF_STRING | CF_FLIST, conf_set_auth_flags, 0, NULL },
+ { "umodes", CF_QSTRING, conf_set_auth_umodes, 0, NULL},
{ "\0", 0, NULL, 0, NULL }
};
{ "vhost", CF_QSTRING, conf_set_connect_vhost, 0, NULL },
{ "port", CF_INT, conf_set_connect_port, 0, NULL },
{ "aftype", CF_STRING, conf_set_connect_aftype, 0, NULL },
- { "hub_mask", CF_QSTRING, conf_set_connect_hub_mask, 0, NULL },
- { "leaf_mask", CF_QSTRING, conf_set_connect_leaf_mask, 0, NULL },
{ "class", CF_QSTRING, conf_set_connect_class, 0, NULL },
{ "\0", 0, NULL, 0, NULL }
};
{ "oper_only_umodes", CF_STRING | CF_FLIST, conf_set_general_oper_only_umodes, 0, NULL },
{ "oper_umodes", CF_STRING | CF_FLIST, conf_set_general_oper_umodes, 0, NULL },
{ "oper_snomask", CF_QSTRING, conf_set_general_oper_snomask, 0, NULL },
- { "compression_level", CF_INT, conf_set_general_compression_level, 0, NULL },
{ "havent_read_conf", CF_YESNO, conf_set_general_havent_read_conf, 0, NULL },
{ "hide_error_messages",CF_STRING, conf_set_general_hide_error_messages,0, NULL },
- { "stats_k_oper_only", CF_STRING, conf_set_general_stats_k_oper_only, 0, NULL },
{ "stats_i_oper_only", CF_STRING, conf_set_general_stats_i_oper_only, 0, NULL },
+ { "stats_k_oper_only", CF_STRING, conf_set_general_stats_k_oper_only, 0, NULL },
+ { "stats_l_oper_only", CF_STRING, conf_set_general_stats_l_oper_only, 0, NULL },
{ "default_umodes", CF_QSTRING, conf_set_general_default_umodes, 0, NULL },
{ "default_operstring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_operstring },
{ "non_redundant_klines", CF_YESNO, NULL, 0, &ConfigFileEntry.non_redundant_klines },
{ "tkline_expire_notices", CF_YESNO, NULL, 0, &ConfigFileEntry.tkline_expire_notices },
+ { "hidden_caps", CF_QSTRING | CF_FLIST, conf_set_general_hidden_caps, 0, NULL },
+
{ "anti_nick_flood", CF_YESNO, NULL, 0, &ConfigFileEntry.anti_nick_flood },
{ "burst_away", CF_YESNO, NULL, 0, &ConfigFileEntry.burst_away },
{ "caller_id_wait", CF_TIME, NULL, 0, &ConfigFileEntry.caller_id_wait },
{ "short_motd", CF_YESNO, NULL, 0, &ConfigFileEntry.short_motd },
{ "stats_c_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_c_oper_only },
{ "stats_e_disabled", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_e_disabled },
- { "stats_h_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_h_oper_only },
{ "stats_o_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_o_oper_only },
{ "stats_P_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_P_oper_only },
{ "stats_y_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.stats_y_oper_only },
{ "hide_opers", CF_YESNO, NULL, 0, &ConfigFileEntry.hide_opers },
{ "certfp_method", CF_STRING, conf_set_general_certfp_method, 0, NULL },
{ "drain_reason", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.drain_reason },
+ { "sasl_only_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.sasl_only_client_message },
+ { "identd_only_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.identd_only_client_message },
+ { "sctp_forbidden_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.sctp_forbidden_client_message },
+ { "ssltls_only_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.ssltls_only_client_message },
+ { "not_authorised_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.not_authorised_client_message },
+ { "illegal_hostname_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.not_authorised_client_message },
+ { "server_full_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.server_full_client_message },
+ { "illegal_name_long_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.illegal_name_long_client_message },
+ { "illegal_name_short_client_message", CF_QSTRING, NULL, BUFSIZE, &ConfigFileEntry.illegal_name_short_client_message },
{ "tls_ciphers_oper_only", CF_YESNO, NULL, 0, &ConfigFileEntry.tls_ciphers_oper_only },
+ { "oper_secure_only", CF_YESNO, NULL, 0, &ConfigFileEntry.oper_secure_only },
{ "\0", 0, NULL, 0, NULL }
};
{ "displayed_usercount", CF_INT, NULL, 0, &ConfigChannel.displayed_usercount },
{ "strip_topic_colors", CF_YESNO, NULL, 0, &ConfigChannel.strip_topic_colors },
{ "opmod_send_statusmsg", CF_YESNO, NULL, 0, &ConfigChannel.opmod_send_statusmsg },
+ { "ip_bans_through_vhost", CF_YESNO, NULL, 0, &ConfigChannel.ip_bans_through_vhost },
{ "\0", 0, NULL, 0, NULL }
};
add_top_conf("auth", conf_begin_auth, conf_end_auth, conf_auth_table);
- add_top_conf("shared", conf_cleanup_shared, conf_cleanup_shared, NULL);
- add_conf_item("shared", "oper", CF_QSTRING | CF_FLIST, conf_set_shared_oper);
- add_conf_item("shared", "flags", CF_STRING | CF_FLIST, conf_set_shared_flags);
-
add_top_conf("connect", conf_begin_connect, conf_end_connect, conf_connect_table);
add_top_conf("exempt", NULL, NULL, NULL);