X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/39352a39f2b2f538859402f72ae5cef09f23d5fa..ef07b59ac8b60bec3cb532137921b7703494766d:/src/newconf.c diff --git a/src/newconf.c b/src/newconf.c index 40515e1..cdd3a99 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -263,7 +263,7 @@ conf_set_modules_module(void *data) #ifndef STATIC_MODULES char *m_bn; - m_bn = irc_basename((char *) data); + m_bn = rb_basename((char *) data); if(findmodule_byname(m_bn) != -1) return; @@ -295,6 +295,7 @@ struct mode_table /* *INDENT-OFF* */ static struct mode_table umode_table[] = { {"callerid", UMODE_CALLERID }, + {"softcallerid", UMODE_SCALLERID }, {"deaf", UMODE_DEAF }, {"invisible", UMODE_INVISIBLE }, {"locops", UMODE_LOCOPS }, @@ -303,28 +304,16 @@ static struct mode_table umode_table[] = { {"servnotice", UMODE_SERVNOTICE}, {"wallop", UMODE_WALLOP }, {"operwall", UMODE_OPERWALL }, + {"noctcp", UMODE_NOCTCP }, + {"noinvite", UMODE_NOINVITE }, + {"bot", UMODE_BOT }, + {"override", UMODE_OVERRIDE }, {NULL, 0} }; static struct mode_table oper_table[] = { {"encrypted", OPER_ENCRYPTED }, - {"local_kill", OPER_LOCKILL }, - {"global_kill", OPER_GLOBKILL|OPER_LOCKILL }, - {"remote", OPER_REMOTE }, - {"kline", OPER_KLINE }, - {"unkline", OPER_UNKLINE }, - {"nick_changes", OPER_NICKS }, - {"rehash", OPER_REHASH }, - {"die", OPER_DIE }, - {"admin", OPER_ADMIN }, - {"hidden_admin", OPER_HADMIN }, - {"xline", OPER_XLINE }, - {"resv", OPER_RESV }, - {"operwall", OPER_OPERWALL }, - {"oper_spy", OPER_SPY }, - {"hidden_oper", OPER_INVIS }, - {"remoteban", OPER_REMOTEBAN }, - {"mass_notice", OPER_MASSNOTICE }, + {"need_ssl", OPER_NEEDSSL }, {NULL, 0} }; @@ -342,6 +331,7 @@ static struct mode_table auth_table[] = { {"no_tilde", CONF_FLAGS_NO_TILDE }, {"need_ident", CONF_FLAGS_NEED_IDENTD }, {"have_ident", CONF_FLAGS_NEED_IDENTD }, + {"need_ssl", CONF_FLAGS_NEED_SSL }, {"need_sasl", CONF_FLAGS_NEED_SASL }, {NULL, 0} }; @@ -387,6 +377,8 @@ static struct mode_table shared_table[] = { "unresv", SHARED_UNRESV }, { "locops", SHARED_LOCOPS }, { "rehash", SHARED_REHASH }, + { "die", SHARED_DIE }, + { "modules", SHARED_MODULE }, { "all", SHARED_ALL }, { "none", 0 }, {NULL, 0} @@ -487,13 +479,9 @@ conf_set_privset_privs(void *data) if (!set) { - conf_report_error("Warning -- unknown parent privilege set %s for %s; ignored.", yy_privset_extends, conf_cur_block_name); + conf_report_error("Warning -- unknown parent privilege set %s for %s; assuming defaults", yy_privset_extends, conf_cur_block_name); - rb_free(yy_privset_extends); - rb_free(privs); - - yy_privset_extends = NULL; - return; + set = privilegeset_get("default"); } privilegeset_extend(set, conf_cur_block_name != NULL ? conf_cur_block_name : "", privs, 0); @@ -527,7 +515,7 @@ conf_begin_oper(struct TopConf *tc) } yy_oper = make_oper_conf(); - yy_oper->flags |= OPER_ENCRYPTED|OPER_RESV|OPER_OPERWALL|OPER_REMOTEBAN|OPER_MASSNOTICE; + yy_oper->flags |= OPER_ENCRYPTED; return 0; } @@ -564,6 +552,10 @@ conf_end_oper(struct TopConf *tc) return 0; } + + if (!yy_oper->privset) + yy_oper->privset = privilegeset_get("default"); + /* now, yy_oper_list contains a stack of oper_conf's with just user * and host in, yy_oper contains the rest of the information which * we need to copy into each element in yy_oper_list @@ -581,6 +573,31 @@ conf_end_oper(struct TopConf *tc) yy_tmpoper->flags = yy_oper->flags; yy_tmpoper->umodes = yy_oper->umodes; yy_tmpoper->snomask = yy_oper->snomask; + + if(!EmptyString(yy_oper->vhost)) + { + if(valid_hostname(yy_oper->vhost)) + yy_tmpoper->vhost = rb_strdup(yy_oper->vhost); + else if(!EmptyString(yy_oper->vhost)) + conf_report_error("Ignoring vhost setting for oper %s -- invalid hostmask.", yy_oper->name); + } + + if(!EmptyString(yy_oper->swhois)) + { + if(strlen(yy_oper->swhois) < 400) + yy_tmpoper->swhois = rb_strdup(yy_oper->swhois); + else + conf_report_error("Ignoring swhois setting for oper %s -- swhois too long.", yy_oper->name); + } + + if(!EmptyString(yy_oper->operstring)) + { + if(strlen(yy_oper->operstring) < 400) + yy_tmpoper->operstring = rb_strdup(yy_oper->operstring); + else + conf_report_error("Ignoring operstring setting for oper %s -- operstring too long.", yy_oper->name); + } + yy_tmpoper->privset = yy_oper->privset; #ifdef HAVE_LIBCRYPTO @@ -630,6 +647,12 @@ conf_set_oper_flags(void *data) set_modes_from_table(&yy_oper->flags, "flag", oper_table, args); } +static void +conf_set_oper_fingerprint(void *data) +{ + yy_oper->certfp = rb_strdup((char *) data); +} + static void conf_set_oper_privset(void *data) { @@ -704,6 +727,24 @@ conf_set_oper_snomask(void *data) yy_oper->snomask = parse_snobuf_to_mask(0, (const char *) data); } +static void +conf_set_oper_vhost(void *data) +{ + yy_oper->vhost = rb_strdup((char *) data); +} + +static void +conf_set_oper_swhois(void *data) +{ + yy_oper->swhois = rb_strdup((char *) data); +} + +static void +conf_set_oper_operstring(void *data) +{ + yy_oper->operstring = rb_strdup((char *) data); +} + static int conf_begin_class(struct TopConf *tc) { @@ -738,21 +779,33 @@ conf_set_class_ping_time(void *data) } static void -conf_set_class_cidr_bitlen(void *data) +conf_set_class_cidr_ipv4_bitlen(void *data) { + unsigned int maxsize = 32; + if(*(unsigned int *) data > maxsize) + conf_report_error + ("class::cidr_ipv4_bitlen argument exceeds maxsize (%d > %d) - ignoring.", + *(unsigned int *) data, maxsize); + else + yy_class->cidr_ipv4_bitlen = *(unsigned int *) data; + +} + #ifdef RB_IPV6 +static void +conf_set_class_cidr_ipv6_bitlen(void *data) +{ unsigned int maxsize = 128; -#else - unsigned int maxsize = 32; -#endif if(*(unsigned int *) data > maxsize) conf_report_error - ("class::cidr_bitlen argument exceeds maxsize (%d > %d) - ignoring.", + ("class::cidr_ipv6_bitlen argument exceeds maxsize (%d > %d) - ignoring.", *(unsigned int *) data, maxsize); else - yy_class->cidr_bitlen = *(unsigned int *) data; + yy_class->cidr_ipv6_bitlen = *(unsigned int *) data; } +#endif + static void conf_set_class_number_per_cidr(void *data) { @@ -895,12 +948,12 @@ conf_begin_auth(struct TopConf *tc) static int conf_end_auth(struct TopConf *tc) { - struct ConfItem *yy_tmp; + struct ConfItem *yy_tmp, *found_conf; rb_dlink_node *ptr; rb_dlink_node *next_ptr; - if(EmptyString(yy_aconf->name)) - yy_aconf->name = rb_strdup("NOMATCH"); + if(EmptyString(yy_aconf->info.name)) + yy_aconf->info.name = rb_strdup("NOMATCH"); /* didnt even get one ->host? */ if(EmptyString(yy_aconf->host)) @@ -913,7 +966,15 @@ conf_end_auth(struct TopConf *tc) collapse(yy_aconf->user); collapse(yy_aconf->host); conf_add_class_to_conf(yy_aconf); - add_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user, yy_aconf->spasswd, yy_aconf); + if ((found_conf = find_exact_conf_by_address("*", CONF_CLIENT, "*")) && found_conf->spasswd == NULL) + conf_report_error("Ignoring redundant auth block (after *@*)"); + else if ((found_conf = find_exact_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user)) && + (!found_conf->spasswd || (yy_aconf->spasswd && + 0 == irccmp(found_conf->spasswd, yy_aconf->spasswd)))) + conf_report_error("Ignoring duplicate auth block for %s@%s", + yy_aconf->user, yy_aconf->host); + else + add_conf_by_address(yy_aconf->host, CONF_CLIENT, yy_aconf->user, yy_aconf->spasswd, yy_aconf); RB_DLINK_FOREACH_SAFE(ptr, next_ptr, yy_aconf_list.head) { @@ -926,7 +987,7 @@ conf_end_auth(struct TopConf *tc) yy_tmp->spasswd = rb_strdup(yy_aconf->spasswd); /* this will always exist.. */ - yy_tmp->name = rb_strdup(yy_aconf->name); + yy_tmp->info.name = rb_strdup(yy_aconf->info.name); if(yy_aconf->className) yy_tmp->className = rb_strdup(yy_aconf->className); @@ -939,7 +1000,13 @@ conf_end_auth(struct TopConf *tc) conf_add_class_to_conf(yy_tmp); - add_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user, yy_tmp->spasswd, yy_tmp); + if (find_exact_conf_by_address("*", CONF_CLIENT, "*")) + conf_report_error("Ignoring redundant auth block (after *@*)"); + else if (find_exact_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user)) + conf_report_error("Ignoring duplicate auth block for %s@%s", + yy_tmp->user, yy_tmp->host); + else + add_conf_by_address(yy_tmp->host, CONF_CLIENT, yy_tmp->user, yy_tmp->spasswd, yy_tmp); rb_dlinkDestroy(ptr, &yy_aconf_list); } @@ -997,6 +1064,24 @@ conf_set_auth_passwd(void *data) yy_aconf->passwd = rb_strdup(data); } +static void +conf_set_auth_autojoin(void *data) +{ + if(yy_aconf->autojoin) + memset(yy_aconf->autojoin, 0, strlen(yy_aconf->autojoin)); + rb_free(yy_aconf->autojoin); + yy_aconf->autojoin = rb_strdup(data); +} + +static void +conf_set_auth_autojoin_opers(void *data) +{ + if(yy_aconf->autojoin_opers) + memset(yy_aconf->autojoin_opers, 0, strlen(yy_aconf->autojoin)); + rb_free(yy_aconf->autojoin_opers); + yy_aconf->autojoin_opers = rb_strdup(data); +} + static void conf_set_auth_spoof(void *data) { @@ -1053,8 +1138,8 @@ conf_set_auth_spoof(void *data) return; } - rb_free(yy_aconf->name); - yy_aconf->name = rb_strdup(data); + rb_free(yy_aconf->info.name); + yy_aconf->info.name = rb_strdup(data); yy_aconf->flags |= CONF_FLAGS_SPOOF_IP; } @@ -1070,8 +1155,8 @@ static void conf_set_auth_redir_serv(void *data) { yy_aconf->flags |= CONF_FLAGS_REDIR; - rb_free(yy_aconf->name); - yy_aconf->name = rb_strdup(data); + rb_free(yy_aconf->info.name); + yy_aconf->info.name = rb_strdup(data); } static void @@ -1148,7 +1233,7 @@ conf_set_shared_oper(void *data) if((p = strchr(args->v.string, '@')) == NULL) { - conf_report_error("Ignoring shard::oper -- oper is not a user@host"); + conf_report_error("Ignoring shared::oper -- oper is not a user@host"); return; } @@ -1246,13 +1331,6 @@ conf_end_connect(struct TopConf *tc) yy_server->flags &= ~SERVER_COMPRESSED; } #endif - if(ServerConfCompressed(yy_server) && ServerConfSSL(yy_server)) - { - conf_report_error("Ignoring compressed for connect block %s -- " - "ssl and compressed are mutually exclusive (OpenSSL does its own compression)", - yy_server->name); - yy_server->flags &= ~SERVER_COMPRESSED; - } add_server_conf(yy_server); rb_dlinkAdd(yy_server, &yy_server->node, &server_conf_list); @@ -1720,9 +1798,6 @@ conf_end_alias(struct TopConf *tc) return -1; } - if (!alias_dict) - alias_dict = irc_dictionary_create(strcasecmp); - irc_dictionary_add(alias_dict, yy_alias->name, yy_alias); return 0; @@ -1988,6 +2063,8 @@ static struct ConfEntry conf_serverinfo_table[] = { { "description", CF_QSTRING, NULL, 0, &ServerInfo.description }, { "network_desc", CF_QSTRING, NULL, 0, &ServerInfo.network_desc }, + { "helpchan", CF_QSTRING, NULL, 0, &ServerInfo.helpchan }, + { "helpurl", CF_QSTRING, NULL, 0, &ServerInfo.helpurl }, { "hub", CF_YESNO, NULL, 0, &ServerInfo.hub }, { "network_name", CF_QSTRING, conf_set_serverinfo_network_name, 0, NULL }, @@ -2036,8 +2113,12 @@ static struct ConfEntry conf_operator_table[] = { "umodes", CF_STRING | CF_FLIST, conf_set_oper_umodes, 0, NULL }, { "privset", CF_QSTRING, conf_set_oper_privset, 0, NULL }, { "snomask", CF_QSTRING, conf_set_oper_snomask, 0, NULL }, + { "vhost", CF_QSTRING, conf_set_oper_vhost, 0, NULL }, + { "swhois", CF_QSTRING, conf_set_oper_swhois, 0, NULL }, + { "operstring", CF_QSTRING, conf_set_oper_operstring, 0, NULL }, { "user", CF_QSTRING, conf_set_oper_user, 0, NULL }, { "password", CF_QSTRING, conf_set_oper_password, 0, NULL }, + { "fingerprint", CF_QSTRING, conf_set_oper_fingerprint, 0, NULL }, { "\0", 0, NULL, 0, NULL } }; @@ -2051,7 +2132,10 @@ static struct ConfEntry conf_privset_table[] = static struct ConfEntry conf_class_table[] = { { "ping_time", CF_TIME, conf_set_class_ping_time, 0, NULL }, - { "cidr_bitlen", CF_INT, conf_set_class_cidr_bitlen, 0, NULL }, + { "cidr_ipv4_bitlen", CF_INT, conf_set_class_cidr_ipv4_bitlen, 0, NULL }, +#ifdef RB_IPV6 + { "cidr_ipv6_bitlen", CF_INT, conf_set_class_cidr_ipv6_bitlen, 0, NULL }, +#endif { "number_per_cidr", CF_INT, conf_set_class_number_per_cidr, 0, NULL }, { "number_per_ip", CF_INT, conf_set_class_number_per_ip, 0, NULL }, { "number_per_ip_global", CF_INT,conf_set_class_number_per_ip_global, 0, NULL }, @@ -2069,6 +2153,8 @@ static struct ConfEntry conf_auth_table[] = { "password", CF_QSTRING, conf_set_auth_passwd, 0, NULL }, { "class", CF_QSTRING, conf_set_auth_class, 0, NULL }, { "spoof", CF_QSTRING, conf_set_auth_spoof, 0, NULL }, + { "autojoin", CF_QSTRING, conf_set_auth_autojoin, 0, NULL }, + { "autojoin_opers", CF_QSTRING, conf_set_auth_autojoin_opers, 0, NULL }, { "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 }, @@ -2105,6 +2191,8 @@ static struct ConfEntry conf_general_table[] = { "default_operstring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_operstring }, { "default_adminstring",CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_adminstring }, + { "default_operhost", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.default_operhost }, + { "static_quit", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.static_quit }, { "servicestring", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.servicestring }, { "egdpool_path", CF_QSTRING, NULL, MAXPATHLEN, &ConfigFileEntry.egdpool_path }, { "kline_reason", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.kline_reason }, @@ -2112,6 +2200,7 @@ static struct ConfEntry conf_general_table[] = { "identify_command", CF_QSTRING, NULL, REALLEN, &ConfigFileEntry.identifycommand }, { "anti_spam_exit_message_time", CF_TIME, NULL, 0, &ConfigFileEntry.anti_spam_exit_message_time }, + { "use_part_messages", CF_YESNO, NULL, 0, &ConfigFileEntry.use_part_messages }, { "disable_fake_channels", CF_YESNO, NULL, 0, &ConfigFileEntry.disable_fake_channels }, { "min_nonwildcard_simple", CF_INT, NULL, 0, &ConfigFileEntry.min_nonwildcard_simple }, { "non_redundant_klines", CF_YESNO, NULL, 0, &ConfigFileEntry.non_redundant_klines }, @@ -2141,8 +2230,10 @@ static struct ConfEntry conf_general_table[] = { "min_nonwildcard", CF_INT, NULL, 0, &ConfigFileEntry.min_nonwildcard }, { "nick_delay", CF_TIME, NULL, 0, &ConfigFileEntry.nick_delay }, { "no_oper_flood", CF_YESNO, NULL, 0, &ConfigFileEntry.no_oper_flood }, + { "true_no_oper_flood", CF_YESNO, NULL, 0, &ConfigFileEntry.true_no_oper_flood }, { "operspy_admin_only", CF_YESNO, NULL, 0, &ConfigFileEntry.operspy_admin_only }, { "operspy_dont_care_user_info", CF_YESNO, NULL, 0, &ConfigFileEntry.operspy_dont_care_user_info }, + { "secret_channels_in_whois", CF_YESNO, NULL, 0, &ConfigFileEntry.secret_channels_in_whois }, { "pace_wait", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait }, { "pace_wait_simple", CF_TIME, NULL, 0, &ConfigFileEntry.pace_wait_simple }, { "ping_cookie", CF_YESNO, NULL, 0, &ConfigFileEntry.ping_cookie }, @@ -2164,11 +2255,15 @@ static struct ConfEntry conf_general_table[] = { "ts_warn_delta", CF_TIME, NULL, 0, &ConfigFileEntry.ts_warn_delta }, { "use_whois_actually", CF_YESNO, NULL, 0, &ConfigFileEntry.use_whois_actually }, { "warn_no_nline", CF_YESNO, NULL, 0, &ConfigFileEntry.warn_no_nline }, + { "use_propagated_bans",CF_YESNO, NULL, 0, &ConfigFileEntry.use_propagated_bans }, + { "expire_override_time", CF_TIME, NULL, 0, &ConfigFileEntry.expire_override_time}, { "\0", 0, NULL, 0, NULL } }; static struct ConfEntry conf_channel_table[] = { + { "autochanmodes", CF_QSTRING, NULL, 0, &ConfigChannel.autochanmodes }, + { "exemptchanops", CF_QSTRING, NULL, 0, &ConfigChannel.exemptchanops }, { "default_split_user_count", CF_INT, NULL, 0, &ConfigChannel.default_split_user_count }, { "default_split_server_count", CF_INT, NULL, 0, &ConfigChannel.default_split_server_count }, { "burst_topicwho", CF_YESNO, NULL, 0, &ConfigChannel.burst_topicwho }, @@ -2180,10 +2275,25 @@ static struct ConfEntry conf_channel_table[] = { "max_chans_per_user", CF_INT, NULL, 0, &ConfigChannel.max_chans_per_user }, { "no_create_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_create_on_split }, { "no_join_on_split", CF_YESNO, NULL, 0, &ConfigChannel.no_join_on_split }, + { "only_ascii_channels", CF_YESNO, NULL, 0, &ConfigChannel.only_ascii_channels }, + { "cycle_host_change", CF_YESNO, NULL, 0, &ConfigChannel.cycle_host_change }, + { "host_in_topic", CF_YESNO, NULL, 0, &ConfigChannel.host_in_topic }, + { "use_halfop", CF_YESNO, NULL, 0, &ConfigChannel.use_halfop }, + { "use_admin", CF_YESNO, NULL, 0, &ConfigChannel.use_admin }, { "use_except", CF_YESNO, NULL, 0, &ConfigChannel.use_except }, { "use_invex", CF_YESNO, NULL, 0, &ConfigChannel.use_invex }, { "use_knock", CF_YESNO, NULL, 0, &ConfigChannel.use_knock }, { "use_forward", CF_YESNO, NULL, 0, &ConfigChannel.use_forward }, + { "use_local_channels", CF_YESNO, NULL, 0, &ConfigChannel.use_local_channels }, + { "resv_forcepart", CF_YESNO, NULL, 0, &ConfigChannel.resv_forcepart }, + { "kick_no_rejoin_time", CF_TIME, NULL, 0, &ConfigChannel.kick_no_rejoin_time }, + { "exempt_cmode_c", CF_YESNO, NULL, 0, &ConfigChannel.exempt_cmode_c }, + { "exempt_cmode_C", CF_YESNO, NULL, 0, &ConfigChannel.exempt_cmode_C }, + { "exempt_cmode_D", CF_YESNO, NULL, 0, &ConfigChannel.exempt_cmode_D }, + { "exempt_cmode_T", CF_YESNO, NULL, 0, &ConfigChannel.exempt_cmode_T }, + { "exempt_cmode_N", CF_YESNO, NULL, 0, &ConfigChannel.exempt_cmode_N }, + { "exempt_cmode_G", CF_YESNO, NULL, 0, &ConfigChannel.exempt_cmode_G }, + { "exempt_cmode_K", CF_YESNO, NULL, 0, &ConfigChannel.exempt_cmode_K }, { "\0", 0, NULL, 0, NULL } };