From: Dave West Date: Tue, 15 Jan 2008 14:15:06 +0000 (+0000) Subject: Now the autopurger will always attempt to purge users regardless of the X-Git-Tag: v7.86~2603 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=291821350831b9569546232b24bc75e3c5b34c85 Now the autopurger will always attempt to purge users regardless of the "Default user purge time" but it will not purge users on time if it is disabled. This change added so that dead users are removed if need be. Check this out guys. The changes are simple but lots of possible things to test with catastrophic results if I got it wrong. This should mean that users that have been deleted but not purged and users that want to be deleted get deleted even if the user purge is turned off. Only deleteing users based on time is disabled if the user purge is 0. --- diff --git a/citadel/modules/expire/serv_expire.c b/citadel/modules/expire/serv_expire.c index eaff4280b..96569d7a1 100644 --- a/citadel/modules/expire/serv_expire.c +++ b/citadel/modules/expire/serv_expire.c @@ -403,16 +403,14 @@ void do_user_purge(struct ctdluser *us, void *data) { /* The default rule is to not purge. */ purge = 0; - /* If the user hasn't called in two months, his/her account + /* If the user hasn't called in two months and expiring of accounts is turned on, his/her account * has expired, so purge the record. */ - now = time(NULL); - if ((now - us->lastcall) > purge_time) purge = 1; - - /* If the user set his/her password to 'deleteme', he/she - * wishes to be deleted, so purge the record. - */ - if (!strcasecmp(us->password, "deleteme")) purge = 1; + if (config.c_userpurge > 0) + { + now = time(NULL); + if ((now - us->lastcall) > purge_time) purge = 1; + } /* If the record is marked as permanent, don't purge it. */ @@ -428,6 +426,12 @@ void do_user_purge(struct ctdluser *us, void *data) { */ if (us->axlevel == 0) purge = 1; + /* If the user set his/her password to 'deleteme', he/she + * wishes to be deleted, so purge the record. + * Moved this lower down so that aides and permanent users get purged if they ask to be. + */ + if (!strcasecmp(us->password, "deleteme")) purge = 1; + /* 0 calls is impossible. If there are 0 calls, it must * be a corrupted record, so purge it. */ @@ -462,9 +466,7 @@ int PurgeUsers(void) { switch(config.c_auth_mode) { case AUTHMODE_NATIVE: - if (config.c_userpurge > 0) { - ForEachUser(do_user_purge, NULL); - } + ForEachUser(do_user_purge, NULL); break; case AUTHMODE_HOST: ForEachUser(do_uid_user_purge, NULL);