From: Chris Porter Date: Sun, 24 Jan 2016 14:48:00 +0000 (+0000) Subject: CHANSERV: don't delete the last user/channel to prevent id reuse X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/refs/pull/4/head CHANSERV: don't delete the last user/channel to prevent id reuse --- diff --git a/chanserv/chanserv_cleanupdb.c b/chanserv/chanserv_cleanupdb.c index 210c99eb..3dd3131c 100644 --- a/chanserv/chanserv_cleanupdb.c +++ b/chanserv/chanserv_cleanupdb.c @@ -102,6 +102,10 @@ static void cleanupdb_real(DBConn *dbconn, void *arg) { if (anp->marker == themarker) continue; + /* HACK: don't ever delete the last user -- prevents userids being reused */ + if (vrup->ID == lastuserID) + continue; + if(!anp->nicks && !UHasStaffPriv(vrup) && !UIsCleanupExempt(vrup)) { if(vrup->lastauth && (vrup->lastauth < to_age)) { expired++; @@ -126,6 +130,10 @@ static void cleanupdb_real(DBConn *dbconn, void *arg) { if (!(rcp=cip->exts[chanservext])) continue; + /* HACK: don't ever delete the last channel -- prevents channelids being reused */ + if (rcp->ID == lastchannelID) + continue; + /* there's a bug here... if no joins or modes are done within the threshold * and someone leaves just before the cleanup then the channel will be nuked. */