commit charybdis for openSUSE:Factory
Hello community, here is the log from the commit of package charybdis for openSUSE:Factory checked in at 2019-09-30 15:59:58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/charybdis (Old) and /work/SRC/openSUSE:Factory/.charybdis.new.2352 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "charybdis" Mon Sep 30 15:59:58 2019 rev:7 rq:733905 version:4.1.2 Changes: -------- --- /work/SRC/openSUSE:Factory/charybdis/charybdis.changes 2019-08-27 10:22:34.515934815 +0200 +++ /work/SRC/openSUSE:Factory/.charybdis.new.2352/charybdis.changes 2019-09-30 16:00:10.481092758 +0200 @@ -1,0 +2,6 @@ +Sun Sep 29 07:45:15 UTC 2019 - Jan Engelhardt <jengelh@inai.de> + +- Update to release 4.1.2 + * Do not corrupt usermodes on module unload/reload. + +------------------------------------------------------------------- Old: ---- charybdis-4.1.1.tar.gz New: ---- charybdis-4.1.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ charybdis.spec ++++++ --- /var/tmp/diff_new_pack.yacFMq/_old 2019-09-30 16:00:12.357087765 +0200 +++ /var/tmp/diff_new_pack.yacFMq/_new 2019-09-30 16:00:12.361087755 +0200 @@ -17,7 +17,7 @@ Name: charybdis -Version: 4.1.1 +Version: 4.1.2 Release: 0 Summary: Scalable IRCv3.2 compliant chat daemon License: GPL-2.0-or-later ++++++ charybdis-4.1.1.tar.gz -> charybdis-4.1.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/.gitignore new/charybdis-charybdis-4.1.2/.gitignore --- old/charybdis-charybdis-4.1.1/.gitignore 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/.gitignore 2019-08-31 22:12:44.000000000 +0200 @@ -62,6 +62,7 @@ tests/rb_dictionary1 tests/rb_snprintf_append1 tests/rb_snprintf_try_append1 +tests/sasl_abort1 tests/send1 tests/serv_connect1 tests/substitution1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/.travis.yml new/charybdis-charybdis-4.1.2/.travis.yml --- old/charybdis-charybdis-4.1.1/.travis.yml 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/.travis.yml 2019-08-31 22:12:44.000000000 +0200 @@ -55,5 +55,6 @@ - bash autogen.sh - CC=$COMPILER ./configure --with-shared-sqlite - make -j4 + - "if [ ${TRAVIS_OS_NAME} != 'osx' ]; then make check; fi" - make install - "if [ ${TRAVIS_OS_NAME} != 'osx' ]; then make -C doc/oper-guide html man info; fi" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/NEWS.md new/charybdis-charybdis-4.1.2/NEWS.md --- old/charybdis-charybdis-4.1.1/NEWS.md 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/NEWS.md 2019-08-31 22:12:44.000000000 +0200 @@ -1,8 +1,13 @@ # News -This is charybdis 4.1.1, Copyright (c) 2005-2018 Charybdis team. +This is charybdis 4.1.2, Copyright (c) 2005-2018 Charybdis team. See LICENSE for licensing details (GPL v2). +## charybdis-4.1.2 + +### user +- src/s_user.c: don't corrupt usermodes on module unload/reload + ## charybdis-4.1.1 ### security diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/authd/dns.c new/charybdis-charybdis-4.1.2/authd/dns.c --- old/charybdis-charybdis-4.1.1/authd/dns.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/authd/dns.c 2019-08-31 22:12:44.000000000 +0200 @@ -73,7 +73,7 @@ struct dns_query *query = rb_malloc(sizeof(struct dns_query)); int aftype; - if(!rb_inet_pton_sock(ip, (struct sockaddr *)&query->addr)) + if(!rb_inet_pton_sock(ip, &query->addr)) { rb_free(query); return NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/authd/provider.c new/charybdis-charybdis-4.1.2/authd/provider.c --- old/charybdis-charybdis-4.1.1/authd/provider.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/authd/provider.c 2019-08-31 22:12:44.000000000 +0200 @@ -319,12 +319,12 @@ rb_strlcpy(auth->l_ip, l_ip, sizeof(auth->l_ip)); auth->l_port = (uint16_t)atoi(l_port); /* should be safe */ - (void) rb_inet_pton_sock(l_ip, (struct sockaddr *)&auth->l_addr); + (void) rb_inet_pton_sock(l_ip, &auth->l_addr); SET_SS_PORT(&auth->l_addr, htons(auth->l_port)); rb_strlcpy(auth->c_ip, c_ip, sizeof(auth->c_ip)); auth->c_port = (uint16_t)atoi(c_port); - (void) rb_inet_pton_sock(c_ip, (struct sockaddr *)&auth->c_addr); + (void) rb_inet_pton_sock(c_ip, &auth->c_addr); SET_SS_PORT(&auth->c_addr, htons(auth->c_port)); rb_strlcpy(auth->hostname, "*", sizeof(auth->hostname)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/authd/providers/opm.c new/charybdis-charybdis-4.1.2/authd/providers/opm.c --- old/charybdis-charybdis-4.1.1/authd/providers/opm.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/authd/providers/opm.c 2019-08-31 22:12:44.000000000 +0200 @@ -457,7 +457,7 @@ rb_fde_t *F; int opt = 1; - if(!rb_inet_pton_sock(ip, (struct sockaddr *)&addr)) + if(!rb_inet_pton_sock(ip, &addr)) { warn_opers(L_CRIT, "OPM: got a bad listener: %s:%hu", ip, port); exit(EX_PROVIDER_ERROR); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/configure.ac new/charybdis-charybdis-4.1.2/configure.ac --- old/charybdis-charybdis-4.1.1/configure.ac 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/configure.ac 2019-08-31 22:12:44.000000000 +0200 @@ -4,7 +4,7 @@ AC_PREREQ(2.60) -AC_INIT([charybdis], [4.1.1]) +AC_INIT([charybdis], [4.1.2]) AC_LANG(C) AC_USE_SYSTEM_EXTENSIONS diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/doc/ircd.conf.example new/charybdis-charybdis-4.1.2/doc/ircd.conf.example --- old/charybdis-charybdis-4.1.1/doc/ircd.conf.example 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/doc/ircd.conf.example 2019-08-31 22:12:44.000000000 +0200 @@ -452,7 +452,7 @@ /* IPv4 port to listen on. * This should not be the same as any existing listeners. */ - #port_ipv4 = 32000; + #port_v4 = 32000; /* IPv6 address to listen on. This must be a publicly facing IP address * to be effective. @@ -463,7 +463,7 @@ /* IPv6 port to listen on. * This should not be the same as any existing listeners. */ - #port_ipv6 = 32000; + #port_v6 = 32000; /* You can also set the listen_port directive which will set both the * IPv4 and IPv6 ports at once. @@ -579,7 +579,6 @@ resv_fnc = yes; global_snotices = yes; dline_with_reason = yes; - kline_delay = 0 seconds; kline_with_reason = yes; kline_reason = "K-Lined"; identify_service = "NickServ@services.int"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/doc/reference.conf new/charybdis-charybdis-4.1.2/doc/reference.conf --- old/charybdis-charybdis-4.1.1/doc/reference.conf 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/doc/reference.conf 2019-08-31 22:12:44.000000000 +0200 @@ -931,7 +931,7 @@ /* IPv4 port to listen on. * This should not be the same as any existing listeners. */ - #port_ipv4 = 32000; + #port_v4 = 32000; /* IPv6 address to listen on. This must be a publicly facing IP address * to be effective. @@ -942,7 +942,7 @@ /* IPv6 port to listen on. * This should not be the same as any existing listeners. */ - #port_ipv6 = 32000; + #port_v6 = 32000; /* You can also set the listen_port directive which will set both the * IPv4 and IPv6 ports at once. @@ -1173,12 +1173,6 @@ */ dline_with_reason = yes; - /* kline delay: delay the checking of klines until a specified time. - * Useful if large kline lists are applied often to prevent the - * server eating CPU. - */ - kline_delay = 0 seconds; - /* kline reason: show the user the reason why they are k/dlined * on exit. may give away who set k/dline when set via tcm. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/extensions/m_webirc.c new/charybdis-charybdis-4.1.2/extensions/m_webirc.c --- old/charybdis-charybdis-4.1.1/extensions/m_webirc.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/extensions/m_webirc.c 2019-08-31 22:12:44.000000000 +0200 @@ -112,7 +112,7 @@ return; } - if (rb_inet_pton_sock(parv[4], (struct sockaddr *)&addr) <= 0) + if (rb_inet_pton_sock(parv[4], &addr) <= 0) { sendto_one(source_p, "NOTICE * :Invalid IP"); return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/include/client.h new/charybdis-charybdis-4.1.2/include/client.h --- old/charybdis-charybdis-4.1.1/include/client.h 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/include/client.h 2019-08-31 22:12:44.000000000 +0200 @@ -578,9 +578,15 @@ #define SHOW_IP 1 #define MASK_IP 2 +enum +{ + D_LINED, + K_LINED +}; + extern void check_banned_lines(void); -extern void check_klines_event(void *unused); extern void check_klines(void); +extern void check_one_kline(struct ConfItem *kline); extern void check_dlines(void); extern void check_xlines(void); extern void resv_nick_fnc(const char *mask, const char *reason, int temp_time); @@ -592,6 +598,7 @@ extern struct Client *make_client(struct Client *from); extern void free_pre_client(struct Client *client); +extern void notify_banned_client(struct Client *, struct ConfItem *, int ban); extern int exit_client(struct Client *, struct Client *, struct Client *, const char *); extern void error_exit_client(struct Client *, int); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/include/s_conf.h new/charybdis-charybdis-4.1.2/include/s_conf.h --- old/charybdis-charybdis-4.1.1/include/s_conf.h 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/include/s_conf.h 2019-08-31 22:12:44.000000000 +0200 @@ -178,7 +178,6 @@ int ts_warn_delta; int dline_with_reason; int kline_with_reason; - int kline_delay; int warn_no_nline; int nick_delay; int non_redundant_klines; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/ircd/client.c new/charybdis-charybdis-4.1.2/ircd/client.c --- old/charybdis-charybdis-4.1.1/ircd/client.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/ircd/client.c 2019-08-31 22:12:44.000000000 +0200 @@ -80,12 +80,6 @@ rb_dictionary *nd_dict = NULL; -enum -{ - D_LINED, - K_LINED -}; - rb_dlink_list dead_list; #ifdef DEBUG_EXITED_CLIENTS static rb_dlink_list dead_remote_list; @@ -487,7 +481,7 @@ } } -static void +void notify_banned_client(struct Client *client_p, struct ConfItem *aconf, int ban) { static const char conn_closed[] = "Connection closed"; @@ -532,19 +526,6 @@ check_xlines(); } -/* check_klines_event() - * - * inputs - - * outputs - - * side effects - check_klines() is called, kline_queued unset - */ -void -check_klines_event(void *unused) -{ - kline_queued = false; - check_klines(); -} - /* check_klines * * inputs - @@ -587,6 +568,74 @@ } } + +/* check_one_kline() + * + * This process needs to be kept in sync with find_kline() aka find_conf_by_address(). + * + * inputs - pointer to kline to check + * outputs - + * side effects - all clients will be checked against given kline + */ +void +check_one_kline(struct ConfItem *kline) +{ + struct Client *client_p; + rb_dlink_node *ptr; + rb_dlink_node *next_ptr; + + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, lclient_list.head) + { + client_p = ptr->data; + + if(IsMe(client_p) || !IsPerson(client_p)) + continue; + + if(!match(kline->user, client_p->username)) + continue; + + /* match one kline */ + { + int matched = 0; + int masktype; + int bits; + struct rb_sockaddr_storage sockaddr; + + masktype = parse_netmask(kline->host, (struct sockaddr_storage *)&sockaddr, &bits); + + switch (masktype) { + case HM_IPV4: + case HM_IPV6: + if(comp_with_mask_sock((struct sockaddr *)&client_p->localClient->ip, + (struct sockaddr *)&sockaddr, bits)) + matched = 1; + case HM_HOST: + if (match(kline->host, client_p->orighost)) + matched = 1; + } + + if (!matched) + continue; + } + + if(IsExemptKline(client_p)) + { + sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, + "KLINE over-ruled for %s, client is kline_exempt [%s@%s]", + get_client_name(client_p, HIDE_IP), + kline->user, kline->host); + continue; + } + + sendto_realops_snomask(SNO_GENERAL, L_ALL, + "KLINE active for %s", + get_client_name(client_p, HIDE_IP)); + + notify_banned_client(client_p, kline, K_LINED); + } +} + + /* check_dlines() * * inputs - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/ircd/hostmask.c new/charybdis-charybdis-4.1.2/ircd/hostmask.c --- old/charybdis-charybdis-4.1.1/ircd/hostmask.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/ircd/hostmask.c 2019-08-31 22:12:44.000000000 +0200 @@ -76,7 +76,7 @@ return HM_HOST; } else *b = 128; - if(rb_inet_pton_sock(ip, (struct sockaddr *)addr) > 0) + if(rb_inet_pton_sock(ip, addr) > 0) return HM_IPV6; else return HM_HOST; @@ -94,7 +94,7 @@ return HM_HOST; } else *b = 32; - if(rb_inet_pton_sock(ip, (struct sockaddr *)addr) > 0) + if(rb_inet_pton_sock(ip, addr) > 0) return HM_IPV4; else return HM_HOST; @@ -198,6 +198,9 @@ /* struct ConfItem* find_conf_by_address(const char*, struct rb_sockaddr_storage*, * int type, int fam, const char *username) + * + * This process needs to be kept in sync with check_one_kline(). + * * Input: The hostname, the address, the type of mask to find, the address * family, the username. * Output: The matching value with the highest precedence. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/ircd/listener.c new/charybdis-charybdis-4.1.2/ircd/listener.c --- old/charybdis-charybdis-4.1.1/ircd/listener.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/ircd/listener.c 2019-08-31 22:12:44.000000000 +0200 @@ -389,11 +389,11 @@ memset(&vaddr, 0, sizeof(vaddr)); if (vhost_ip1 != NULL) { - if (rb_inet_pton_sock(vhost_ip1, (struct sockaddr *)&vaddr[0]) <= 0) + if (rb_inet_pton_sock(vhost_ip1, &vaddr[0]) <= 0) return; if (vhost_ip2 != NULL) { - if (rb_inet_pton_sock(vhost_ip2, (struct sockaddr *)&vaddr[1]) <= 0) + if (rb_inet_pton_sock(vhost_ip2, &vaddr[1]) <= 0) return; } else { SET_SS_FAMILY(&vaddr[1], AF_UNSPEC); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/ircd/newconf.c new/charybdis-charybdis-4.1.2/ircd/newconf.c --- old/charybdis-charybdis-4.1.1/ircd/newconf.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/ircd/newconf.c 2019-08-31 22:12:44.000000000 +0200 @@ -246,7 +246,7 @@ { struct rb_sockaddr_storage addr; - if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET) + if(rb_inet_pton_sock(data, &addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET) { conf_report_error("Invalid IPv4 address for server vhost (%s)", (char *) data); return; @@ -261,7 +261,7 @@ struct rb_sockaddr_storage addr; - if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET6) + if(rb_inet_pton_sock(data, &addr) <= 0 || GET_SS_FAMILY(&addr) != AF_INET6) { conf_report_error("Invalid IPv6 address for server vhost (%s)", (char *) data); return; @@ -883,12 +883,6 @@ } if(listener_address[0] == NULL) { - if (!ssl) - { - conf_report_warning("listener 'ANY/%d': support for plaintext listeners may be removed in a future release per RFCs 7194 & 7258. " - "It is suggested that users be migrated to SSL/TLS connections.", args->v.number); - } - if (sctp) { conf_report_error("listener::sctp_port has no addresses -- ignoring."); } else { @@ -904,12 +898,6 @@ else family = AF_INET; - if (!ssl) - { - conf_report_warning("listener '%s/%d': support for plaintext listeners may be removed in a future release per RFCs 7194 & 7258. " - "It is suggested that users be migrated to SSL/TLS connections.", listener_address, args->v.number); - } - if (sctp) { #ifdef HAVE_LIBSCTP add_sctp_listener(args->v.number, listener_address[0], listener_address[1], ssl, yy_wsock); @@ -1369,7 +1357,7 @@ { struct rb_sockaddr_storage addr; - if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0) + if(rb_inet_pton_sock(data, &addr) <= 0) { rb_free(yy_server->connect_host); yy_server->connect_host = rb_strdup(data); @@ -1395,7 +1383,7 @@ { struct rb_sockaddr_storage addr; - if(rb_inet_pton_sock(data, (struct sockaddr *)&addr) <= 0) + if(rb_inet_pton_sock(data, &addr) <= 0) { rb_free(yy_server->bind_host); yy_server->bind_host = rb_strdup(data); @@ -1629,15 +1617,6 @@ } static void -conf_set_general_kline_delay(void *data) -{ - ConfigFileEntry.kline_delay = *(unsigned int *) data; - - /* THIS MUST BE HERE to stop us being unable to check klines */ - kline_queued = false; -} - -static void conf_set_general_stats_k_oper_only(void *data) { char *val = data; @@ -2212,7 +2191,7 @@ const char *confstr = (ipv6 ? "opm::listen_ipv6" : "opm::listen_ipv4"); char *ip = data; - if(!rb_inet_pton_sock(ip, (struct sockaddr *)&addr)) + if(!rb_inet_pton_sock(ip, &addr)) { conf_report_error("%s is an invalid address: %s", confstr, ip); return; @@ -2744,7 +2723,6 @@ { "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 }, - { "kline_delay", CF_TIME, conf_set_general_kline_delay, 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 }, { "default_umodes", CF_QSTRING, conf_set_general_default_umodes, 0, NULL }, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/ircd/s_conf.c new/charybdis-charybdis-4.1.2/ircd/s_conf.c --- old/charybdis-charybdis-4.1.1/ircd/s_conf.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/ircd/s_conf.c 2019-08-31 22:12:44.000000000 +0200 @@ -707,7 +707,6 @@ 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; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/ircd/s_newconf.c new/charybdis-charybdis-4.1.2/ircd/s_newconf.c --- old/charybdis-charybdis-4.1.1/ircd/s_newconf.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/ircd/s_newconf.c 2019-08-31 22:12:44.000000000 +0200 @@ -387,14 +387,14 @@ if(aftype == AF_INET) { if(status == 1) - rb_inet_pton_sock(result, (struct sockaddr *)&server_p->connect4); + rb_inet_pton_sock(result, &server_p->connect4); server_p->dns_query_connect4 = 0; } else if(aftype == AF_INET6) { if(status == 1) - rb_inet_pton_sock(result, (struct sockaddr *)&server_p->connect6); + rb_inet_pton_sock(result, &server_p->connect6); server_p->dns_query_connect6 = 0; } @@ -418,14 +418,14 @@ if(aftype == AF_INET) { if(status == 1) - rb_inet_pton_sock(result, (struct sockaddr *)&server_p->bind4); + rb_inet_pton_sock(result, &server_p->bind4); server_p->dns_query_bind4 = 0; } else if(aftype == AF_INET6) { if(status == 1) - rb_inet_pton_sock(result, (struct sockaddr *)&server_p->bind6); + rb_inet_pton_sock(result, &server_p->bind6); server_p->dns_query_bind6 = 0; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/ircd/s_serv.c new/charybdis-charybdis-4.1.2/ircd/s_serv.c --- old/charybdis-charybdis-4.1.1/ircd/s_serv.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/ircd/s_serv.c 2019-08-31 22:12:44.000000000 +0200 @@ -372,7 +372,7 @@ name_matched = true; - if(rb_inet_pton_sock(client_p->sockhost, (struct sockaddr *)&client_addr) <= 0) + if(rb_inet_pton_sock(client_p->sockhost, &client_addr) <= 0) SET_SS_FAMILY(&client_addr, AF_UNSPEC); if((tmp_p->connect_host && match(tmp_p->connect_host, client_p->host)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/ircd/s_user.c new/charybdis-charybdis-4.1.2/ircd/s_user.c --- old/charybdis-charybdis-4.1.1/ircd/s_user.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/ircd/s_user.c 2019-08-31 22:12:44.000000000 +0200 @@ -1484,14 +1484,17 @@ if (user_modes[i] == 0) { orphaned_umodes |= prev_user_modes[i]; - user_modes[i] = prev_user_modes[i]; + sendto_realops_snomask(SNO_DEBUG, L_ALL, "Umode +%c is now orphaned", i); } else + { orphaned_umodes &= ~prev_user_modes[i]; + sendto_realops_snomask(SNO_DEBUG, L_ALL, "Orphaned umode +%c is picked up by module", i); + } + user_modes[i] = prev_user_modes[i]; } else prev_user_modes[i] = user_modes[i]; - if (user_modes[i]) *ptr++ = (char) i; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/librb/include/rb_commio.h new/charybdis-charybdis-4.1.2/librb/include/rb_commio.h --- old/charybdis-charybdis-4.1.1/librb/include/rb_commio.h 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/librb/include/rb_commio.h 2019-08-31 22:12:44.000000000 +0200 @@ -152,7 +152,7 @@ const char *rb_inet_ntop(int af, const void *src, char *dst, unsigned int size); int rb_inet_pton(int af, const char *src, void *dst); const char *rb_inet_ntop_sock(struct sockaddr *src, char *dst, unsigned int size); -int rb_inet_pton_sock(const char *src, struct sockaddr *dst); +int rb_inet_pton_sock(const char *src, struct sockaddr_storage *dst); int rb_getmaxconnect(void); int rb_ignore_errno(int); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/librb/src/commio.c new/charybdis-charybdis-4.1.2/librb/src/commio.c --- old/charybdis-charybdis-4.1.1/librb/src/commio.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/librb/src/commio.c 2019-08-31 22:12:44.000000000 +0200 @@ -1584,7 +1584,7 @@ } int -rb_inet_pton_sock(const char *src, struct sockaddr *dst) +rb_inet_pton_sock(const char *src, struct sockaddr_storage *dst) { memset(dst, 0, sizeof(*dst)); if(rb_inet_pton(AF_INET, src, &((struct sockaddr_in *)dst)->sin_addr)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/modules/cap_server_time.c new/charybdis-charybdis-4.1.2/modules/cap_server_time.c --- old/charybdis-charybdis-4.1.1/modules/cap_server_time.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/modules/cap_server_time.c 2019-08-31 22:12:44.000000000 +0200 @@ -57,7 +57,7 @@ struct timeval tv; if (!rb_gettimeofday(&tv, NULL)) { - if (strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S.", gmtime(&tv.tv_sec)) < 0) + if (strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S.", gmtime(&tv.tv_sec)) == 0) return; if (rb_snprintf_append(buf, sizeof(buf), "%03uZ", (int)tv.tv_usec / 1000) < 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/modules/core/m_ban.c new/charybdis-charybdis-4.1.2/modules/core/m_ban.c --- old/charybdis-charybdis-4.1.1/modules/core/m_ban.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/modules/core/m_ban.c 2019-08-31 22:12:44.000000000 +0200 @@ -286,20 +286,7 @@ else { add_conf_by_address(aconf->host, CONF_KILL, aconf->user, NULL, aconf); - if(ConfigFileEntry.kline_delay || - (IsServer(source_p) && - !HasSentEob(source_p))) - { - if(kline_queued == 0) - { - rb_event_addonce("check_klines", check_klines_event, NULL, - ConfigFileEntry.kline_delay ? - ConfigFileEntry.kline_delay : 1); - kline_queued = 1; - } - } - else - check_klines(); + check_one_kline(aconf); } break; case CONF_XLINE: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/modules/m_info.c new/charybdis-charybdis-4.1.2/modules/m_info.c --- old/charybdis-charybdis-4.1.1/modules/m_info.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/modules/m_info.c 2019-08-31 22:12:44.000000000 +0200 @@ -285,12 +285,6 @@ "Hide IPs of spoofed users" }, { - "kline_delay", - OUTPUT_DECIMAL, - &ConfigFileEntry.kline_delay, - "Duration of time to delay kline checking" - }, - { "kline_reason", OUTPUT_STRING, &ConfigFileEntry.kline_reason, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/modules/m_kline.c new/charybdis-charybdis-4.1.2/modules/m_kline.c --- old/charybdis-charybdis-4.1.1/modules/m_kline.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/modules/m_kline.c 2019-08-31 22:12:44.000000000 +0200 @@ -85,6 +85,7 @@ static bool remove_temp_kline(struct Client *, struct ConfItem *); static void remove_prop_kline(struct Client *, struct ConfItem *); + /* mo_kline() * * parv[1] - temp time or user@host @@ -215,17 +216,7 @@ else apply_kline(source_p, aconf, reason, oper_reason); - if(ConfigFileEntry.kline_delay) - { - if(!kline_queued) - { - rb_event_addonce("check_klines", check_klines_event, NULL, - ConfigFileEntry.kline_delay); - kline_queued = true; - } - } - else - check_klines(); + check_one_kline(aconf); } /* ms_kline() @@ -325,17 +316,7 @@ else apply_kline(source_p, aconf, reason, oper_reason); - if(ConfigFileEntry.kline_delay) - { - if(!kline_queued) - { - rb_event_addonce("check_klines", check_klines_event, NULL, - ConfigFileEntry.kline_delay); - kline_queued = true; - } - } - else - check_klines(); + check_one_kline(aconf); } /* mo_unkline() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/modules/m_sasl.c new/charybdis-charybdis-4.1.2/modules/m_sasl.c --- old/charybdis-charybdis-4.1.1/modules/m_sasl.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/modules/m_sasl.c 2019-08-31 22:12:44.000000000 +0200 @@ -235,6 +235,7 @@ int parc, const char *parv[]) { struct Client *target_p, *agent_p; + bool in_progress; /* Let propagate if not addressed to us, or if broadcast. * Only SASL agents can answer global requests. @@ -257,22 +258,29 @@ if(!IsService(agent_p)) return; + /* If SASL has been aborted, we only want to track authentication failures. */ + in_progress = target_p->localClient->sasl_out != 0; + /* Reject if someone has already answered. */ if(*target_p->localClient->sasl_agent && strncmp(parv[1], target_p->localClient->sasl_agent, IDLEN)) return; - else if(!*target_p->localClient->sasl_agent) + else if(!*target_p->localClient->sasl_agent && in_progress) rb_strlcpy(target_p->localClient->sasl_agent, parv[1], IDLEN); if(*parv[3] == 'C') { - sendto_one(target_p, "AUTHENTICATE %s", parv[4]); - target_p->localClient->sasl_messages++; + if (in_progress) { + sendto_one(target_p, "AUTHENTICATE %s", parv[4]); + target_p->localClient->sasl_messages++; + } } else if(*parv[3] == 'D') { if(*parv[4] == 'F') { - sendto_one(target_p, form_str(ERR_SASLFAIL), me.name, EmptyString(target_p->name) ? "*" : target_p->name); + if (in_progress) { + sendto_one(target_p, form_str(ERR_SASLFAIL), me.name, EmptyString(target_p->name) ? "*" : target_p->name); + } /* Failures with zero messages are just "unknown mechanism" errors; don't count those. */ if(target_p->localClient->sasl_messages > 0) { @@ -294,16 +302,22 @@ } else if(*parv[4] == 'S') { - sendto_one(target_p, form_str(RPL_SASLSUCCESS), me.name, EmptyString(target_p->name) ? "*" : target_p->name); - target_p->localClient->sasl_failures = 0; - target_p->localClient->sasl_complete = 1; - ServerStats.is_ssuc++; + if (in_progress) { + sendto_one(target_p, form_str(RPL_SASLSUCCESS), me.name, EmptyString(target_p->name) ? "*" : target_p->name); + target_p->localClient->sasl_failures = 0; + target_p->localClient->sasl_complete = 1; + ServerStats.is_ssuc++; + } } *target_p->localClient->sasl_agent = '\0'; /* Blank the stored agent so someone else can answer */ target_p->localClient->sasl_messages = 0; } else if(*parv[3] == 'M') - sendto_one(target_p, form_str(RPL_SASLMECHS), me.name, EmptyString(target_p->name) ? "*" : target_p->name, parv[4]); + { + if (in_progress) { + sendto_one(target_p, form_str(RPL_SASLMECHS), me.name, EmptyString(target_p->name) ? "*" : target_p->name, parv[4]); + } + } } static void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/Makefile.am new/charybdis-charybdis-4.1.2/tests/Makefile.am --- old/charybdis-charybdis-4.1.1/tests/Makefile.am 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/tests/Makefile.am 2019-08-31 22:12:44.000000000 +0200 @@ -4,6 +4,7 @@ rb_dictionary1 \ rb_snprintf_append1 \ rb_snprintf_try_append1 \ + sasl_abort1 \ send1 \ serv_connect1 \ substitution1 @@ -26,6 +27,7 @@ rb_dictionary1_SOURCES = rb_dictionary1.c rb_snprintf_append1_SOURCES = rb_snprintf_append1.c rb_snprintf_try_append1_SOURCES = rb_snprintf_try_append1.c +sasl_abort1_SOURCES = sasl_abort1.c ircd_util.c client_util.c send1_SOURCES = send1.c ircd_util.c client_util.c serv_connect1_SOURCES = serv_connect1.c ircd_util.c client_util.c substitution1_SOURCES = substitution1.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/TESTS new/charybdis-charybdis-4.1.2/tests/TESTS --- old/charybdis-charybdis-4.1.1/tests/TESTS 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/tests/TESTS 2019-08-31 22:12:44.000000000 +0200 @@ -3,6 +3,7 @@ rb_dictionary1 rb_snprintf_append1 rb_snprintf_try_append1 +sasl_abort1 send1 serv_connect1 substitution1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/client_util.c new/charybdis-charybdis-4.1.2/tests/client_util.c --- old/charybdis-charybdis-4.1.1/tests/client_util.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/tests/client_util.c 2019-08-31 22:12:44.000000000 +0200 @@ -27,9 +27,42 @@ #include "hash.h" #include "s_newconf.h" +#include "parse.h" +#include "listener.h" #define MSG "%s:%d (%s)", __FILE__, __LINE__, __FUNCTION__ +static struct Listener fake_listener = { + .next = NULL, + .name = "fake", + .F = NULL, + .ref_count = 0, + .active = 1, + .ssl = 1, + .defer_accept = 0, + .sctp = false, + .wsock = 0, + .addr = { + { .ss_family = AF_INET6 }, + { .ss_family = AF_INET6 }, + }, + .vhost = { "fake" }, +}; + +struct Client *make_local_unknown(void) +{ + struct Client *client; + + client = make_client(NULL); + rb_dlinkMoveNode(&client->localClient->tnode, &unknown_list, &lclient_list); + client->servptr = &me; + rb_dlinkAdd(client, &client->lnode, &client->servptr->serv->users); + client->localClient->listener = &fake_listener; + client->preClient->auth.accepted = true; + + return client; +} + struct Client *make_local_person(void) { return make_local_person_nick(TEST_NICK); @@ -44,14 +77,11 @@ { struct Client *client; - client = make_client(NULL); - rb_dlinkMoveNode(&client->localClient->tnode, &unknown_list, &lclient_list); - client->servptr = &me; - rb_dlinkAdd(client, &client->lnode, &client->servptr->serv->users); + client = make_local_unknown(); make_user(client); SetClient(client); - rb_inet_pton_sock(ip, (struct sockaddr *)&client->localClient->ip); + rb_inet_pton_sock(ip, &client->localClient->ip); rb_strlcpy(client->name, nick, sizeof(client->name)); rb_strlcpy(client->username, username, sizeof(client->username)); rb_strlcpy(client->host, hostname, sizeof(client->host)); @@ -124,7 +154,7 @@ struct Client *make_remote_person_full(struct Client *server, const char *nick, const char *username, const char *hostname, const char *ip, const char *realname) { struct Client *client; - struct sockaddr addr; + struct sockaddr_storage addr; client = make_client(server); make_user(client); @@ -137,7 +167,7 @@ rb_strlcpy(client->name, nick, sizeof(client->name)); rb_strlcpy(client->username, username, sizeof(client->username)); rb_strlcpy(client->host, hostname, sizeof(client->host)); - rb_inet_ntop_sock(&addr, client->sockhost, sizeof(client->sockhost)); + rb_inet_ntop_sock((struct sockaddr *)&addr, client->sockhost, sizeof(client->sockhost)); rb_strlcpy(client->info, realname, sizeof(client->info)); add_to_client_hash(nick, client); @@ -187,6 +217,15 @@ return ""; } +void client_util_parse(struct Client *client, const char *message) +{ + char *copy = rb_strdup(message); + + parse(client, copy, copy+strlen(copy)); + + rb_free(copy); +} + void client_util_init(void) { } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/client_util.h new/charybdis-charybdis-4.1.2/tests/client_util.h --- old/charybdis-charybdis-4.1.1/tests/client_util.h 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/tests/client_util.h 2019-08-31 22:12:44.000000000 +0200 @@ -63,6 +63,7 @@ void client_util_init(void); void client_util_free(void); +struct Client *make_local_unknown(void); struct Client *make_local_person(void); struct Client *make_local_person_nick(const char *nick); struct Client *make_local_person_full(const char *nick, const char *username, const char *hostname, const char *ip, const char *realname); @@ -83,11 +84,17 @@ char *get_client_sendq(const struct Client *client); +void client_util_parse(struct Client *client, const char *message); + #define is_client_sendq_empty(client, message, ...) do { \ is_string("", get_client_sendq(client), message, ##__VA_ARGS__); \ } while (0) -#define is_client_sendq(queue, client, message, ...) do { \ +#define is_client_sendq_one(queue, client, message, ...) do { \ is_string(queue, get_client_sendq(client), message, ##__VA_ARGS__); \ + } while (0) + +#define is_client_sendq(queue, client, message, ...) do { \ + is_client_sendq_one(queue, client, message, ##__VA_ARGS__); \ is_client_sendq_empty(client, message, ##__VA_ARGS__); \ } while (0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/ircd_util.c new/charybdis-charybdis-4.1.2/tests/ircd_util.c --- old/charybdis-charybdis-4.1.1/tests/ircd_util.c 2018-08-16 00:03:50.000000000 +0200 +++ new/charybdis-charybdis-4.1.2/tests/ircd_util.c 2019-08-31 22:12:44.000000000 +0200 @@ -100,10 +100,13 @@ void ircd_util_reload_module(const char *name) { struct module *mod = findmodule_byname(name); + int origin, core; if (ok(mod != NULL, MSG)) { + origin = mod->origin; + core = mod->core; if (ok(unload_one_module(name, false), MSG)) { - ok(load_one_module(name, mod->origin, mod->core), MSG); + ok(load_one_module(name, origin, core), MSG); } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/ip_cloaking.so new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/ip_cloaking.so --- old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/ip_cloaking.so 2019-09-30 16:00:12.961086158 +0200 +++ new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/ip_cloaking.so 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to ../../../../extensions/.libs/ip_cloaking.so diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/ip_cloaking_3.0.so new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/ip_cloaking_3.0.so --- old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/ip_cloaking_3.0.so 2019-09-30 16:00:12.965086148 +0200 +++ new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/ip_cloaking_3.0.so 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to ../../../../extensions/.libs/ip_cloaking_3.0.so diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/ip_cloaking_4.0.so new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/ip_cloaking_4.0.so --- old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/ip_cloaking_4.0.so 2019-09-30 16:00:13.081085838 +0200 +++ new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/ip_cloaking_4.0.so 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to ../../../../extensions/.libs/ip_cloaking_4.0.so diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/ip_cloaking_old.so new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/ip_cloaking_old.so --- old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/ip_cloaking_old.so 2019-09-30 16:00:12.981086104 +0200 +++ new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/ip_cloaking_old.so 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to ../../../../extensions/.libs/ip_cloaking_old.so diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/m_42.so new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/m_42.so --- old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/m_42.so 2019-09-30 16:00:12.837086488 +0200 +++ new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/m_42.so 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to ../../../../extensions/.libs/m_42.so diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/m_crash.so new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/m_crash.so --- old/charybdis-charybdis-4.1.1/tests/runtime/modules/autoload/m_crash.so 2019-09-30 16:00:13.021085998 +0200 +++ new/charybdis-charybdis-4.1.2/tests/runtime/modules/autoload/m_crash.so 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -symbolic link to ../../../../modules/.libs/m_crash.so diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/sasl_abort1.c new/charybdis-charybdis-4.1.2/tests/sasl_abort1.c --- old/charybdis-charybdis-4.1.1/tests/sasl_abort1.c 1970-01-01 01:00:00.000000000 +0100 +++ new/charybdis-charybdis-4.1.2/tests/sasl_abort1.c 2019-08-31 22:12:44.000000000 +0200 @@ -0,0 +1,153 @@ +/* + * sasl_abort1.c: Test SASL abort from the ircd to services + * Copyright 2019 Simon Arlott + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + */ +#define _GNU_SOURCE +#include <dlfcn.h> +#include <errno.h> +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include "tap/basic.h" + +#include "ircd_util.h" +#include "client_util.h" + +#include "s_serv.h" +#include "s_conf.h" +#include "s_newconf.h" +#include "hash.h" + +#define MSG "%s:%d (%s; aborted=%d, by_user=%d)", __FILE__, __LINE__, __FUNCTION__, aborted, by_user + +static void common_sasl_test(bool aborted, bool by_user) +{ + ircd_util_init(__FILE__); + client_util_init(); + + struct Client *user = make_local_unknown(); + struct Client *server = make_remote_server(&me); + struct Client *remote = make_remote_person(server); + + rb_inet_pton_sock(TEST_IP, &user->localClient->ip); + rb_strlcpy(user->host, TEST_HOSTNAME, sizeof(user->host)); + rb_inet_ntop_sock((struct sockaddr *)&user->localClient->ip, user->sockhost, sizeof(user->sockhost)); + + strcpy(server->id, TEST_SERVER_ID); + strcpy(remote->id, TEST_REMOTE_ID); + add_to_id_hash(remote->id, remote); + server->localClient->caps = CAP_ENCAP | CAP_TS6; + remote->umodes |= UMODE_SERVICE; + + client_util_parse(user, "CAP LS 302" CRLF); + const char *line; + while ((line = get_client_sendq(user)) && strcmp(line, "")) { + printf("%s", line); + } + + client_util_parse(user, "NICK " TEST_NICK CRLF); + client_util_parse(user, "USER " TEST_USERNAME " 0 0 :" TEST_REALNAME CRLF); + is_client_sendq_empty(user, MSG); + + user->tsinfo = 42; + + client_util_parse(user, "CAP REQ :sasl" CRLF); + is_client_sendq(":" TEST_ME_NAME " CAP " TEST_NICK " ACK :sasl" CRLF, user, MSG); + + client_util_parse(user, "AUTHENTICATE EXTERNAL" CRLF); + is_client_sendq_empty(user, MSG); + + is_client_sendq_one(":" TEST_ME_ID " ENCAP " TEST_SERVER_NAME " SASL " TEST_ME_ID "AAAAAB " TEST_REMOTE_ID " H " TEST_HOSTNAME " " TEST_IP " P" CRLF, server, MSG); + is_client_sendq_one(":" TEST_ME_ID " ENCAP " TEST_SERVER_NAME " SASL " TEST_ME_ID "AAAAAB " TEST_REMOTE_ID " S EXTERNAL" CRLF, server, MSG); + is_client_sendq_empty(server, MSG); + + if (aborted) { + if (by_user) { + // Explicit abort by user + client_util_parse(user, "AUTHENTICATE *" CRLF); + is_client_sendq(":" TEST_ME_NAME " 906 " TEST_NICK " :SASL authentication aborted" CRLF, user, MSG); + + client_util_parse(user, "CAP END" CRLF); + ok(IsClient(user), MSG); + } else { + // Implicit abort by completing registration + client_util_parse(user, "CAP END" CRLF); + ok(IsClient(user), MSG); + is_client_sendq_one(":" TEST_ME_NAME " 906 " TEST_NICK " :SASL authentication aborted" CRLF, user, MSG); + } + + is_client_sendq_one(":" TEST_ME_ID " ENCAP " TEST_SERVER_NAME " SASL " TEST_ME_ID "AAAAAB " TEST_REMOTE_ID " D A" CRLF, server, MSG); + is_client_sendq(":" TEST_ME_ID " UID " TEST_NICK " 1 42 +i ~" TEST_USERNAME " " TEST_HOSTNAME " " TEST_IP " " TEST_ME_ID "AAAAAB :" TEST_REALNAME CRLF, server, MSG); + } else { + // Return a successful auth + client_util_parse(server, ":" TEST_SERVER_NAME " ENCAP " TEST_ME_NAME " SASL " TEST_REMOTE_ID " " TEST_ME_ID "AAAAAB D S" CRLF); + + // User should be authenticated + is_client_sendq_one(":" TEST_ME_NAME " 903 " TEST_NICK " :SASL authentication successful" CRLF, user, MSG); + + client_util_parse(user, "CAP END" CRLF); + ok(IsClient(user), MSG); + } + + is_client_sendq_one(":" TEST_ME_NAME " 001 " TEST_NICK " :Welcome to the Test Internet Relay Chat Network " TEST_NICK CRLF, user, MSG); + while ((line = get_client_sendq(user)) && strcmp(line, "")) { + printf("%s", line); + } + + if (aborted) { + // Return a successful auth after auth was aborted + client_util_parse(server, ":" TEST_SERVER_NAME " ENCAP " TEST_ME_NAME " SASL " TEST_REMOTE_ID " " TEST_ME_ID "AAAAAB D S" CRLF); + + // User should not be authenticated + is_client_sendq_empty(user, MSG); + } + + remove_local_person(user); + remove_remote_person(remote); + remove_remote_server(server); + + client_util_free(); + ircd_util_free(); +} + +static void successful_login(void) +{ + common_sasl_test(false, false); +} + +static void successful_login_after_aborted_by_registration(void) +{ + common_sasl_test(true, false); +} + +static void successful_login_after_aborted_by_user(void) +{ + common_sasl_test(true, true); +} + +int main(int argc, char *argv[]) +{ + plan_lazy(); + + successful_login(); + successful_login_after_aborted_by_registration(); + successful_login_after_aborted_by_user(); + + return 0; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/charybdis-charybdis-4.1.1/tests/sasl_abort1.conf new/charybdis-charybdis-4.1.2/tests/sasl_abort1.conf --- old/charybdis-charybdis-4.1.1/tests/sasl_abort1.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/charybdis-charybdis-4.1.2/tests/sasl_abort1.conf 2019-08-31 22:12:44.000000000 +0200 @@ -0,0 +1,44 @@ +serverinfo { + sid = "0AA"; + name = "me.test"; + description = "Test server"; + network_name = "Test network"; +}; + + +class "default" { + ping_time = 1000 minutes; + connectfreq = 1000 minutes; + number_per_ident = 1000; + number_per_ip = 1000; + number_per_ip_global = 1000; + cidr_ipv4_bitlen = 24; + cidr_ipv6_bitlen = 64; + number_per_cidr = 1000; + max_number = 1000; + sendq = 4 megabytes; +}; + +connect "remote.test" { + host = "::1"; + fingerprint = "test"; + class = "default"; +}; + +service { + name = "remote.test"; +}; + +privset "admin" { + privs = oper:admin; +}; + +auth { + user = "*@*"; + class = "default"; +}; + +general { + sasl_service = "remote_test"; + ping_cookie = no; +};
participants (1)
-
root