return NULL;
}
-/* void find_exact_conf_by_address(const char*, int, const char *)
- * Input:
- * Output: ConfItem if found
- * Side-effects: None
- */
struct ConfItem *
-find_exact_conf_by_address(const char *address, int type, const char *username)
+find_exact_conf_by_address_filtered(const char *address, int type, const char *username, bool (*filter)(struct ConfItem *))
{
int masktype, bits;
unsigned long hv;
arec->masktype == masktype &&
(arec->username == NULL || username == NULL ? arec->username == username : !irccmp(arec->username, username)))
{
+ if (filter && !filter(arec->aconf))
+ continue;
+
if (masktype == HM_HOST)
{
if (!irccmp(arec->Mask.hostname, address))
return NULL;
}
+/* void find_exact_conf_by_address(const char*, int, const char *)
+ * Input:
+ * Output: ConfItem if found
+ * Side-effects: None
+ */
+struct ConfItem *
+find_exact_conf_by_address(const char *address, int type, const char *username)
+{
+ return find_exact_conf_by_address_filtered(address, type, username, NULL);
+}
+
/* void add_conf_by_address(const char*, int, const char *,
* struct ConfItem *aconf)
* Input:
* them, otherwise sets them as illegal.
*/
void
-clear_out_address_conf(void)
+clear_out_address_conf(enum aconf_category clear_type)
{
int i;
struct AddressRec **store_next;
store_next = &atable[i];
for (arec = atable[i]; arec; arec = arecn)
{
+ enum aconf_category cur_type;
arecn = arec->next;
- /* We keep the temporary K-lines and destroy the
- * permanent ones, just to be confusing :) -A1kmm */
- if(arec->aconf->flags & CONF_FLAGS_TEMPORARY ||
- (arec->type != CONF_CLIENT && arec->type != CONF_EXEMPTDLINE && arec->type != CONF_SECURE))
- {
- *store_next = arec;
- store_next = &arec->next;
- }
- else
- {
- arec->aconf->status |= CONF_ILLEGAL;
- if(!arec->aconf->clients)
- free_conf(arec->aconf);
- rb_free(arec);
- }
- }
- *store_next = NULL;
- }
-}
-void
-clear_out_address_conf_bans(void)
-{
- int i;
- struct AddressRec **store_next;
- struct AddressRec *arec, *arecn;
+ if (arec->type == CONF_CLIENT || arec->type == CONF_EXEMPTDLINE || arec->type == CONF_SECURE)
+ cur_type = AC_CONFIG;
+ else
+ cur_type = AC_BANDB;
- for (i = 0; i < ATABLE_SIZE; i++)
- {
- store_next = &atable[i];
- for (arec = atable[i]; arec; arec = arecn)
- {
- arecn = arec->next;
/* We keep the temporary K-lines and destroy the
* permanent ones, just to be confusing :) -A1kmm */
- if(arec->aconf->flags & CONF_FLAGS_TEMPORARY ||
- (arec->type == CONF_CLIENT || arec->type == CONF_EXEMPTDLINE || arec->type == CONF_SECURE))
+ if (arec->aconf->flags & CONF_FLAGS_TEMPORARY || cur_type != clear_type)
{
*store_next = arec;
store_next = &arec->next;
}
}
-
/*
* show_iline_prefix()
*
*prefix_ptr++ = '+';
if(IsConfDoSpoofIp(aconf))
*prefix_ptr++ = '=';
+ if(IsNeedSasl(aconf))
+ *prefix_ptr++ = '%';
if(IsOper(sptr) && IsConfExemptFlood(aconf))
*prefix_ptr++ = '|';
if(IsOper(sptr) && IsConfExemptDNSBL(aconf) && !IsConfExemptKline(aconf))
*prefix_ptr++ = '^';
if(IsOper(sptr) && IsConfExemptLimits(aconf))
*prefix_ptr++ = '>';
- *prefix_ptr = '\0';
- strncpy(prefix_ptr, name, USERLEN);
+ rb_strlcpy(prefix_ptr, name, USERLEN + 1);
return (prefix_of_host);
}
void
report_auth(struct Client *client_p)
{
- char *name, *host, *user, *classname;
+ char *name, *host, *user, *classname, *desc;
const char *pass;
struct AddressRec *arec;
struct ConfItem *aconf;
continue;
get_printable_conf(aconf, &name, &host, &pass, &user, &port,
- &classname);
+ &classname, &desc);
if(!EmptyString(aconf->spasswd))
pass = aconf->spasswd;
form_str(RPL_STATSILINE),
name, pass, show_iline_prefix(client_p, aconf, user),
show_ip_conf(aconf, client_p) ? host : "255.255.255.255",
- port, classname);
+ port, classname, desc);
}
}