From c5f1e966e6a539664ebf1dc77d665ecfc5938a91 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Tue, 19 Feb 2002 20:51:05 +0000 Subject: [PATCH] Fixed mbuser killing new users --- ChangeLog | 5 +++++ mbfido/ulock.c | 2 +- mbsebbs/mbuser.c | 12 +++++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79c4568f..3eb2debc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4640,3 +4640,8 @@ v0.33.20 10-Feb-2002 On some systems the download taglists contained garbage after the short filename causing wrong filenames at the users side. + mbuser: + If a new user has registered and not yet used the bbs, mbuser + would kill that user because the last login date wasn't set. + It will use the registration date instead. + diff --git a/mbfido/ulock.c b/mbfido/ulock.c index 82d3d29a..cad3d4ec 100644 --- a/mbfido/ulock.c +++ b/mbfido/ulock.c @@ -169,7 +169,7 @@ int unpack(char *fn) } else { sync(); sleep(1); - Syslog('!', "Warning: unpack %s failed, trying again after sync()"); + Syslog('!', "Warning: unpack %s failed, trying again after sync()", fn); if ((rc = execute(cmd,fn,(char *)NULL,(char*)"/dev/null",(char*)"/dev/null",(char*)"/dev/null")) == 0) { unlink(fn); } else { diff --git a/mbsebbs/mbuser.c b/mbsebbs/mbuser.c index 095ec74f..5de26b51 100644 --- a/mbsebbs/mbuser.c +++ b/mbsebbs/mbuser.c @@ -175,6 +175,7 @@ void UserPack(int days, int level, int pack) char *fnin, *fnout; long oldsize, curpos; int updated, delete = 0, rc, highest = 0, record = 0, sysop = FALSE; + time_t Last; fnin = calloc(PATH_MAX, sizeof(char)); fnout = calloc(PATH_MAX, sizeof(char)); @@ -257,11 +258,20 @@ void UserPack(int days, int level, int pack) curpos = sizeof(usrhdr); while (fread(&usr, sizeof(usr), 1, fout) == 1) { + /* + * New users don't have the last login date set yet, + * use the registration date instead. + */ + if (usr.iTotalCalls == 0) + Last = usr.tFirstLoginDate; + else + Last = usr.tLastLoginDate; + /* * Wow, killing on the second exact!. Don't kill * the guest accounts. */ - if ((((t_start - usr.tLastLoginDate) / 86400) > days) && + if ((((t_start - Last) / 86400) > days) && (usr.Security.level < level) && (!usr.Guest) && (usr.sUserName[0] != '\0') && (!usr.NeverDelete)) { Syslog('+', "Mark user %s", usr.sUserName);