From 443acdf4e0e5fe79f0428b05d3fb74ff370472c5 Mon Sep 17 00:00:00 2001 From: Valery Yatsko Date: Sun, 20 Apr 2008 11:15:07 +0400 Subject: [PATCH 01/15] Patch for remote dlines support - test needed --- patches/remote-dlines.diff | 483 +++++++++++++++++++++++++++++++++++++ 1 file changed, 483 insertions(+) create mode 100644 patches/remote-dlines.diff diff --git a/patches/remote-dlines.diff b/patches/remote-dlines.diff new file mode 100644 index 0000000..7457f49 --- /dev/null +++ b/patches/remote-dlines.diff @@ -0,0 +1,483 @@ +diff -r a9a4e710ca64 include/s_newconf.h +--- a/include/s_newconf.h Sun Apr 20 01:03:54 2008 -0500 ++++ b/include/s_newconf.h Sun Apr 20 11:13:46 2008 +0400 +@@ -95,10 +95,14 @@ + #define SHARED_PRESV 0x0100 + #define SHARED_UNRESV 0x0200 + #define SHARED_REHASH 0x0400 ++#define SHARED_TDLINE 0x0800 ++#define SHARED_PDLINE 0x1000 ++#define SHARED_UNDLINE 0x2000 + + #define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\ + SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\ +- SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV) ++ SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV |\ ++ SHARED_TDLINE | SHARED_PDLINE | SHARED_UNDLINE) + #define CLUSTER_ALL (SHARED_ALL | SHARED_LOCOPS) + + /* flags used in hub/leaf */ +diff -r a9a4e710ca64 modules/m_dline.c +--- a/modules/m_dline.c Sun Apr 20 01:03:54 2008 -0500 ++++ b/modules/m_dline.c Sun Apr 20 11:13:46 2008 +0400 +@@ -44,15 +44,17 @@ + #include "modules.h" + + static int mo_dline(struct Client *, struct Client *, int, const char **); ++static int me_dline(struct Client *, struct Client *, int, const char **); + static int mo_undline(struct Client *, struct Client *, int, const char **); ++static int me_undline(struct Client *, struct Client *, int, const char **); + + struct Message dline_msgtab = { + "DLINE", 0, 0, 0, MFLG_SLOW, +- {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_dline, 2}} ++ {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_dline, 3}, {mo_dline, 2}} + }; + struct Message undline_msgtab = { + "UNDLINE", 0, 0, 0, MFLG_SLOW, +- {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_undline, 2}} ++ {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_undline, 1}, {mo_undline, 2}} + }; + + mapi_clist_av1 dline_clist[] = { &dline_msgtab, &undline_msgtab, NULL }; +@@ -61,6 +63,8 @@ + static int valid_comment(char *comment); + static int flush_write(struct Client *, FILE *, char *, char *); + static int remove_temp_dline(struct ConfItem *); ++static int apply_dline(struct Client *, const char *, int, char *); ++static int apply_undline(struct Client *, const char *); + + /* mo_dline() + * +@@ -73,15 +77,10 @@ + { + char def[] = "No Reason"; + const char *dlhost; +- char *oper_reason; + char *reason = def; +- struct rb_sockaddr_storage daddr; + char cidr_form_host[HOSTLEN + 1]; +- struct ConfItem *aconf; +- int bits; +- char dlbuffer[IRCD_BUFSIZE]; +- const char *current_date; + int tdline_time = 0; ++ const char *target_server = NULL; + int loc = 1; + + if(!IsOperK(source_p)) +@@ -94,72 +93,178 @@ + if((tdline_time = valid_temp_time(parv[loc])) >= 0) + loc++; + +- if(parc < loc + 1) +- { +- sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), +- me.name, source_p->name, "DLINE"); +- return 0; +- } +- + dlhost = parv[loc]; + rb_strlcpy(cidr_form_host, dlhost, sizeof(cidr_form_host)); + +- if(!parse_netmask(dlhost, NULL, &bits)) ++ loc++; ++ ++ if(parc >= loc+2 && !irccmp(parv[loc], "ON")) ++ { ++ target_server = parv[loc+1]; ++ loc += 2; ++ } ++ ++ if(parc >= loc + 1 && !EmptyString(parv[loc])) ++ reason = LOCAL_COPY(parv[loc]); ++ ++ if(target_server != NULL) ++ { ++ sendto_match_servs(source_p, target_server, ++ CAP_ENCAP, NOCAPS, ++ "ENCAP %s DLINE %d %s :%s", ++ target_server, tdline_time, dlhost, reason); ++ ++ if(!match(target_server, me.name)) ++ return 0; ++ } ++ ++ apply_dline(source_p, dlhost, tdline_time, reason); ++ ++ check_dlines(); ++ return 0; ++} ++ ++/* mo_undline() ++ * ++ * parv[1] = dline to remove ++ */ ++static int ++mo_undline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ++{ ++ const char *cidr; ++ const char *target_server = NULL; ++ ++ if(!IsOperK(source_p)) ++ { ++ sendto_one(source_p, form_str(ERR_NOPRIVS), ++ me.name, source_p->name, "unkline"); ++ return 0; ++ } ++ ++ cidr = parv[1]; ++ ++ if(parc >= 4 && !irccmp(parv[2], "ON")) ++ { ++ target_server = parv[3]; ++ sendto_match_servs(source_p, target_server, ++ CAP_ENCAP, NOCAPS, ++ "ENCAP %s UNDLINE %s", ++ target_server, cidr); ++ ++ if(!match(target_server, me.name)) ++ return 0; ++ } ++ ++ apply_undline(source_p, cidr); ++ ++ return 0; ++} ++ ++static int ++me_dline(struct Client *client_p, struct Client *source_p, int parc, const char **parv) ++{ ++ int tdline_time = atoi(parv[1]); ++ /* Since this is coming over a server link, assume that the originating ++ * server did the relevant permission/sanity checks... ++ */ ++ ++ if(!IsPerson(source_p)) ++ return 0; ++ ++ if(!find_shared_conf(source_p->username, source_p->host, ++ source_p->servptr->name, tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE)) ++ { ++ sendto_realops_snomask(SNO_DEBUG, L_NETWIDE, "undline failed %s %s %s", ++ source_p->name, parv[1], parv[2]); ++ return 0; ++ } ++ ++ apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3])); ++ ++ check_dlines(); ++ return 0; ++} ++ ++static int ++me_undline(struct Client *client_p, struct Client *source_p, int parc, const char **parv) ++{ ++ if(!IsPerson(source_p)) ++ return 0; ++ ++ if(!find_shared_conf(source_p->username, source_p->host, ++ source_p->servptr->name, SHARED_UNDLINE)) ++ return 0; ++ ++ apply_undline(source_p, parv[1]); ++ ++ return 0; ++} ++ ++static int ++apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *reason) ++{ ++ struct ConfItem *aconf; ++ char *oper_reason; ++ char dlbuffer[IRCD_BUFSIZE]; ++ const char *current_date; ++ struct rb_sockaddr_storage daddr; ++ int t = AF_INET, ty, b; ++ const char *creason; ++ ++ ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b); ++ if(ty == HM_HOST) + { + sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line", + me.name, source_p->name); + return 0; + } ++#ifdef RB_IPV6 ++ if(ty == HM_IPV6) ++ t = AF_INET6; ++ else ++#endif ++ t = AF_INET; + +- loc++; +- +- if(parc >= loc + 1) /* host :reason */ +- { +- if(!EmptyString(parv[loc])) +- reason = LOCAL_COPY(parv[loc]); +- +- if(!valid_comment(reason)) +- { +- sendto_one(source_p, +- ":%s NOTICE %s :Invalid character '\"' in comment", +- me.name, source_p->name); +- return 0; +- } +- } +- ++ /* This means dlines wider than /16 cannot be set remotely */ + if(IsOperAdmin(source_p)) + { +- if(bits < 8) ++ if(b < 8) + { +- sendto_one(source_p, +- ":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.", +- me.name, parv[0]); ++ sendto_one_notice(source_p, ++ ":For safety, bitmasks less than 8 require conf access."); + return 0; + } + } + else + { +- if(bits < 16) ++ if(b < 16) + { +- sendto_one(source_p, +- ":%s NOTICE %s :Dline bitmasks less than 16 are for admins only.", +- me.name, parv[0]); ++ sendto_one_notice(source_p, ++ ":Dline bitmasks less than 16 are for admins only."); + return 0; + } + } + ++ if(!valid_comment(reason)) ++ { ++ sendto_one(source_p, ++ ":%s NOTICE %s :Invalid character '\"' in comment", ++ me.name, source_p->name); ++ return 0; ++ } ++ ++ /* Look for an oper reason */ ++ if((oper_reason = strchr(reason, '|')) != NULL) ++ { ++ *oper_reason = '\0'; ++ oper_reason++; ++ ++ if(!EmptyString(oper_reason)) ++ aconf->spasswd = rb_strdup(oper_reason); ++ } ++ + if(ConfigFileEntry.non_redundant_klines) + { +- const char *creason; +- int t = AF_INET, ty, b; +- ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b); +-#ifdef RB_IPV6 +- if(ty == HM_IPV6) +- t = AF_INET6; +- else +-#endif +- t = AF_INET; +- + if((aconf = find_dline((struct sockaddr *)&daddr, t)) != NULL) + { + int bx; +@@ -170,11 +275,11 @@ + if(IsConfExemptKline(aconf)) + sendto_one(source_p, + ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s", +- me.name, parv[0], dlhost, aconf->host, creason); ++ me.name, source_p->name, dlhost, aconf->host, creason); + else + sendto_one(source_p, + ":%s NOTICE %s :[%s] already D-lined by [%s] - %s", +- me.name, parv[0], dlhost, aconf->host, creason); ++ me.name, source_p->name, dlhost, aconf->host, creason); + return 0; + } + } +@@ -187,16 +292,6 @@ + aconf->status = CONF_DLINE; + aconf->host = rb_strdup(dlhost); + +- /* Look for an oper reason */ +- if((oper_reason = strchr(reason, '|')) != NULL) +- { +- *oper_reason = '\0'; +- oper_reason++; +- +- if(!EmptyString(oper_reason)) +- aconf->spasswd = rb_strdup(oper_reason); +- } +- + if(tdline_time > 0) + { + rb_snprintf(dlbuffer, sizeof(dlbuffer), +@@ -208,7 +303,7 @@ + + if(EmptyString(oper_reason)) + { +- sendto_realops_snomask(SNO_GENERAL, L_ALL, ++ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, + "%s added temporary %d min. D-Line for [%s] [%s]", + get_oper_name(source_p), tdline_time / 60, + aconf->host, reason); +@@ -218,7 +313,7 @@ + } + else + { +- sendto_realops_snomask(SNO_GENERAL, L_ALL, ++ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, + "%s added temporary %d min. D-Line for [%s] [%s|%s]", + get_oper_name(source_p), tdline_time / 60, + aconf->host, reason, oper_reason); +@@ -239,42 +334,27 @@ + oper_reason, current_date, 0); + } + +- check_dlines(); + return 0; + } + +-/* mo_undline() +- * +- * parv[1] = dline to remove +- */ + static int +-mo_undline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) ++apply_undline(struct Client *source_p, const char *cidr) + { + FILE *in; + FILE *out; + char buf[BUFSIZE], buff[BUFSIZE], temppath[BUFSIZE], *p; + const char *filename, *found_cidr; +- const char *cidr; +- struct ConfItem *aconf; + int pairme = NO, error_on_write = NO; + mode_t oldumask; +- +- rb_snprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile); +- +- if(!IsOperUnkline(source_p)) +- { +- sendto_one(source_p, form_str(ERR_NOPRIVS), +- me.name, source_p->name, "unkline"); +- return 0; +- } +- +- cidr = parv[1]; ++ struct ConfItem *aconf; + + if(parse_netmask(cidr, NULL, NULL) == HM_HOST) + { + sendto_one_notice(source_p, ":Invalid D-Line"); + return 0; + } ++ ++ rb_snprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile); + + aconf = find_exact_conf_by_address(cidr, CONF_DLINE, NULL); + if(aconf == NULL) +@@ -288,7 +368,7 @@ + { + sendto_one(source_p, + ":%s NOTICE %s :Un-dlined [%s] from temporary D-lines", +- me.name, parv[0], buf); ++ me.name, source_p->name, buf); + sendto_realops_snomask(SNO_GENERAL, L_ALL, + "%s has removed the temporary D-Line for: [%s]", + get_oper_name(source_p), buf); +@@ -300,14 +380,14 @@ + + if((in = fopen(filename, "r")) == 0) + { +- sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], filename); ++ sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, source_p->name, filename); + return 0; + } + + oldumask = umask(0); + if((out = fopen(temppath, "w")) == 0) + { +- sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], temppath); ++ sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, source_p->name, temppath); + fclose(in); + umask(oldumask); + return 0; +@@ -336,7 +416,7 @@ + continue; + } + +- if(irccmp(found_cidr, aconf->host) == 0) ++ if(irccmp(found_cidr, cidr) == 0) + { + pairme++; + } +@@ -356,13 +436,13 @@ + { + sendto_one(source_p, + ":%s NOTICE %s :Couldn't write D-line file, aborted", +- me.name, parv[0]); ++ me.name, source_p->name); + return 0; + } + else if(!pairme) + { +- sendto_one_notice(source_p, ":Cannot find D-Line for %s in file", +- aconf->host); ++ sendto_one(source_p, ":%s NOTICE %s :No D-Line for %s", ++ me.name, source_p->name, cidr); + + if(temppath != NULL) + (void) unlink(temppath); +@@ -375,13 +455,13 @@ + sendto_one_notice(source_p, ":Couldn't rename temp file, aborted"); + return 0; + } ++ rehash_bans(0); + +- sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, parv[0], aconf->host); +- sendto_realops_snomask(SNO_GENERAL, L_ALL, +- "%s has removed the D-Line for: [%s]", get_oper_name(source_p), aconf->host); +- ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), aconf->host); + +- delete_one_address_conf(aconf->host, aconf); ++ sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, source_p->name, cidr); ++ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, ++ "%s has removed the D-Line for: [%s]", get_oper_name(source_p), cidr); ++ ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), cidr); + + return 0; + } +diff -r a9a4e710ca64 modules/m_stats.c +--- a/modules/m_stats.c Sun Apr 20 01:03:54 2008 -0500 ++++ b/modules/m_stats.c Sun Apr 20 11:13:46 2008 +0400 +@@ -951,6 +951,9 @@ + { SHARED_UNRESV, 'R' }, + { SHARED_LOCOPS, 'L' }, + { SHARED_REHASH, 'H' }, ++ { SHARED_TDLINE, 'd' }, ++ { SHARED_PDLINE, 'D' }, ++ { SHARED_UNDLINE, 'E' }, + { 0, '\0'} + }; + +diff -r a9a4e710ca64 src/newconf.c +--- a/src/newconf.c Sun Apr 20 01:03:54 2008 -0500 ++++ b/src/newconf.c Sun Apr 20 11:13:46 2008 +0400 +@@ -373,6 +373,10 @@ + { "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 }, From 45be325cd2a8fcedc7fe71adbe70208d0d16aec2 Mon Sep 17 00:00:00 2001 From: Valery Yatsko Date: Sun, 20 Apr 2008 11:26:37 +0400 Subject: [PATCH 02/15] Remote d:lines implementation (based on ircd-seven's r230 by spb, Stephen Bennett ) --- include/s_newconf.h | 6 +- modules/m_dline.c | 270 ++++++++++++++++++++++++++++---------------- modules/m_stats.c | 3 + src/newconf.c | 4 + 4 files changed, 187 insertions(+), 96 deletions(-) diff --git a/include/s_newconf.h b/include/s_newconf.h index 083a90c..9c6dbdb 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -95,10 +95,14 @@ struct remote_conf #define SHARED_PRESV 0x0100 #define SHARED_UNRESV 0x0200 #define SHARED_REHASH 0x0400 +#define SHARED_TDLINE 0x0800 +#define SHARED_PDLINE 0x1000 +#define SHARED_UNDLINE 0x2000 #define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\ SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\ - SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV) + SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV |\ + SHARED_TDLINE | SHARED_PDLINE | SHARED_UNDLINE) #define CLUSTER_ALL (SHARED_ALL | SHARED_LOCOPS) /* flags used in hub/leaf */ diff --git a/modules/m_dline.c b/modules/m_dline.c index 97e0aa6..13b0701 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -44,15 +44,17 @@ #include "modules.h" static int mo_dline(struct Client *, struct Client *, int, const char **); +static int me_dline(struct Client *, struct Client *, int, const char **); static int mo_undline(struct Client *, struct Client *, int, const char **); +static int me_undline(struct Client *, struct Client *, int, const char **); struct Message dline_msgtab = { "DLINE", 0, 0, 0, MFLG_SLOW, - {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_dline, 2}} + {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_dline, 3}, {mo_dline, 2}} }; struct Message undline_msgtab = { "UNDLINE", 0, 0, 0, MFLG_SLOW, - {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_undline, 2}} + {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_undline, 1}, {mo_undline, 2}} }; mapi_clist_av1 dline_clist[] = { &dline_msgtab, &undline_msgtab, NULL }; @@ -61,6 +63,8 @@ DECLARE_MODULE_AV1(dline, NULL, NULL, dline_clist, NULL, NULL, "$Revision: 3225 static int valid_comment(char *comment); static int flush_write(struct Client *, FILE *, char *, char *); static int remove_temp_dline(struct ConfItem *); +static int apply_dline(struct Client *, const char *, int, char *); +static int apply_undline(struct Client *, const char *); /* mo_dline() * @@ -73,15 +77,10 @@ mo_dline(struct Client *client_p, struct Client *source_p, { char def[] = "No Reason"; const char *dlhost; - char *oper_reason; char *reason = def; - struct rb_sockaddr_storage daddr; char cidr_form_host[HOSTLEN + 1]; - struct ConfItem *aconf; - int bits; - char dlbuffer[IRCD_BUFSIZE]; - const char *current_date; int tdline_time = 0; + const char *target_server = NULL; int loc = 1; if(!IsOperK(source_p)) @@ -94,72 +93,178 @@ mo_dline(struct Client *client_p, struct Client *source_p, if((tdline_time = valid_temp_time(parv[loc])) >= 0) loc++; - if(parc < loc + 1) - { - sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), - me.name, source_p->name, "DLINE"); - return 0; - } - dlhost = parv[loc]; rb_strlcpy(cidr_form_host, dlhost, sizeof(cidr_form_host)); - if(!parse_netmask(dlhost, NULL, &bits)) + loc++; + + if(parc >= loc+2 && !irccmp(parv[loc], "ON")) + { + target_server = parv[loc+1]; + loc += 2; + } + + if(parc >= loc + 1 && !EmptyString(parv[loc])) + reason = LOCAL_COPY(parv[loc]); + + if(target_server != NULL) + { + sendto_match_servs(source_p, target_server, + CAP_ENCAP, NOCAPS, + "ENCAP %s DLINE %d %s :%s", + target_server, tdline_time, dlhost, reason); + + if(!match(target_server, me.name)) + return 0; + } + + apply_dline(source_p, dlhost, tdline_time, reason); + + check_dlines(); + return 0; +} + +/* mo_undline() + * + * parv[1] = dline to remove + */ +static int +mo_undline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +{ + const char *cidr; + const char *target_server = NULL; + + if(!IsOperK(source_p)) + { + sendto_one(source_p, form_str(ERR_NOPRIVS), + me.name, source_p->name, "unkline"); + return 0; + } + + cidr = parv[1]; + + if(parc >= 4 && !irccmp(parv[2], "ON")) + { + target_server = parv[3]; + sendto_match_servs(source_p, target_server, + CAP_ENCAP, NOCAPS, + "ENCAP %s UNDLINE %s", + target_server, cidr); + + if(!match(target_server, me.name)) + return 0; + } + + apply_undline(source_p, cidr); + + return 0; +} + +static int +me_dline(struct Client *client_p, struct Client *source_p, int parc, const char **parv) +{ + int tdline_time = atoi(parv[1]); + /* Since this is coming over a server link, assume that the originating + * server did the relevant permission/sanity checks... + */ + + if(!IsPerson(source_p)) + return 0; + + if(!find_shared_conf(source_p->username, source_p->host, + source_p->servptr->name, tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE)) + { + sendto_realops_snomask(SNO_DEBUG, L_NETWIDE, "undline failed %s %s %s", + source_p->name, parv[1], parv[2]); + return 0; + } + + apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3])); + + check_dlines(); + return 0; +} + +static int +me_undline(struct Client *client_p, struct Client *source_p, int parc, const char **parv) +{ + if(!IsPerson(source_p)) + return 0; + + if(!find_shared_conf(source_p->username, source_p->host, + source_p->servptr->name, SHARED_UNDLINE)) + return 0; + + apply_undline(source_p, parv[1]); + + return 0; +} + +static int +apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *reason) +{ + struct ConfItem *aconf; + char *oper_reason; + char dlbuffer[IRCD_BUFSIZE]; + const char *current_date; + struct rb_sockaddr_storage daddr; + int t = AF_INET, ty, b; + const char *creason; + + ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b); + if(ty == HM_HOST) { sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line", me.name, source_p->name); return 0; } +#ifdef RB_IPV6 + if(ty == HM_IPV6) + t = AF_INET6; + else +#endif + t = AF_INET; - loc++; - - if(parc >= loc + 1) /* host :reason */ - { - if(!EmptyString(parv[loc])) - reason = LOCAL_COPY(parv[loc]); - - if(!valid_comment(reason)) - { - sendto_one(source_p, - ":%s NOTICE %s :Invalid character '\"' in comment", - me.name, source_p->name); - return 0; - } - } - + /* This means dlines wider than /16 cannot be set remotely */ if(IsOperAdmin(source_p)) { - if(bits < 8) + if(b < 8) { - sendto_one(source_p, - ":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.", - me.name, parv[0]); + sendto_one_notice(source_p, + ":For safety, bitmasks less than 8 require conf access."); return 0; } } else { - if(bits < 16) + if(b < 16) { - sendto_one(source_p, - ":%s NOTICE %s :Dline bitmasks less than 16 are for admins only.", - me.name, parv[0]); + sendto_one_notice(source_p, + ":Dline bitmasks less than 16 are for admins only."); return 0; } } + if(!valid_comment(reason)) + { + sendto_one(source_p, + ":%s NOTICE %s :Invalid character '\"' in comment", + me.name, source_p->name); + return 0; + } + + /* Look for an oper reason */ + if((oper_reason = strchr(reason, '|')) != NULL) + { + *oper_reason = '\0'; + oper_reason++; + + if(!EmptyString(oper_reason)) + aconf->spasswd = rb_strdup(oper_reason); + } + if(ConfigFileEntry.non_redundant_klines) { - const char *creason; - int t = AF_INET, ty, b; - ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b); -#ifdef RB_IPV6 - if(ty == HM_IPV6) - t = AF_INET6; - else -#endif - t = AF_INET; - if((aconf = find_dline((struct sockaddr *)&daddr, t)) != NULL) { int bx; @@ -170,11 +275,11 @@ mo_dline(struct Client *client_p, struct Client *source_p, if(IsConfExemptKline(aconf)) sendto_one(source_p, ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s", - me.name, parv[0], dlhost, aconf->host, creason); + me.name, source_p->name, dlhost, aconf->host, creason); else sendto_one(source_p, ":%s NOTICE %s :[%s] already D-lined by [%s] - %s", - me.name, parv[0], dlhost, aconf->host, creason); + me.name, source_p->name, dlhost, aconf->host, creason); return 0; } } @@ -187,16 +292,6 @@ mo_dline(struct Client *client_p, struct Client *source_p, aconf->status = CONF_DLINE; aconf->host = rb_strdup(dlhost); - /* Look for an oper reason */ - if((oper_reason = strchr(reason, '|')) != NULL) - { - *oper_reason = '\0'; - oper_reason++; - - if(!EmptyString(oper_reason)) - aconf->spasswd = rb_strdup(oper_reason); - } - if(tdline_time > 0) { rb_snprintf(dlbuffer, sizeof(dlbuffer), @@ -208,7 +303,7 @@ mo_dline(struct Client *client_p, struct Client *source_p, if(EmptyString(oper_reason)) { - sendto_realops_snomask(SNO_GENERAL, L_ALL, + sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s added temporary %d min. D-Line for [%s] [%s]", get_oper_name(source_p), tdline_time / 60, aconf->host, reason); @@ -218,7 +313,7 @@ mo_dline(struct Client *client_p, struct Client *source_p, } else { - sendto_realops_snomask(SNO_GENERAL, L_ALL, + sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, "%s added temporary %d min. D-Line for [%s] [%s|%s]", get_oper_name(source_p), tdline_time / 60, aconf->host, reason, oper_reason); @@ -239,36 +334,19 @@ mo_dline(struct Client *client_p, struct Client *source_p, oper_reason, current_date, 0); } - check_dlines(); return 0; } -/* mo_undline() - * - * parv[1] = dline to remove - */ static int -mo_undline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) +apply_undline(struct Client *source_p, const char *cidr) { FILE *in; FILE *out; char buf[BUFSIZE], buff[BUFSIZE], temppath[BUFSIZE], *p; const char *filename, *found_cidr; - const char *cidr; - struct ConfItem *aconf; int pairme = NO, error_on_write = NO; mode_t oldumask; - - rb_snprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile); - - if(!IsOperUnkline(source_p)) - { - sendto_one(source_p, form_str(ERR_NOPRIVS), - me.name, source_p->name, "unkline"); - return 0; - } - - cidr = parv[1]; + struct ConfItem *aconf; if(parse_netmask(cidr, NULL, NULL) == HM_HOST) { @@ -276,6 +354,8 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha return 0; } + rb_snprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile); + aconf = find_exact_conf_by_address(cidr, CONF_DLINE, NULL); if(aconf == NULL) { @@ -288,7 +368,7 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha { sendto_one(source_p, ":%s NOTICE %s :Un-dlined [%s] from temporary D-lines", - me.name, parv[0], buf); + me.name, source_p->name, buf); sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s has removed the temporary D-Line for: [%s]", get_oper_name(source_p), buf); @@ -300,14 +380,14 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha if((in = fopen(filename, "r")) == 0) { - sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], filename); + sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, source_p->name, filename); return 0; } oldumask = umask(0); if((out = fopen(temppath, "w")) == 0) { - sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], temppath); + sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, source_p->name, temppath); fclose(in); umask(oldumask); return 0; @@ -336,7 +416,7 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha continue; } - if(irccmp(found_cidr, aconf->host) == 0) + if(irccmp(found_cidr, cidr) == 0) { pairme++; } @@ -356,13 +436,13 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha { sendto_one(source_p, ":%s NOTICE %s :Couldn't write D-line file, aborted", - me.name, parv[0]); + me.name, source_p->name); return 0; } else if(!pairme) { - sendto_one_notice(source_p, ":Cannot find D-Line for %s in file", - aconf->host); + sendto_one(source_p, ":%s NOTICE %s :No D-Line for %s", + me.name, source_p->name, cidr); if(temppath != NULL) (void) unlink(temppath); @@ -375,13 +455,13 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha sendto_one_notice(source_p, ":Couldn't rename temp file, aborted"); return 0; } + rehash_bans(0); - sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, parv[0], aconf->host); - sendto_realops_snomask(SNO_GENERAL, L_ALL, - "%s has removed the D-Line for: [%s]", get_oper_name(source_p), aconf->host); - ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), aconf->host); - delete_one_address_conf(aconf->host, aconf); + sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, source_p->name, cidr); + sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, + "%s has removed the D-Line for: [%s]", get_oper_name(source_p), cidr); + ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), cidr); return 0; } diff --git a/modules/m_stats.c b/modules/m_stats.c index 8e3d1d2..45b9b38 100644 --- a/modules/m_stats.c +++ b/modules/m_stats.c @@ -951,6 +951,9 @@ static struct shared_flags shared_flagtable[] = { SHARED_UNRESV, 'R' }, { SHARED_LOCOPS, 'L' }, { SHARED_REHASH, 'H' }, + { SHARED_TDLINE, 'd' }, + { SHARED_PDLINE, 'D' }, + { SHARED_UNDLINE, 'E' }, { 0, '\0'} }; diff --git a/src/newconf.c b/src/newconf.c index 52c3ec7..5e72684 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -373,6 +373,10 @@ 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 }, From 9d34bfef27863bf5dfedd4cdcc2ab46686015ce4 Mon Sep 17 00:00:00 2001 From: Valery Yatsko Date: Sun, 20 Apr 2008 11:26:48 +0400 Subject: [PATCH 03/15] Patch removed --- patches/remote-dlines.diff | 483 ------------------------------------- 1 file changed, 483 deletions(-) delete mode 100644 patches/remote-dlines.diff diff --git a/patches/remote-dlines.diff b/patches/remote-dlines.diff deleted file mode 100644 index 7457f49..0000000 --- a/patches/remote-dlines.diff +++ /dev/null @@ -1,483 +0,0 @@ -diff -r a9a4e710ca64 include/s_newconf.h ---- a/include/s_newconf.h Sun Apr 20 01:03:54 2008 -0500 -+++ b/include/s_newconf.h Sun Apr 20 11:13:46 2008 +0400 -@@ -95,10 +95,14 @@ - #define SHARED_PRESV 0x0100 - #define SHARED_UNRESV 0x0200 - #define SHARED_REHASH 0x0400 -+#define SHARED_TDLINE 0x0800 -+#define SHARED_PDLINE 0x1000 -+#define SHARED_UNDLINE 0x2000 - - #define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\ - SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\ -- SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV) -+ SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV |\ -+ SHARED_TDLINE | SHARED_PDLINE | SHARED_UNDLINE) - #define CLUSTER_ALL (SHARED_ALL | SHARED_LOCOPS) - - /* flags used in hub/leaf */ -diff -r a9a4e710ca64 modules/m_dline.c ---- a/modules/m_dline.c Sun Apr 20 01:03:54 2008 -0500 -+++ b/modules/m_dline.c Sun Apr 20 11:13:46 2008 +0400 -@@ -44,15 +44,17 @@ - #include "modules.h" - - static int mo_dline(struct Client *, struct Client *, int, const char **); -+static int me_dline(struct Client *, struct Client *, int, const char **); - static int mo_undline(struct Client *, struct Client *, int, const char **); -+static int me_undline(struct Client *, struct Client *, int, const char **); - - struct Message dline_msgtab = { - "DLINE", 0, 0, 0, MFLG_SLOW, -- {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_dline, 2}} -+ {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_dline, 3}, {mo_dline, 2}} - }; - struct Message undline_msgtab = { - "UNDLINE", 0, 0, 0, MFLG_SLOW, -- {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_undline, 2}} -+ {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, {me_undline, 1}, {mo_undline, 2}} - }; - - mapi_clist_av1 dline_clist[] = { &dline_msgtab, &undline_msgtab, NULL }; -@@ -61,6 +63,8 @@ - static int valid_comment(char *comment); - static int flush_write(struct Client *, FILE *, char *, char *); - static int remove_temp_dline(struct ConfItem *); -+static int apply_dline(struct Client *, const char *, int, char *); -+static int apply_undline(struct Client *, const char *); - - /* mo_dline() - * -@@ -73,15 +77,10 @@ - { - char def[] = "No Reason"; - const char *dlhost; -- char *oper_reason; - char *reason = def; -- struct rb_sockaddr_storage daddr; - char cidr_form_host[HOSTLEN + 1]; -- struct ConfItem *aconf; -- int bits; -- char dlbuffer[IRCD_BUFSIZE]; -- const char *current_date; - int tdline_time = 0; -+ const char *target_server = NULL; - int loc = 1; - - if(!IsOperK(source_p)) -@@ -94,72 +93,178 @@ - if((tdline_time = valid_temp_time(parv[loc])) >= 0) - loc++; - -- if(parc < loc + 1) -- { -- sendto_one(source_p, form_str(ERR_NEEDMOREPARAMS), -- me.name, source_p->name, "DLINE"); -- return 0; -- } -- - dlhost = parv[loc]; - rb_strlcpy(cidr_form_host, dlhost, sizeof(cidr_form_host)); - -- if(!parse_netmask(dlhost, NULL, &bits)) -+ loc++; -+ -+ if(parc >= loc+2 && !irccmp(parv[loc], "ON")) -+ { -+ target_server = parv[loc+1]; -+ loc += 2; -+ } -+ -+ if(parc >= loc + 1 && !EmptyString(parv[loc])) -+ reason = LOCAL_COPY(parv[loc]); -+ -+ if(target_server != NULL) -+ { -+ sendto_match_servs(source_p, target_server, -+ CAP_ENCAP, NOCAPS, -+ "ENCAP %s DLINE %d %s :%s", -+ target_server, tdline_time, dlhost, reason); -+ -+ if(!match(target_server, me.name)) -+ return 0; -+ } -+ -+ apply_dline(source_p, dlhost, tdline_time, reason); -+ -+ check_dlines(); -+ return 0; -+} -+ -+/* mo_undline() -+ * -+ * parv[1] = dline to remove -+ */ -+static int -+mo_undline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) -+{ -+ const char *cidr; -+ const char *target_server = NULL; -+ -+ if(!IsOperK(source_p)) -+ { -+ sendto_one(source_p, form_str(ERR_NOPRIVS), -+ me.name, source_p->name, "unkline"); -+ return 0; -+ } -+ -+ cidr = parv[1]; -+ -+ if(parc >= 4 && !irccmp(parv[2], "ON")) -+ { -+ target_server = parv[3]; -+ sendto_match_servs(source_p, target_server, -+ CAP_ENCAP, NOCAPS, -+ "ENCAP %s UNDLINE %s", -+ target_server, cidr); -+ -+ if(!match(target_server, me.name)) -+ return 0; -+ } -+ -+ apply_undline(source_p, cidr); -+ -+ return 0; -+} -+ -+static int -+me_dline(struct Client *client_p, struct Client *source_p, int parc, const char **parv) -+{ -+ int tdline_time = atoi(parv[1]); -+ /* Since this is coming over a server link, assume that the originating -+ * server did the relevant permission/sanity checks... -+ */ -+ -+ if(!IsPerson(source_p)) -+ return 0; -+ -+ if(!find_shared_conf(source_p->username, source_p->host, -+ source_p->servptr->name, tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE)) -+ { -+ sendto_realops_snomask(SNO_DEBUG, L_NETWIDE, "undline failed %s %s %s", -+ source_p->name, parv[1], parv[2]); -+ return 0; -+ } -+ -+ apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3])); -+ -+ check_dlines(); -+ return 0; -+} -+ -+static int -+me_undline(struct Client *client_p, struct Client *source_p, int parc, const char **parv) -+{ -+ if(!IsPerson(source_p)) -+ return 0; -+ -+ if(!find_shared_conf(source_p->username, source_p->host, -+ source_p->servptr->name, SHARED_UNDLINE)) -+ return 0; -+ -+ apply_undline(source_p, parv[1]); -+ -+ return 0; -+} -+ -+static int -+apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char *reason) -+{ -+ struct ConfItem *aconf; -+ char *oper_reason; -+ char dlbuffer[IRCD_BUFSIZE]; -+ const char *current_date; -+ struct rb_sockaddr_storage daddr; -+ int t = AF_INET, ty, b; -+ const char *creason; -+ -+ ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b); -+ if(ty == HM_HOST) - { - sendto_one(source_p, ":%s NOTICE %s :Invalid D-Line", - me.name, source_p->name); - return 0; - } -+#ifdef RB_IPV6 -+ if(ty == HM_IPV6) -+ t = AF_INET6; -+ else -+#endif -+ t = AF_INET; - -- loc++; -- -- if(parc >= loc + 1) /* host :reason */ -- { -- if(!EmptyString(parv[loc])) -- reason = LOCAL_COPY(parv[loc]); -- -- if(!valid_comment(reason)) -- { -- sendto_one(source_p, -- ":%s NOTICE %s :Invalid character '\"' in comment", -- me.name, source_p->name); -- return 0; -- } -- } -- -+ /* This means dlines wider than /16 cannot be set remotely */ - if(IsOperAdmin(source_p)) - { -- if(bits < 8) -+ if(b < 8) - { -- sendto_one(source_p, -- ":%s NOTICE %s :For safety, bitmasks less than 8 require conf access.", -- me.name, parv[0]); -+ sendto_one_notice(source_p, -+ ":For safety, bitmasks less than 8 require conf access."); - return 0; - } - } - else - { -- if(bits < 16) -+ if(b < 16) - { -- sendto_one(source_p, -- ":%s NOTICE %s :Dline bitmasks less than 16 are for admins only.", -- me.name, parv[0]); -+ sendto_one_notice(source_p, -+ ":Dline bitmasks less than 16 are for admins only."); - return 0; - } - } - -+ if(!valid_comment(reason)) -+ { -+ sendto_one(source_p, -+ ":%s NOTICE %s :Invalid character '\"' in comment", -+ me.name, source_p->name); -+ return 0; -+ } -+ -+ /* Look for an oper reason */ -+ if((oper_reason = strchr(reason, '|')) != NULL) -+ { -+ *oper_reason = '\0'; -+ oper_reason++; -+ -+ if(!EmptyString(oper_reason)) -+ aconf->spasswd = rb_strdup(oper_reason); -+ } -+ - if(ConfigFileEntry.non_redundant_klines) - { -- const char *creason; -- int t = AF_INET, ty, b; -- ty = parse_netmask(dlhost, (struct sockaddr *)&daddr, &b); --#ifdef RB_IPV6 -- if(ty == HM_IPV6) -- t = AF_INET6; -- else --#endif -- t = AF_INET; -- - if((aconf = find_dline((struct sockaddr *)&daddr, t)) != NULL) - { - int bx; -@@ -170,11 +275,11 @@ - if(IsConfExemptKline(aconf)) - sendto_one(source_p, - ":%s NOTICE %s :[%s] is (E)d-lined by [%s] - %s", -- me.name, parv[0], dlhost, aconf->host, creason); -+ me.name, source_p->name, dlhost, aconf->host, creason); - else - sendto_one(source_p, - ":%s NOTICE %s :[%s] already D-lined by [%s] - %s", -- me.name, parv[0], dlhost, aconf->host, creason); -+ me.name, source_p->name, dlhost, aconf->host, creason); - return 0; - } - } -@@ -187,16 +292,6 @@ - aconf->status = CONF_DLINE; - aconf->host = rb_strdup(dlhost); - -- /* Look for an oper reason */ -- if((oper_reason = strchr(reason, '|')) != NULL) -- { -- *oper_reason = '\0'; -- oper_reason++; -- -- if(!EmptyString(oper_reason)) -- aconf->spasswd = rb_strdup(oper_reason); -- } -- - if(tdline_time > 0) - { - rb_snprintf(dlbuffer, sizeof(dlbuffer), -@@ -208,7 +303,7 @@ - - if(EmptyString(oper_reason)) - { -- sendto_realops_snomask(SNO_GENERAL, L_ALL, -+ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, - "%s added temporary %d min. D-Line for [%s] [%s]", - get_oper_name(source_p), tdline_time / 60, - aconf->host, reason); -@@ -218,7 +313,7 @@ - } - else - { -- sendto_realops_snomask(SNO_GENERAL, L_ALL, -+ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, - "%s added temporary %d min. D-Line for [%s] [%s|%s]", - get_oper_name(source_p), tdline_time / 60, - aconf->host, reason, oper_reason); -@@ -239,42 +334,27 @@ - oper_reason, current_date, 0); - } - -- check_dlines(); - return 0; - } - --/* mo_undline() -- * -- * parv[1] = dline to remove -- */ - static int --mo_undline(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) -+apply_undline(struct Client *source_p, const char *cidr) - { - FILE *in; - FILE *out; - char buf[BUFSIZE], buff[BUFSIZE], temppath[BUFSIZE], *p; - const char *filename, *found_cidr; -- const char *cidr; -- struct ConfItem *aconf; - int pairme = NO, error_on_write = NO; - mode_t oldumask; -- -- rb_snprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile); -- -- if(!IsOperUnkline(source_p)) -- { -- sendto_one(source_p, form_str(ERR_NOPRIVS), -- me.name, source_p->name, "unkline"); -- return 0; -- } -- -- cidr = parv[1]; -+ struct ConfItem *aconf; - - if(parse_netmask(cidr, NULL, NULL) == HM_HOST) - { - sendto_one_notice(source_p, ":Invalid D-Line"); - return 0; - } -+ -+ rb_snprintf(temppath, sizeof(temppath), "%s.tmp", ConfigFileEntry.dlinefile); - - aconf = find_exact_conf_by_address(cidr, CONF_DLINE, NULL); - if(aconf == NULL) -@@ -288,7 +368,7 @@ - { - sendto_one(source_p, - ":%s NOTICE %s :Un-dlined [%s] from temporary D-lines", -- me.name, parv[0], buf); -+ me.name, source_p->name, buf); - sendto_realops_snomask(SNO_GENERAL, L_ALL, - "%s has removed the temporary D-Line for: [%s]", - get_oper_name(source_p), buf); -@@ -300,14 +380,14 @@ - - if((in = fopen(filename, "r")) == 0) - { -- sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], filename); -+ sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, source_p->name, filename); - return 0; - } - - oldumask = umask(0); - if((out = fopen(temppath, "w")) == 0) - { -- sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, parv[0], temppath); -+ sendto_one(source_p, ":%s NOTICE %s :Cannot open %s", me.name, source_p->name, temppath); - fclose(in); - umask(oldumask); - return 0; -@@ -336,7 +416,7 @@ - continue; - } - -- if(irccmp(found_cidr, aconf->host) == 0) -+ if(irccmp(found_cidr, cidr) == 0) - { - pairme++; - } -@@ -356,13 +436,13 @@ - { - sendto_one(source_p, - ":%s NOTICE %s :Couldn't write D-line file, aborted", -- me.name, parv[0]); -+ me.name, source_p->name); - return 0; - } - else if(!pairme) - { -- sendto_one_notice(source_p, ":Cannot find D-Line for %s in file", -- aconf->host); -+ sendto_one(source_p, ":%s NOTICE %s :No D-Line for %s", -+ me.name, source_p->name, cidr); - - if(temppath != NULL) - (void) unlink(temppath); -@@ -375,13 +455,13 @@ - sendto_one_notice(source_p, ":Couldn't rename temp file, aborted"); - return 0; - } -+ rehash_bans(0); - -- sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, parv[0], aconf->host); -- sendto_realops_snomask(SNO_GENERAL, L_ALL, -- "%s has removed the D-Line for: [%s]", get_oper_name(source_p), aconf->host); -- ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), aconf->host); - -- delete_one_address_conf(aconf->host, aconf); -+ sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, source_p->name, cidr); -+ sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, -+ "%s has removed the D-Line for: [%s]", get_oper_name(source_p), cidr); -+ ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), cidr); - - return 0; - } -diff -r a9a4e710ca64 modules/m_stats.c ---- a/modules/m_stats.c Sun Apr 20 01:03:54 2008 -0500 -+++ b/modules/m_stats.c Sun Apr 20 11:13:46 2008 +0400 -@@ -951,6 +951,9 @@ - { SHARED_UNRESV, 'R' }, - { SHARED_LOCOPS, 'L' }, - { SHARED_REHASH, 'H' }, -+ { SHARED_TDLINE, 'd' }, -+ { SHARED_PDLINE, 'D' }, -+ { SHARED_UNDLINE, 'E' }, - { 0, '\0'} - }; - -diff -r a9a4e710ca64 src/newconf.c ---- a/src/newconf.c Sun Apr 20 01:03:54 2008 -0500 -+++ b/src/newconf.c Sun Apr 20 11:13:46 2008 +0400 -@@ -373,6 +373,10 @@ - { "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 }, From 3da818ecea66d885a34d29ad60a18e56c764810f Mon Sep 17 00:00:00 2001 From: Valery Yatsko Date: Sun, 20 Apr 2008 11:33:41 +0400 Subject: [PATCH 04/15] TODO changed --- TODO | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index ce8f345..1139ab0 100644 --- a/TODO +++ b/TODO @@ -19,10 +19,8 @@ [x] ssl channelmode (done by extban and chm_compat) [ ] acknowledgement message for SSL users like '* *** You are connected using SSL cipher "DHE RSA-AES 128 CBC-SHA"' [ ] ssl stuff files generator in ./configure time -[?] merge some stuff from ircd-seven directly (to be determined what) - [?] remote d:lines support? - [?] PASS selector:password for auth{}? (useful for dynamic IPs) - [?] +C (noctcp) channel/usermode +[x] merge some stuff from ircd-seven directly (to be determined what) + [x] remote d:lines support [F] kline/xline/resv sync [F] make an ability of using bandb instead of .conf files as bans storage [F] drop non-TS6 (legacy protocol) support @@ -34,7 +32,9 @@ [F] auth checker module [F] resolver module [x] Remove glines entirely -[ ] other stuff +--- other stuff + [?] PASS selector:password for auth{} from ircd-seven? (useful for dynamic IPs) + [?] +C (noctcp) channel/usermode from ircd-seven? [?] internally split out +o/+v "ranks" into a series of permissions. this could allow for configure-defined special access levels, halfops, etc. (would need to match globally, somehow. extra SVINFO param?) [?] somehow hide channel operators like ircnet can do? From 78a47af02017cb936d54eeabcba6636ec7bec4a3 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 20 Apr 2008 14:47:34 +0200 Subject: [PATCH 05/15] Remove silly cast that caused a compiler warning. --- src/s_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s_conf.c b/src/s_conf.c index d1719b8..8ce36d4 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -1538,7 +1538,7 @@ yyerror(const char *msg) { char newlinebuf[BUFSIZE]; - strip_tabs(newlinebuf, (const unsigned char *) linebuf, strlen(linebuf)); + strip_tabs(newlinebuf, linebuf, strlen(linebuf)); sendto_realops_snomask(SNO_GENERAL, L_ALL, "\"%s\", line %d: %s at '%s'", conffilebuf, lineno + 1, msg, newlinebuf); From aa65834c6fd6302e5ef3e810abc107ea737bcc74 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 20 Apr 2008 15:20:10 +0200 Subject: [PATCH 06/15] Fix various compiler warnings. --- include/hook.h | 26 +++++++++++++------------- include/irc_dictionary.h | 5 +++++ include/s_conf.h | 6 +++--- include/s_newconf.h | 2 +- src/channel.c | 3 --- src/chmode.c | 8 +------- src/hook.c | 1 + src/irc_dictionary.c | 10 +++++----- src/newconf.c | 2 +- src/reject.c | 2 -- src/res.c | 2 -- src/substitution.c | 1 + 12 files changed, 31 insertions(+), 37 deletions(-) diff --git a/include/hook.h b/include/hook.h index 24da17e..b1bad11 100644 --- a/include/hook.h +++ b/include/hook.h @@ -15,20 +15,20 @@ typedef struct typedef void (*hookfn) (void *data); -int h_iosend_id; -int h_iorecv_id; -int h_iorecvctrl_id; +extern int h_iosend_id; +extern int h_iorecv_id; +extern int h_iorecvctrl_id; -int h_burst_client; -int h_burst_channel; -int h_burst_finished; -int h_server_introduced; -int h_server_eob; -int h_client_exit; -int h_umode_changed; -int h_new_local_user; -int h_new_remote_user; -int h_introduce_client; +extern int h_burst_client; +extern int h_burst_channel; +extern int h_burst_finished; +extern int h_server_introduced; +extern int h_server_eob; +extern int h_client_exit; +extern int h_umode_changed; +extern int h_new_local_user; +extern int h_new_remote_user; +extern int h_introduce_client; void init_hook(void); int register_hook(const char *name); diff --git a/include/irc_dictionary.h b/include/irc_dictionary.h index 5d76284..69f3bab 100644 --- a/include/irc_dictionary.h +++ b/include/irc_dictionary.h @@ -150,6 +150,11 @@ extern void *irc_dictionary_retrieve(struct Dictionary *dtree, const char *key); */ extern void *irc_dictionary_delete(struct Dictionary *dtree, const char *key); +/* + * irc_dictionary_size() returns the number of elements in a dictionary tree. + */ +extern unsigned int irc_dictionary_size(struct Dictionary *dtree); + void irc_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, void *privdata), void *privdata); #endif diff --git a/include/s_conf.h b/include/s_conf.h index 16c4987..72e24eb 100644 --- a/include/s_conf.h +++ b/include/s_conf.h @@ -303,7 +303,7 @@ extern struct server_info ServerInfo; /* defined in ircd.c */ extern struct admin_info AdminInfo; /* defined in ircd.c */ /* End GLOBAL section */ -rb_dlink_list service_list; +extern rb_dlink_list service_list; typedef enum temp_list { @@ -314,8 +314,8 @@ typedef enum temp_list LAST_TEMP_TYPE } temp_list; -rb_dlink_list temp_klines[LAST_TEMP_TYPE]; -rb_dlink_list temp_dlines[LAST_TEMP_TYPE]; +extern rb_dlink_list temp_klines[LAST_TEMP_TYPE]; +extern rb_dlink_list temp_dlines[LAST_TEMP_TYPE]; extern void init_s_conf(void); diff --git a/include/s_newconf.h b/include/s_newconf.h index 9c6dbdb..de73d85 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -53,7 +53,7 @@ extern rb_dlink_list resv_conf_list; extern rb_dlink_list nd_list; extern rb_dlink_list tgchange_list; -struct _rb_patricia_tree_t *tgchange_tree; +extern struct _rb_patricia_tree_t *tgchange_tree; extern void init_s_newconf(void); extern void clear_s_newconf(void); diff --git a/src/channel.c b/src/channel.c index db8d327..5909f27 100644 --- a/src/channel.c +++ b/src/channel.c @@ -41,9 +41,6 @@ #include "s_newconf.h" #include "logger.h" -extern rb_dlink_list global_channel_list; - -extern struct config_channel_entry ConfigChannel; extern rb_bh *channel_heap; extern rb_bh *ban_heap; extern rb_bh *topic_heap; diff --git a/src/chmode.c b/src/chmode.c index 82adf8a..6c3fc36 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -57,18 +57,12 @@ #define SM_ERR_RPL_Q 0x00000800 #define SM_ERR_RPL_F 0x00001000 -void set_channel_mode(struct Client *, struct Client *, - struct Channel *, struct membership *, int, const char **); - -int add_id(struct Client *source_p, struct Channel *chptr, - const char *banid, rb_dlink_list * list, long mode_type); - static struct ChModeChange mode_changes[BUFSIZE]; static int mode_count; static int mode_limit; static int mask_pos; -int +static int get_channel_access(struct Client *source_p, struct membership *msptr) { if(!MyClient(source_p) || is_chanop(msptr)) diff --git a/src/hook.c b/src/hook.c index 5ef51f0..79a9a10 100644 --- a/src/hook.c +++ b/src/hook.c @@ -59,6 +59,7 @@ int h_burst_finished; int h_server_introduced; int h_server_eob; int h_client_exit; +int h_umode_changed; int h_new_local_user; int h_new_remote_user; int h_introduce_client; diff --git a/src/irc_dictionary.c b/src/irc_dictionary.c index 9096790..0de08b6 100644 --- a/src/irc_dictionary.c +++ b/src/irc_dictionary.c @@ -203,7 +203,7 @@ irc_dictionary_get_linear_index(struct Dictionary *dict, const char *key) * Side Effects: * - a new root node is nominated. */ -void +static void irc_dictionary_retune(struct Dictionary *dict, const char *key) { struct DictionaryElement n, *tn, *left, *right, *node; @@ -302,7 +302,7 @@ irc_dictionary_retune(struct Dictionary *dict, const char *key) * Side Effects: * - a node is linked to the dictionary tree */ -void +static void irc_dictionary_link(struct Dictionary *dict, struct DictionaryElement *delem) { @@ -382,7 +382,7 @@ irc_dictionary_link(struct Dictionary *dict, * Side Effects: * - the root node is unlinked from the dictionary tree */ -void +static void irc_dictionary_unlink_root(struct Dictionary *dict) { struct DictionaryElement *delem, *nextnode, *parentofnext; @@ -644,7 +644,7 @@ void irc_dictionary_foreach_next(struct Dictionary *dtree, if (state->cur == NULL) { - ilog(L_MAIN, "irc_dictionary_foreach_next(): called again after iteration finished on dtree<%p>", dtree); + ilog(L_MAIN, "irc_dictionary_foreach_next(): called again after iteration finished on dtree<%p>", (void *)dtree); return; } @@ -854,7 +854,7 @@ void irc_dictionary_stats(struct Dictionary *dict, void (*cb)(const char *line, dict->id, dict->count); else snprintf(str, sizeof str, "Dictionary stats for <%p> (%d)", - dict, dict->count); + (void *)dict, dict->count); cb(str, privdata); maxdepth = 0; sum = stats_recurse(dict->root, 0, &maxdepth); diff --git a/src/newconf.c b/src/newconf.c index 5e72684..47f9569 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -1754,7 +1754,7 @@ conf_set_generic_string(void *data, int len, void *location) char **loc = location; char *input = data; - if(len && strlen(input) > len) + if(len && strlen(input) > (unsigned int)len) input[len] = '\0'; rb_free(*loc); diff --git a/src/reject.c b/src/reject.c index 9dacd40..d2422a4 100644 --- a/src/reject.c +++ b/src/reject.c @@ -46,8 +46,6 @@ struct reject_data uint32_t mask_hashv; }; -static rb_patricia_tree_t *unknown_tree; - static void reject_exit(void *unused) { diff --git a/src/res.c b/src/res.c index 7af69af..81260c8 100644 --- a/src/res.c +++ b/src/res.c @@ -99,8 +99,6 @@ static int proc_answer(struct reslist *request, HEADER * header, char *, char *) static struct reslist *find_id(int id); static struct DNSReply *make_dnsreply(struct reslist *request); -extern struct rb_sockaddr_storage irc_nsaddr_list[IRCD_MAXNS]; -extern int irc_nscount; extern char irc_domain[HOSTLEN + 1]; diff --git a/src/substitution.c b/src/substitution.c index e92fae4..37fc340 100644 --- a/src/substitution.c +++ b/src/substitution.c @@ -36,6 +36,7 @@ #include "stdinc.h" #include "s_user.h" #include "match.h" +#include "substitution.h" /* * Simple mappings for $foo -> 'bar'. From c465dbcda46305a73eb7dde2d18204435ff6df40 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 20 Apr 2008 15:30:24 +0200 Subject: [PATCH 07/15] Move some declarations to header files, this enforces that they match. --- include/ircd.h | 5 +++++ include/reslib.h | 2 ++ src/channel.c | 5 ----- src/res.c | 3 --- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/include/ircd.h b/include/ircd.h index c600f5c..ec8192b 100644 --- a/include/ircd.h +++ b/include/ircd.h @@ -99,6 +99,11 @@ extern rb_dlink_list local_oper_list; extern rb_dlink_list oper_list; extern rb_dlink_list dead_list; +extern rb_bh *channel_heap; +extern rb_bh *ban_heap; +extern rb_bh *topic_heap; +extern rb_bh *member_heap; + extern int testing_conf; extern struct ev_entry *check_splitmode_ev; diff --git a/include/reslib.h b/include/reslib.h index 38e061b..1336055 100644 --- a/include/reslib.h +++ b/include/reslib.h @@ -115,4 +115,6 @@ extern void irc_ns_put16(unsigned int src, unsigned char *dst); extern void irc_ns_put32(unsigned long src, unsigned char *dst); extern int irc_res_mkquery(const char *dname, int class, int type, unsigned char *buf, int buflen); +extern char irc_domain[HOSTLEN + 1]; + #endif diff --git a/src/channel.c b/src/channel.c index 5909f27..c77e02d 100644 --- a/src/channel.c +++ b/src/channel.c @@ -41,11 +41,6 @@ #include "s_newconf.h" #include "logger.h" -extern rb_bh *channel_heap; -extern rb_bh *ban_heap; -extern rb_bh *topic_heap; -extern rb_bh *member_heap; - static int channel_capabs[] = { CAP_EX, CAP_IE, CAP_SERVICE, CAP_TS6 diff --git a/src/res.c b/src/res.c index 81260c8..08b2c25 100644 --- a/src/res.c +++ b/src/res.c @@ -99,9 +99,6 @@ static int proc_answer(struct reslist *request, HEADER * header, char *, char *) static struct reslist *find_id(int id); static struct DNSReply *make_dnsreply(struct reslist *request); -extern char irc_domain[HOSTLEN + 1]; - - /* * int * res_ourserver(inp) From 3f2b905e353f5e6c5682c17627f28e4b8618d69d Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 20 Apr 2008 15:32:08 +0200 Subject: [PATCH 08/15] Remove conf_connect_allowed(), neither used nor declared. --- src/s_conf.c | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/s_conf.c b/src/s_conf.c index 8ce36d4..d689fb0 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -904,29 +904,6 @@ validate_conf(void) * */ -/* - * conf_connect_allowed - * - * inputs - pointer to inaddr - * - int type ipv4 or ipv6 - * output - ban info or NULL - * side effects - none - */ -struct ConfItem * -conf_connect_allowed(struct sockaddr *addr, int aftype) -{ - struct ConfItem *aconf = find_dline(addr, aftype); - - /* DLINE exempt also gets you out of static limits/pacing... */ - if(aconf && (aconf->status & CONF_EXEMPTDLINE)) - return NULL; - - if(aconf != NULL) - return aconf; - - return NULL; -} - /* add_temp_kline() * * inputs - pointer to struct ConfItem From 7e7c69536b1937762d04d71fbaad6fb204b5b2ef Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 20 Apr 2008 15:33:23 +0200 Subject: [PATCH 09/15] Remove obsolete comment. DNS lookups should be done prior to usage of an item, not when loading the configuration. --- src/s_conf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/s_conf.c b/src/s_conf.c index d689fb0..19f9f3e 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -898,12 +898,6 @@ validate_conf(void) } } -/* - * lookup_confhost - start DNS lookups of all hostnames in the conf - * line and convert an IP addresses in a.b.c.d number for to IP#s. - * - */ - /* add_temp_kline() * * inputs - pointer to struct ConfItem From e26306d359d779a62f1661dc3c130a95b83fdf47 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 20 Apr 2008 15:47:53 +0200 Subject: [PATCH 10/15] Remove windows newlines (^M). --- modules/m_dline.c | 78 +++++++++++++++++++++++------------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/modules/m_dline.c b/modules/m_dline.c index 13b0701..a0d7b97 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -63,7 +63,7 @@ DECLARE_MODULE_AV1(dline, NULL, NULL, dline_clist, NULL, NULL, "$Revision: 3225 static int valid_comment(char *comment); static int flush_write(struct Client *, FILE *, char *, char *); static int remove_temp_dline(struct ConfItem *); -static int apply_dline(struct Client *, const char *, int, char *); +static int apply_dline(struct Client *, const char *, int, char *); static int apply_undline(struct Client *, const char *); /* mo_dline() @@ -160,44 +160,44 @@ mo_undline(struct Client *client_p, struct Client *source_p, int parc, const cha return 0; } -static int -me_dline(struct Client *client_p, struct Client *source_p, int parc, const char **parv) -{ - int tdline_time = atoi(parv[1]); - /* Since this is coming over a server link, assume that the originating - * server did the relevant permission/sanity checks... - */ - - if(!IsPerson(source_p)) - return 0; - - if(!find_shared_conf(source_p->username, source_p->host, - source_p->servptr->name, tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE)) - { - sendto_realops_snomask(SNO_DEBUG, L_NETWIDE, "undline failed %s %s %s", - source_p->name, parv[1], parv[2]); - return 0; - } - - apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3])); - - check_dlines(); - return 0; -} - -static int -me_undline(struct Client *client_p, struct Client *source_p, int parc, const char **parv) -{ - if(!IsPerson(source_p)) - return 0; - - if(!find_shared_conf(source_p->username, source_p->host, - source_p->servptr->name, SHARED_UNDLINE)) - return 0; - - apply_undline(source_p, parv[1]); - - return 0; +static int +me_dline(struct Client *client_p, struct Client *source_p, int parc, const char **parv) +{ + int tdline_time = atoi(parv[1]); + /* Since this is coming over a server link, assume that the originating + * server did the relevant permission/sanity checks... + */ + + if(!IsPerson(source_p)) + return 0; + + if(!find_shared_conf(source_p->username, source_p->host, + source_p->servptr->name, tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE)) + { + sendto_realops_snomask(SNO_DEBUG, L_NETWIDE, "undline failed %s %s %s", + source_p->name, parv[1], parv[2]); + return 0; + } + + apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3])); + + check_dlines(); + return 0; +} + +static int +me_undline(struct Client *client_p, struct Client *source_p, int parc, const char **parv) +{ + if(!IsPerson(source_p)) + return 0; + + if(!find_shared_conf(source_p->username, source_p->host, + source_p->servptr->name, SHARED_UNDLINE)) + return 0; + + apply_undline(source_p, parv[1]); + + return 0; } static int From 47819d9814c996961f2141423bb30ab04d7467f7 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 20 Apr 2008 16:05:17 +0200 Subject: [PATCH 11/15] Repair fast/better undline (169:d8aa0d182c9f). --- modules/m_dline.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/modules/m_dline.c b/modules/m_dline.c index a0d7b97..7644218 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -416,7 +416,7 @@ apply_undline(struct Client *source_p, const char *cidr) continue; } - if(irccmp(found_cidr, cidr) == 0) + if(irccmp(found_cidr, aconf->host) == 0) { pairme++; } @@ -441,8 +441,8 @@ apply_undline(struct Client *source_p, const char *cidr) } else if(!pairme) { - sendto_one(source_p, ":%s NOTICE %s :No D-Line for %s", - me.name, source_p->name, cidr); + sendto_one_notice(source_p, ":Cannot find D-Line for %s in file", + aconf->host); if(temppath != NULL) (void) unlink(temppath); @@ -455,13 +455,12 @@ apply_undline(struct Client *source_p, const char *cidr) sendto_one_notice(source_p, ":Couldn't rename temp file, aborted"); return 0; } - rehash_bans(0); - - sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, source_p->name, cidr); + sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, source_p->name, aconf->host); sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, - "%s has removed the D-Line for: [%s]", get_oper_name(source_p), cidr); - ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), cidr); + "%s has removed the D-Line for: [%s]", get_oper_name(source_p), aconf->host); + ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), aconf->host); + delete_one_address_conf(aconf->host, aconf); return 0; } From 931e8bc49e687423daf9f72cd7a202d6d81be5e8 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Sun, 20 Apr 2008 19:43:50 +0200 Subject: [PATCH 12/15] Take out some seven-style server notices. --- modules/m_dline.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/modules/m_dline.c b/modules/m_dline.c index 7644218..f7f0945 100644 --- a/modules/m_dline.c +++ b/modules/m_dline.c @@ -173,11 +173,7 @@ me_dline(struct Client *client_p, struct Client *source_p, int parc, const char if(!find_shared_conf(source_p->username, source_p->host, source_p->servptr->name, tdline_time > 0 ? SHARED_TDLINE : SHARED_PDLINE)) - { - sendto_realops_snomask(SNO_DEBUG, L_NETWIDE, "undline failed %s %s %s", - source_p->name, parv[1], parv[2]); return 0; - } apply_dline(source_p, parv[2], tdline_time, LOCAL_COPY(parv[3])); @@ -303,7 +299,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char * if(EmptyString(oper_reason)) { - sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, + sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s added temporary %d min. D-Line for [%s] [%s]", get_oper_name(source_p), tdline_time / 60, aconf->host, reason); @@ -313,7 +309,7 @@ apply_dline(struct Client *source_p, const char *dlhost, int tdline_time, char * } else { - sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, + sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s added temporary %d min. D-Line for [%s] [%s|%s]", get_oper_name(source_p), tdline_time / 60, aconf->host, reason, oper_reason); @@ -457,7 +453,7 @@ apply_undline(struct Client *source_p, const char *cidr) } sendto_one(source_p, ":%s NOTICE %s :D-Line for [%s] is removed", me.name, source_p->name, aconf->host); - sendto_realops_snomask(SNO_GENERAL, L_NETWIDE, + sendto_realops_snomask(SNO_GENERAL, L_ALL, "%s has removed the D-Line for: [%s]", get_oper_name(source_p), aconf->host); ilog(L_KLINE, "UD %s %s", get_oper_name(source_p), aconf->host); delete_one_address_conf(aconf->host, aconf); From bc762249f2aaaa8066ec5683fec173687adf6c0a Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Mon, 21 Apr 2008 01:41:42 +0200 Subject: [PATCH 13/15] Remove dline flags from shared all. This means dline/undline need to be specified explicitly in a shared{} block. --- include/s_newconf.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/s_newconf.h b/include/s_newconf.h index de73d85..5d8b7e9 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -101,8 +101,7 @@ struct remote_conf #define SHARED_ALL (SHARED_TKLINE | SHARED_PKLINE | SHARED_UNKLINE |\ SHARED_PXLINE | SHARED_TXLINE | SHARED_UNXLINE |\ - SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV |\ - SHARED_TDLINE | SHARED_PDLINE | SHARED_UNDLINE) + SHARED_TRESV | SHARED_PRESV | SHARED_UNRESV) #define CLUSTER_ALL (SHARED_ALL | SHARED_LOCOPS) /* flags used in hub/leaf */ From f410930f71bc7ab9264ff446adc02a8c516b244d Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Mon, 21 Apr 2008 01:42:19 +0200 Subject: [PATCH 14/15] Mention shared dline flags in reference.conf. --- doc/reference.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/reference.conf b/doc/reference.conf index d5d3365..4d54480 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -580,6 +580,9 @@ shared { * all - allow oper/server to do all of above. * locops - allow locops - only used for servers who cluster * rehash - allow rehashing + * dline - allow setting perm/temp dlines + * tdline - allow setting temp dlines + * undline - allow removing dlines * none - disallow everything */ From 66a1352761438f3603b7ce7b1956f7261a000166 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Mon, 21 Apr 2008 01:54:24 +0200 Subject: [PATCH 15/15] Document remote D:lines in sgml. --- doc/sgml/oper-guide/commands.sgml | 7 ++++++- doc/sgml/oper-guide/config.sgml | 20 +++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/doc/sgml/oper-guide/commands.sgml b/doc/sgml/oper-guide/commands.sgml index d77dc8a..e26edf7 100644 --- a/doc/sgml/oper-guide/commands.sgml +++ b/doc/sgml/oper-guide/commands.sgml @@ -398,6 +398,7 @@ DLINE length a.b.c.d + ON servername :reason @@ -424,7 +425,10 @@ connections. - D:lines cannot be set remotely on other servers. + If the ON part is specified, the D:line is set on servers matching + the given mask (provided a matching shared{} block exists there, + which is not the case by default). + Otherwise, the D:Line will be set on the local server only. Only exempt{} blocks exempt from D:lines. @@ -437,6 +441,7 @@ UNDLINE a.b.c.d + ON servername Will attempt to remove a D:line from dline.conf, and will flush diff --git a/doc/sgml/oper-guide/config.sgml b/doc/sgml/oper-guide/config.sgml index 3db34de..a5ae1df 100644 --- a/doc/sgml/oper-guide/config.sgml +++ b/doc/sgml/oper-guide/config.sgml @@ -1018,7 +1018,7 @@ shared { all - All of the above; this does not include locops or rehash + All of the above; this does not include locops, rehash, dline, tdline or undline. @@ -1036,6 +1036,24 @@ shared { REHASH commands; all options can be used + + dline (D) + + Permanent and temporary D:lines + + + + tdline (d) + + Temporary D:lines + + + + undline (E) + + D:line removals + + none