X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/401cb2bb170f94934b3c06f182ef8826b4f56326..1a7927bb876d91e6a671788a2736b9cff50e0b4d:/ircd/s_conf.c diff --git a/ircd/s_conf.c b/ircd/s_conf.c index 74df1cfa..20211851 100644 --- a/ircd/s_conf.c +++ b/ircd/s_conf.c @@ -25,6 +25,7 @@ #include "stdinc.h" #include "ircd_defs.h" #include "s_conf.h" +#include "s_user.h" #include "s_newconf.h" #include "newconf.h" #include "s_serv.h" @@ -52,6 +53,7 @@ #include "hook.h" #include "s_assert.h" #include "authproc.h" +#include "supported.h" struct config_server_hide ConfigServerHide; @@ -255,7 +257,7 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern case NOT_AUTHORISED: { int port = -1; - port = ntohs(GET_SS_PORT(&source_p->localClient->listener->addr)); + port = ntohs(GET_SS_PORT(&source_p->localClient->listener->addr[0])); ServerStats.is_ref++; /* jdc - lists server name & port connections are on */ @@ -278,9 +280,8 @@ check_client(struct Client *client_p, struct Client *source_p, const char *usern source_p->name, IsGotId(source_p) ? "" : "~", source_p->username, source_p->sockhost, source_p->localClient->listener->name, port); - add_reject(client_p, NULL, NULL); - exit_client(client_p, source_p, &me, - "You are not authorised to use this server"); + add_reject(client_p, NULL, NULL, NULL, "You are not authorised to use this server."); + exit_client(client_p, source_p, &me, "You are not authorised to use this server."); break; } case BANNED_CLIENT: @@ -362,7 +363,7 @@ verify_access(struct Client *client_p, const char *username) form_str(ERR_YOUREBANNEDCREEP), me.name, client_p->name, get_user_ban_reason(aconf)); - add_reject(client_p, aconf->user, aconf->host); + add_reject(client_p, aconf->user, aconf->host, aconf, NULL); return (BANNED_CLIENT); } @@ -529,6 +530,20 @@ attach_iline(struct Client *client_p, struct ConfItem *aconf) return (attach_conf(client_p, aconf)); } +/* + * deref_conf + * + * inputs - ConfItem that is referenced by something other than a client + * side effects - Decrement and free ConfItem if appropriate + */ +void +deref_conf(struct ConfItem *aconf) +{ + aconf->clients--; + if(!aconf->clients && IsIllegal(aconf)) + free_conf(aconf); +} + /* * detach_conf * @@ -589,11 +604,11 @@ attach_conf(struct Client *client_p, struct ConfItem *aconf) if(IsIllegal(aconf)) return (NOT_AUTHORISED); - if(ClassPtr(aconf)) - { - if(!add_ip_limit(client_p, aconf)) - return (TOO_MANY_LOCAL); - } + if(s_assert(ClassPtr(aconf))) + return (NOT_AUTHORISED); + + if(!add_ip_limit(client_p, aconf)) + return (TOO_MANY_LOCAL); if((aconf->status & CONF_CLIENT) && ConfCurrUsers(aconf) >= ConfMaxUsers(aconf) && ConfMaxUsers(aconf) > 0) @@ -629,6 +644,8 @@ attach_conf(struct Client *client_p, struct ConfItem *aconf) bool rehash(bool sig) { + rb_dlink_node *n; + hook_data_rehash hdata = { sig }; if(sig) @@ -647,6 +664,16 @@ rehash(bool sig) open_logfiles(); + RB_DLINK_FOREACH(n, local_oper_list.head) + { + struct Client *oper = n->data; + const char *modeparv[4]; + modeparv[0] = modeparv[1] = oper->name; + modeparv[2] = "+"; + modeparv[3] = NULL; + user_mode(oper, oper, 3, modeparv); + } + call_hook(h_rehash, &hdata); return false; } @@ -678,10 +705,8 @@ set_default_conf(void) memset(&ServerInfo.bind4, 0, sizeof(ServerInfo.bind4)); SET_SS_FAMILY(&ServerInfo.bind4, AF_UNSPEC); -#ifdef RB_IPV6 memset(&ServerInfo.bind6, 0, sizeof(ServerInfo.bind6)); SET_SS_FAMILY(&ServerInfo.bind6, AF_UNSPEC); -#endif AdminInfo.name = NULL; AdminInfo.email = NULL; @@ -708,7 +733,6 @@ set_default_conf(void) ConfigFileEntry.client_exit = true; ConfigFileEntry.dline_with_reason = true; ConfigFileEntry.kline_with_reason = true; - ConfigFileEntry.kline_delay = 0; ConfigFileEntry.warn_no_nline = true; ConfigFileEntry.non_redundant_klines = true; ConfigFileEntry.stats_e_disabled = false; @@ -811,6 +835,7 @@ set_default_conf(void) ConfigFileEntry.nicklen = NICKLEN; ConfigFileEntry.certfp_method = RB_SSL_CERTFP_METH_CERT_SHA1; ConfigFileEntry.hide_opers_in_whois = 0; + ConfigFileEntry.hide_opers = 0; if (!alias_dict) alias_dict = rb_dictionary_create("alias", rb_strcasecmp); @@ -918,6 +943,12 @@ validate_conf(void) splitmode = 0; splitchecking = 0; } + + CharAttrs['&'] |= CHANPFX_C; + if (ConfigChannel.disable_local_channels) + CharAttrs['&'] &= ~CHANPFX_C; + + chantypes_update(); } /* add_temp_kline() @@ -1105,12 +1136,17 @@ deactivate_conf(struct ConfItem *aconf, rb_dlink_node *ptr, time_t now) break; } if (aconf->lifetime != 0 && now < aconf->lifetime) + { aconf->status |= CONF_ILLEGAL; + } else { if (aconf->lifetime != 0) rb_dlinkDestroy(ptr, &prop_bans); - free_conf(aconf); + if (aconf->clients == 0) + free_conf(aconf); + else + aconf->status |= CONF_ILLEGAL; } } @@ -1256,13 +1292,13 @@ char * get_oper_name(struct Client *client_p) { /* +5 for !,@,{,} and null */ - static char buffer[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5]; + static char buffer[NAMELEN + USERLEN + HOSTLEN + HOSTLEN + 5]; if(MyOper(client_p)) { snprintf(buffer, sizeof(buffer), "%s!%s@%s{%s}", client_p->name, client_p->username, - client_p->host, client_p->localClient->opername); + client_p->host, client_p->user->opername); return buffer; } @@ -1308,7 +1344,8 @@ get_user_ban_reason(struct ConfItem *aconf) { static char reasonbuf[BUFSIZE]; - if (aconf->flags & CONF_FLAGS_TEMPORARY && + if (!ConfigFileEntry.hide_tkdline_duration && + aconf->flags & CONF_FLAGS_TEMPORARY && (aconf->status == CONF_KILL || aconf->status == CONF_DLINE)) snprintf(reasonbuf, sizeof reasonbuf, "Temporary %c-line %d min. - ", @@ -1608,15 +1645,15 @@ conf_add_d_conf(struct ConfItem *aconf) } } -static char * -strip_tabs(char *dest, const char *src, size_t len) +static void +strip_tabs(char *dest, const char *src, size_t size) { char *d = dest; if(dest == NULL || src == NULL) - return NULL; + return; - rb_strlcpy(dest, src, len); + rb_strlcpy(dest, src, size); while(*d) { @@ -1624,7 +1661,6 @@ strip_tabs(char *dest, const char *src, size_t len) *d = ' '; d++; } - return dest; } /* @@ -1639,7 +1675,7 @@ yyerror(const char *msg) { char newlinebuf[BUFSIZE]; - strip_tabs(newlinebuf, yy_linebuf, strlen(yy_linebuf)); + strip_tabs(newlinebuf, yy_linebuf, sizeof(newlinebuf)); ierror("\"%s\", line %d: %s at '%s'", conffilebuf, lineno + 1, msg, newlinebuf); sendto_realops_snomask(SNO_GENERAL, L_ALL, "\"%s\", line %d: %s at '%s'",