[READ-ONLY] Mirror of https://github.com/VibeDevelopers/atheme. Modified fork of atheme IRC Services www.vibetalk.net/
0

Configure Feed

Select the types of activity you want to include in your feed.

Add match_masks_through_vhost option for Solanum

This reflects a similar Solanum PR: solanum-ircd/solanum#150

It might be slightly more proper to have this option apply specifically
to the solanum protocol module once we have one, but we don't, plus
there isn't currently any precedent for config options added from
protocol modules.

The option is deliberately rehashable as the Solanum option is as well,
allowing a synchronized change in configuration across a network without
requiring restarts.

Nicole Kleinhoff (Apr 24, 2021, 9:31 PM UTC) 7ad22f4e 4fa0e03b

+63 -10
+11
dist/atheme.conf.example
··· 2840 2840 * whether or not to hide oper status in remote whois 2841 2841 */ 2842 2842 #hide_opers; 2843 + 2844 + /* (*)(B) match_masks_through_vhost 2845 + * 2846 + * This enables matching of bans as well as channel access entries 2847 + * based on the real host/IP behind a vhost. 2848 + * 2849 + * You should only disable this if your ircd has been configured 2850 + * to not match bans through vhosts either; otherwise, services 2851 + * will be inconsistent with ircd behaviour. 2852 + */ 2853 + match_masks_through_vhost; 2843 2854 }; 2844 2855 2845 2856
+1
include/atheme/global.h
··· 96 96 bool show_entity_id; // do not require user:auspex to see entity IDs 97 97 bool load_database_mdeps; // for core module deps listed in DB, whether to load them or abort 98 98 bool hide_opers; // whether or not to hide RPL_WHOISOPERATOR from remote whois 99 + bool masks_through_vhost; // whether masks match the host/IP behind a vhost 99 100 }; 100 101 101 102 extern struct ConfOption config_options;
+1
libathemecore/conf.c
··· 296 296 add_bool_conf_item("DB_SAVE_BLOCKING", &conf_gi_table, 0, &config_options.db_save_blocking, false); 297 297 add_dupstr_conf_item("OPERSTRING", &conf_gi_table, 0, &config_options.operstring, "is an IRC Operator"); 298 298 add_dupstr_conf_item("SERVICESTRING", &conf_gi_table, 0, &config_options.servicestring, "is a Network Service"); 299 + add_bool_conf_item("MATCH_MASKS_THROUGH_VHOST", &conf_gi_table, 0, &config_options.masks_through_vhost, true); 299 300 300 301 /* XXX: These 3 options should probably move into operserv/clones eventually */ 301 302 add_uint_conf_item("DEFAULT_CLONE_ALLOWED", &conf_gi_table, 0, &config_options.default_clone_allowed, 1, INT_MAX, 5);
+9 -1
libathemecore/phandler.c
··· 344 344 345 345 snprintf(hostbuf, sizeof hostbuf, "%s!%s@%s", u->nick, u->user, u->vhost); 346 346 snprintf(cloakbuf, sizeof cloakbuf, "%s!%s@%s", u->nick, u->user, u->chost); 347 + 348 + bool result = !match(mask, hostbuf) || !match(mask, cloakbuf); 349 + 350 + // return if configured not to check further, or if we already have a match 351 + if ((!config_options.masks_through_vhost && u->host != u->vhost) || result) 352 + return result; 353 + 347 354 snprintf(realbuf, sizeof realbuf, "%s!%s@%s", u->nick, u->user, u->host); 348 355 /* will be nick!user@ if ip unknown, doesn't matter */ 349 356 snprintf(ipbuf, sizeof ipbuf, "%s!%s@%s", u->nick, u->user, u->ip); 350 357 351 - return !match(mask, hostbuf) || !match(mask, cloakbuf) || !match(mask, realbuf) || !match(mask, ipbuf) || (ircd->flags & IRCD_CIDR_BANS && !match_cidr(mask, ipbuf)); 358 + return !match(mask, realbuf) || !match(mask, ipbuf) || (ircd->flags & IRCD_CIDR_BANS && !match_cidr(mask, ipbuf)); 359 + 352 360 } 353 361 354 362 mowgli_node_t *
+9 -2
modules/protocol/charybdis.c
··· 179 179 char hostgbuf[NICKLEN + 1 + USERLEN + 1 + HOSTLEN + 1 + GECOSLEN + 1]; 180 180 char realgbuf[NICKLEN + 1 + USERLEN + 1 + HOSTLEN + 1 + GECOSLEN + 1]; 181 181 182 + bool check_realhost = (config_options.masks_through_vhost || u->host == u->vhost); 183 + 182 184 snprintf(hostgbuf, sizeof hostgbuf, "%s!%s@%s#%s", u->nick, u->user, u->vhost, u->gecos); 183 185 snprintf(realgbuf, sizeof realgbuf, "%s!%s@%s#%s", u->nick, u->user, u->host, u->gecos); 184 - return !match(mask, hostgbuf) || !match(mask, realgbuf); 186 + return !match(mask, hostgbuf) || (check_realhost && !match(mask, realgbuf)); 185 187 } 186 188 187 189 static mowgli_node_t * ··· 203 205 204 206 // will be nick!user@ if ip unknown, doesn't matter 205 207 snprintf(ipbuf, sizeof ipbuf, "%s!%s@%s", u->nick, u->user, u->ip); 208 + 209 + bool check_realhost = (config_options.masks_through_vhost || u->host == u->vhost); 206 210 207 211 MOWGLI_ITER_FOREACH(n, first) 208 212 { ··· 223 227 if (p != NULL && p != strippedmask) 224 228 *p = 0; 225 229 226 - if ((!match(strippedmask, hostbuf) || !match(strippedmask, realbuf) || !match(strippedmask, ipbuf) || !match_cidr(strippedmask, ipbuf))) 230 + if (!match(strippedmask, hostbuf)) 231 + return n; 232 + if (check_realhost && (!match(strippedmask, realbuf) || !match(strippedmask, ipbuf) || !match_cidr(strippedmask, ipbuf))) 227 233 return n; 234 + 228 235 if (strippedmask[0] == '$') 229 236 { 230 237 p = strippedmask + 1;
+9 -2
modules/protocol/chatircd1.1.c
··· 93 93 char hostgbuf[NICKLEN + 1 + USERLEN + 1 + HOSTLEN + 1 + GECOSLEN + 1]; 94 94 char realgbuf[NICKLEN + 1 + USERLEN + 1 + HOSTLEN + 1 + GECOSLEN + 1]; 95 95 96 + bool check_realhost = (config_options.masks_through_vhost || u->host == u->vhost); 97 + 96 98 snprintf(hostgbuf, sizeof hostgbuf, "%s!%s@%s#%s", u->nick, u->user, u->vhost, u->gecos); 97 99 snprintf(realgbuf, sizeof realgbuf, "%s!%s@%s#%s", u->nick, u->user, u->host, u->gecos); 98 - return !match(mask, hostgbuf) || !match(mask, realgbuf); 100 + return !match(mask, hostgbuf) || (check_realhost && !match(mask, realgbuf)); 99 101 } 100 102 101 103 /* Check if the user is both *NOT* identified to services, and ··· 143 145 // will be nick!user@ if ip unknown, doesn't matter 144 146 snprintf(ipbuf, sizeof ipbuf, "%s!%s@%s", u->nick, u->user, u->ip); 145 147 148 + bool check_realhost = (config_options.masks_through_vhost || u->host == u->vhost); 149 + 146 150 MOWGLI_ITER_FOREACH(n, first) 147 151 { 148 152 cb = n->data; ··· 161 165 if (p != NULL && p != strippedmask) 162 166 *p = 0; 163 167 164 - if ((!match(strippedmask, hostbuf) || !match(strippedmask, realbuf) || !match(strippedmask, ipbuf) || !match_cidr(strippedmask, ipbuf))) 168 + if (!match(strippedmask, hostbuf)) 169 + return n; 170 + if (check_realhost && (!match(strippedmask, realbuf) || !match(strippedmask, ipbuf) || !match_cidr(strippedmask, ipbuf))) 165 171 return n; 172 + 166 173 if (strippedmask[0] == '$') 167 174 { 168 175 p = strippedmask + 1;
+8 -2
modules/protocol/inspircd.c
··· 125 125 // will be nick!user@ if ip unknown, doesn't matter 126 126 snprintf(ipbuf, sizeof ipbuf, "%s!%s@%s", u->nick, u->user, u->ip); 127 127 128 + bool check_realhost = (config_options.masks_through_vhost || u->host == u->vhost); 129 + 128 130 MOWGLI_ITER_FOREACH(n, first) 129 131 { 130 132 struct channel *target_c; ··· 134 136 if (cb->type != type) 135 137 continue; 136 138 137 - if ((!match(cb->mask, hostbuf) || !match(cb->mask, realbuf) || !match(cb->mask, ipbuf)) || !match_cidr(cb->mask, ipbuf)) 139 + if (!match(cb->mask, hostbuf)) 140 + return n; 141 + if (check_realhost && (!match(cb->mask, realbuf) || !match(cb->mask, ipbuf) || !match_cidr(cb->mask, ipbuf))) 138 142 return n; 139 143 140 144 if (cb->mask[1] == ':' && strchr("MRUjrm", cb->mask[0])) ··· 168 172 matched = !match(p, u->gecos); 169 173 break; 170 174 case 'm': 171 - matched = (!match(p, hostbuf) || !match(p, realbuf) || !match(p, ipbuf)) || !match_cidr(p, ipbuf); 175 + matched = !match(p, hostbuf); 176 + if (check_realhost && !matched) 177 + matched = !match(p, realbuf) || !match(p, ipbuf) || !match_cidr(p, ipbuf); 172 178 break; 173 179 default: 174 180 continue;
+6 -1
modules/protocol/unreal.c
··· 260 260 // will be nick!user@ if ip unknown, doesn't matter 261 261 snprintf(ipbuf, sizeof ipbuf, "%s!%s@%s", u->nick, u->user, u->ip); 262 262 263 + bool check_realhost = (config_options.masks_through_vhost || u->host == u->vhost); 264 + 263 265 MOWGLI_ITER_FOREACH(n, first) 264 266 { 265 267 cb = n->data; ··· 267 269 if (cb->type != type) 268 270 continue; 269 271 270 - if ((!match(cb->mask, hostbuf) || !match(cb->mask, realbuf) || !match(cb->mask, ipbuf))) 272 + if (!match(cb->mask, hostbuf)) 273 + return n; 274 + if (check_realhost && (!match(cb->mask, realbuf) || !match(cb->mask, ipbuf))) 271 275 return n; 276 + 272 277 if (cb->mask[0] == '~') 273 278 { 274 279 p = cb->mask + 1;
+9 -2
modules/protocol/unreal4.c
··· 233 233 // will be nick!user@ if ip unknown, doesn't matter 234 234 snprintf(ipbuf, sizeof ipbuf, "%s!%s@%s", u->nick, u->user, u->ip); 235 235 236 + bool check_realhost = (config_options.masks_through_vhost || u->host == u->vhost); 237 + 236 238 MOWGLI_ITER_FOREACH(n, first) 237 239 { 238 240 cb = n->data; ··· 240 242 if (cb->type != type) 241 243 continue; 242 244 243 - if ((!match(cb->mask, hostbuf) || !match(cb->mask, realbuf) || !match(cb->mask, ipbuf))) 245 + if (!match(cb->mask, hostbuf)) 246 + return n; 247 + if (check_realhost && (!match(cb->mask, realbuf) || !match(cb->mask, ipbuf))) 244 248 return n; 249 + 245 250 if (cb->mask[0] == '~') 246 251 { 247 252 p = cb->mask + 1; ··· 276 281 matched = should_reg_umode(u); 277 282 break; 278 283 case 'q': 279 - matched = !match(p, hostbuf) || !match(p, ipbuf); 284 + matched = !match(p, hostbuf); 285 + if (check_realhost && !matched) 286 + matched = !match(p, ipbuf); 280 287 break; 281 288 default: 282 289 continue;