Fixed mbuser killing new users

This commit is contained in:
Michiel Broek 2002-02-19 20:51:05 +00:00
parent ca54df4fb2
commit c5f1e966e6
3 changed files with 17 additions and 2 deletions

View File

@ -4640,3 +4640,8 @@ v0.33.20 10-Feb-2002
On some systems the download taglists contained garbage after On some systems the download taglists contained garbage after
the short filename causing wrong filenames at the users side. 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.

View File

@ -169,7 +169,7 @@ int unpack(char *fn)
} else { } else {
sync(); sync();
sleep(1); 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) { if ((rc = execute(cmd,fn,(char *)NULL,(char*)"/dev/null",(char*)"/dev/null",(char*)"/dev/null")) == 0) {
unlink(fn); unlink(fn);
} else { } else {

View File

@ -175,6 +175,7 @@ void UserPack(int days, int level, int pack)
char *fnin, *fnout; char *fnin, *fnout;
long oldsize, curpos; long oldsize, curpos;
int updated, delete = 0, rc, highest = 0, record = 0, sysop = FALSE; int updated, delete = 0, rc, highest = 0, record = 0, sysop = FALSE;
time_t Last;
fnin = calloc(PATH_MAX, sizeof(char)); fnin = calloc(PATH_MAX, sizeof(char));
fnout = 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); curpos = sizeof(usrhdr);
while (fread(&usr, sizeof(usr), 1, fout) == 1) { 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 * Wow, killing on the second exact!. Don't kill
* the guest accounts. * the guest accounts.
*/ */
if ((((t_start - usr.tLastLoginDate) / 86400) > days) && if ((((t_start - Last) / 86400) > days) &&
(usr.Security.level < level) && (!usr.Guest) && (usr.Security.level < level) && (!usr.Guest) &&
(usr.sUserName[0] != '\0') && (!usr.NeverDelete)) { (usr.sUserName[0] != '\0') && (!usr.NeverDelete)) {
Syslog('+', "Mark user %s", usr.sUserName); Syslog('+', "Mark user %s", usr.sUserName);