mirror of
https://github.com/pissnet/pissircd.git
synced 2025-08-08 19:25:25 +01:00
Fix issue with duplicate entries in the +b/+e/+I list of +P channels.
This was caused by the transition from letter extbans (eg ~a) to
named extbans (eg ~account) and a combination of the bug fix in 6.0.2
(60a70acd86
) and the 'channeldb' module
not checking for duplicates while reading the database.
Reported by PeGaSuS in https://bugs.unrealircd.org/view.php?id=6091
This commit is contained in:
parent
a9de2696d4
commit
3451919b06
1 changed files with 20 additions and 4 deletions
|
@ -359,6 +359,14 @@ int write_channel_entry(UnrealDB *db, const char *tmpfname, Channel *channel)
|
|||
return 1;
|
||||
}
|
||||
|
||||
int ban_exists(Ban *lst, Ban *e)
|
||||
{
|
||||
for (; lst; lst = lst->next)
|
||||
if (!mycmp(lst->banstr, e->banstr))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define R_SAFE(x) \
|
||||
do { \
|
||||
if (!(x)) { \
|
||||
|
@ -401,10 +409,18 @@ int read_listmode(UnrealDB *db, Ban **lst)
|
|||
}
|
||||
safe_strdup(e->banstr, str);
|
||||
|
||||
/* Add to list */
|
||||
e->when = when;
|
||||
e->next = *lst;
|
||||
*lst = e;
|
||||
if (ban_exists(*lst, e))
|
||||
{
|
||||
/* Free again - duplicate item */
|
||||
safe_free(e->banstr);
|
||||
safe_free(e->who);
|
||||
safe_free(e);
|
||||
} else {
|
||||
/* Add to list */
|
||||
e->when = when;
|
||||
e->next = *lst;
|
||||
*lst = e;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue