From e68d2dad18262653145a7d02a1aec54272e6050e Mon Sep 17 00:00:00 2001 From: Dave West Date: Wed, 13 Feb 2008 19:04:57 +0000 Subject: [PATCH] We are unable to purge users that have no name but the auto purger seems to be finding some. Altered the code so that we do not create a Users Purged message if we try to purge a user with no name. Instead we create a User Corrupt message containing the user number of every user with no name. These users shouldn't exist so we need to find out where they are coming from. --- citadel/modules/expire/serv_expire.c | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/citadel/modules/expire/serv_expire.c b/citadel/modules/expire/serv_expire.c index 96569d7a1..80d38c48c 100644 --- a/citadel/modules/expire/serv_expire.c +++ b/citadel/modules/expire/serv_expire.c @@ -114,6 +114,7 @@ struct ValidRoom *ValidRoomList = NULL; struct ValidUser *ValidUserList = NULL; int messages_purged; int users_not_purged; +char *users_corrupt_msg = NULL; struct ctdlroomref *rr = NULL; @@ -383,6 +384,7 @@ void do_uid_user_purge(struct ctdluser *us, void *data) { + /* * Back end function to check user accounts for expiration. */ @@ -441,6 +443,28 @@ void do_user_purge(struct ctdluser *us, void *data) { * also impossible. */ if (us->usernum < 1L) purge = 1; + + /* If the user has no full name entry then we can't purge them + * since the actual purge can't find them. + * This shouldn't happen but does somehow. + * So we make an Aide message to alert to it but don't add it to the purge list + */ + if (IsEmptyStr(us->fullname)) + { + purge=0; + if (users_corrupt_msg == NULL) + { + users_corrupt_msg = malloc(SIZ); + strcpy(users_corrupt_msg, "The auto-purger found the following user numbers with no name.\n" + "Unfortunately the auto-purger is not yet able to fix this problem.\n" + "This problem is not considered serious since a user with no name can\n" + "not log in.\n"); + } + + users_corrupt_msg=realloc(users_corrupt_msg, strlen(users_corrupt_msg)+SIZ); + snprintf(&users_corrupt_msg[strlen(users_corrupt_msg)], SIZ, " %ld\n", us->usernum); + } + if (purge == 1) { pptr = (struct PurgeList *) malloc(sizeof(struct PurgeList)); @@ -508,6 +532,14 @@ int PurgeUsers(void) { if (num_users_purged > 0) aide_message(transcript, "User Purge Message"); free(transcript); + if(users_corrupt_msg) + { + aide_message(users_corrupt_msg, "User Corruption Message"); + free (users_corrupt_msg); + users_corrupt_msg = NULL; + } + + lprintf(CTDL_DEBUG, "Purged %d users.\n", num_users_purged); return(num_users_purged); } -- 2.30.2