Several updates for IsDoing information

This commit is contained in:
Michiel Broek 2002-11-11 14:52:13 +00:00
parent b314568630
commit 919b9ed3ba
11 changed files with 435 additions and 401 deletions

View File

@ -23,11 +23,29 @@ v0.35.05 19-Oct-2002
mbsebbs:
Email posted at the bbs was not signed with the signature.
Fixed the bug where the filearea number was lost. This was
caused when a user was logged off before the login procedure
was complete.
If user was displaying the whoson list and there was no
matching isdoing action then browsing will be displayed
instead of system error.
Sends Unix name instead of long name to mbtask.
During login the OS and CPU type is displayed.
mbnewusr:
Sends Unix name instead of long name to mbtask.
During login the OS and CPU type is displayed.
mbmon:
In screen 1, username field decreased ro 8 characters and the
doing field is increased to 26 characters.
mbcico:
Fixed crash with incoming YooHoo session with bad password.
Still used the phone override fields for hostname override
with internet calls if there was something filled in.
For inbound sessions if the remote is listed in some nodelist,
mbtask is updated with the sysop name and location.
mbout:
The stat command now also shows what is on hold for a node

View File

@ -69,6 +69,8 @@ static int binkp_batch(file_list *, int);
extern char *ttystat[];
extern int Loaded;
extern pid_t mypid;
extern unsigned long sentbytes;
extern unsigned long rcvdbytes;
@ -412,7 +414,7 @@ SM_STATE(waitconn)
Loaded = FALSE;
Syslog('+', "Start binkp session with %s", ascfnode(remote->addr, 0x1f));
IsDoing("Connect binkp %s", ascfnode(remote->addr, 0x1f));
IsDoing("Connect binkp %s", ascfnode(remote->addr, 0xf));
b_banner(TRUE);
binkp_send_control(MM_NUL,"OPT MB CRC");
@ -660,6 +662,7 @@ SM_STATE(waitaddr)
if (inbound)
free(inbound);
inbound = xstrcpy(CFG.inbound);
UserCity(mypid, nlent->sysop, nlent->location);
break;
}
}
@ -820,7 +823,7 @@ int binkp_batch(file_list *to_send, int role)
batchnr++;
Syslog('+', "Binkp: starting batch %d", batchnr);
IsDoing("Binkp %s %s", (role == 1)?"out":"inb", ascfnode(remote->addr, 0x1f));
IsDoing("Binkp %s %s", (role == 1)?"out":"inb", ascfnode(remote->addr, 0xf));
txbuf = calloc(MAX_BLKSIZE + 3, sizeof(unsigned char));
rxbuf = calloc(MAX_BLKSIZE + 3, sizeof(unsigned char));
rname = calloc(512, sizeof(char));

View File

@ -58,6 +58,7 @@ static char *intro;
static int caller;
extern int most_debug;
extern pid_t mypid;
int emsi_local_lcodes;
int emsi_remote_lcodes;
@ -137,6 +138,7 @@ int rx_emsi(char *data)
if (inbound)
free(inbound);
inbound = xstrcpy(CFG.inbound);
UserCity(mypid, nlent->sysop, nlent->location);
break;
}
if (nlent)

View File

@ -59,6 +59,8 @@ static int txftsc(void);
static int recvfiles(void);
static file_list *tosend;
extern int Loaded;
extern pid_t mypid;
int rx_ftsc(void)
@ -365,131 +367,134 @@ SM_RETURN
SM_DECL(recvfiles,(char *)"recvfiles")
SM_STATES
recv_packet,
scan_packet,
recv_file
recv_packet,
scan_packet,
recv_file
SM_NAMES
(char *)"recv_packet",
(char *)"scan_packet",
(char *)"recv_file"
(char *)"recv_packet",
(char *)"scan_packet",
(char *)"recv_file"
SM_EDECL
int rc=0;
char recvpktname[16];
char *fpath;
FILE *fp;
faddr f,t;
fa_list **tmpl;
int rc=0;
char recvpktname[16];
char *fpath;
FILE *fp;
faddr f, t;
fa_list **tmpl;
SM_START(recv_packet)
Loaded = FALSE;
Loaded = FALSE;
SM_STATE(recv_packet)
sprintf(recvpktname,"%08lx.pkt",(unsigned long)sequencer());
if ((rc = xmrecv(recvpktname)) == 1) {
SM_SUCCESS;
} else if (rc == 0) {
if (master) {
SM_PROCEED(recv_file);
} else {
SM_PROCEED(scan_packet);
}
sprintf(recvpktname,"%08lx.pkt",(unsigned long)sequencer());
if ((rc = xmrecv(recvpktname)) == 1) {
SM_SUCCESS;
} else if (rc == 0) {
if (master) {
SM_PROCEED(recv_file);
} else {
SM_ERROR;
SM_PROCEED(scan_packet);
}
} else {
SM_ERROR;
}
SM_STATE(scan_packet)
fpath = xstrcpy(inbound);
fpath = xstrcat(fpath,(char *)"/");
fpath = xstrcat(fpath,recvpktname);
fp = fopen(fpath,"r");
free(fpath);
if (fp == NULL) {
WriteError("$cannot open received packet");
fpath = xstrcpy(inbound);
fpath = xstrcat(fpath,(char *)"/");
fpath = xstrcat(fpath,recvpktname);
fp = fopen(fpath,"r");
free(fpath);
if (fp == NULL) {
WriteError("$cannot open received packet");
SM_ERROR;
}
switch (getheader(&f , &t, fp, recvpktname)) {
case 3: Syslog('+', "remote mistook us for %s",ascfnode(&t,0x1f));
fclose(fp);
SM_ERROR;
}
switch (getheader(&f , &t, fp, recvpktname)) {
case 3: Syslog('+', "remote mistook us for %s",ascfnode(&t,0x1f));
fclose(fp);
SM_ERROR;
case 0: Syslog('+', "accepting session");
fclose(fp);
for (tmpl=&remote;*tmpl;tmpl=&((*tmpl)->next));
(*tmpl)=(fa_list*)malloc(sizeof(fa_list));
(*tmpl)->next=NULL;
(*tmpl)->addr=(faddr*)malloc(sizeof(faddr));
(*tmpl)->addr->zone=f.zone;
(*tmpl)->addr->net=f.net;
(*tmpl)->addr->node=f.node;
(*tmpl)->addr->point=f.point;
(*tmpl)->addr->name=NULL;
(*tmpl)->addr->domain=NULL;
for (tmpl=&remote;*tmpl;tmpl=&((*tmpl)->next)) {
(void)nodelock((*tmpl)->addr);
/* try lock all remotes, ignore locking result */
if (!Loaded)
if (noderecord((*tmpl)->addr))
Loaded = TRUE;
}
case 0: Syslog('+', "accepting session");
fclose(fp);
for (tmpl=&remote;*tmpl;tmpl=&((*tmpl)->next));
(*tmpl)=(fa_list*)malloc(sizeof(fa_list));
(*tmpl)->next=NULL;
(*tmpl)->addr=(faddr*)malloc(sizeof(faddr));
(*tmpl)->addr->zone=f.zone;
(*tmpl)->addr->net=f.net;
(*tmpl)->addr->node=f.node;
(*tmpl)->addr->point=f.point;
(*tmpl)->addr->name=NULL;
(*tmpl)->addr->domain=NULL;
for (tmpl=&remote;*tmpl;tmpl=&((*tmpl)->next)) {
(void)nodelock((*tmpl)->addr);
/* try lock all remotes, ignore locking result */
if (!Loaded)
if (noderecord((*tmpl)->addr))
Loaded = TRUE;
}
history.aka.zone = remote->addr->zone;
history.aka.net = remote->addr->net;
history.aka.node = remote->addr->node;
history.aka.point = remote->addr->point;
if (remote->addr->domain && strlen(remote->addr->domain))
sprintf(history.aka.domain, "%s", remote->addr->domain);
history.aka.zone = remote->addr->zone;
history.aka.net = remote->addr->net;
history.aka.node = remote->addr->node;
history.aka.point = remote->addr->point;
if (remote->addr->domain && strlen(remote->addr->domain))
sprintf(history.aka.domain, "%s", remote->addr->domain);
if (((nlent=getnlent(remote->addr))) && (nlent->pflag != NL_DUMMY)) {
Syslog('+', "remote is a listed system");
if (inbound)
free(inbound);
inbound = xstrcpy(CFG.inbound);
strncpy(history.system_name, nlent->name, 35);
strncpy(history.location, nlent->location, 35);
strncpy(history.sysop, nlent->sysop, 35);
} else {
sprintf(history.system_name, "Unknown");
sprintf(history.location, "Somewhere");
}
if (((nlent=getnlent(remote->addr))) && (nlent->pflag != NL_DUMMY)) {
Syslog('+', "remote is a listed system");
if (inbound)
free(inbound);
inbound = xstrcpy(CFG.inbound);
strncpy(history.system_name, nlent->name, 35);
strncpy(history.location, nlent->location, 35);
strncpy(history.sysop, nlent->sysop, 35);
UserCity(mypid, nlent->sysop, nlent->location);
} else {
sprintf(history.system_name, "Unknown");
sprintf(history.location, "Somewhere");
}
if (nlent)
rdoptions(Loaded);
if (nlent)
rdoptions(Loaded);
/*
* It appears that if the remote gave no password, the
* getheader function fills in a password itself. Maybe
* that's the reason why E.C did not switch to protected
* inbound, because of the failing password check. MB.
*/
if (f.name) {
Syslog('+', "Password correct, protected FTS-0001 session");
if (inbound)
free(inbound);
inbound = xstrcpy(CFG.pinbound);
}
/*
* It appears that if the remote gave no password, the
* getheader function fills in a password itself. Maybe
* that's the reason why E.C did not switch to protected
* inbound, because of the failing password check. MB.
*/
if (f.name) {
Syslog('+', "Password correct, protected FTS-0001 session");
if (inbound)
free(inbound);
inbound = xstrcpy(CFG.pinbound);
}
tosend = create_filelist(remote,(char *)ALL_MAIL,1);
if (rc == 0) {
SM_PROCEED(recv_file);
} else {
SM_SUCCESS;
}
default: Syslog('+', "received bad packet apparently from",ascfnode(&f,0x1f));
fclose(fp);
SM_ERROR;
}
tosend = create_filelist(remote,(char *)ALL_MAIL,1);
if (rc == 0) {
SM_PROCEED(recv_file);
} else {
SM_SUCCESS;
}
default:
Syslog('+', "received bad packet apparently from",ascfnode(&f,0x1f));
fclose(fp);
SM_ERROR;
}
SM_STATE(recv_file)
switch (xmrecv(NULL)) {
case 0: SM_PROCEED(recv_file);
break;
case 1: SM_SUCCESS;
break;
default: SM_ERROR;
break;
}
switch (xmrecv(NULL)) {
case 0: SM_PROCEED(recv_file);
break;
case 1: SM_SUCCESS;
break;
default: SM_ERROR;
break;
}
SM_END
SM_RETURN

View File

@ -114,6 +114,7 @@ typedef struct _Hello {
extern int Loaded;
extern pid_t mypid;
Hello hello2;
Hello gethello2(unsigned char[]);
@ -166,6 +167,7 @@ int rx_yoohoo(void)
free(inbound);
inbound = xstrcpy(CFG.inbound);
strncpy(history.location, nlent->location, 35);
UserCity(mypid, nlent->sysop, nlent->location);
}
if (nlent)
rdoptions(Loaded);

View File

@ -173,7 +173,7 @@ void system_moni(void)
set_color(WHITE, BLACK);
mvprintw( 5, 6, "1. SERVER CLIENTS");
set_color(YELLOW, RED);
mvprintw( 7, 1, "Pid tty user program city doing time ");
mvprintw( 7, 1, "Pid tty user program city doing time ");
set_color(CYAN, BLACK);
center_addstr(LINES - 4, (char *)"Press any key");
IsDoing("System Monitor");
@ -203,10 +203,10 @@ void system_moni(void)
cnt = strtok(buf, ",");
mvprintw(y, 1, (char *)"%.5s", strtok(NULL, ","));
mvprintw(y, 7, (char *)"%.6s", strtok(NULL, ","));
mvprintw(y,14, (char *)"%.16s", strtok(NULL, ","));
mvprintw(y,31, (char *)"%.8s", strtok(NULL, ","));
mvprintw(y,40, (char *)"%.15s", strtok(NULL, ","));
mvprintw(y,56, (char *)"%.18s", strtok(NULL, ","));
mvprintw(y,14, (char *)"%.8s", strtok(NULL, ","));
mvprintw(y,23, (char *)"%.8s", strtok(NULL, ","));
mvprintw(y,32, (char *)"%.15s", strtok(NULL, ","));
mvprintw(y,48, (char *)"%.26s", strtok(NULL, ","));
start = atoi(strtok(NULL, ";"));
now = time(NULL);
mvprintw(y,75, (char *)"%s", t_elapsed(start, now));

View File

@ -177,7 +177,7 @@ int main(int argc, char **argv)
}
colour(YELLOW, BLACK);
printf("MBSE BBS v%s (Release: %s)\n", VERSION, ReleaseDate);
printf("MBSE BBS v%s (Release: %s) on %s/%s\n", VERSION, ReleaseDate, OsName(), OsCPU());
colour(WHITE, BLACK);
printf("%s\n\n", COPYRIGHT);

View File

@ -175,7 +175,7 @@ int main(int argc, char **argv)
DisplayLogo();
colour(YELLOW, BLACK);
printf("MBSE BBS v%s (Release: %s)\n", VERSION, ReleaseDate);
printf("MBSE BBS v%s (Release: %s) on %s/%s\n", VERSION, ReleaseDate, OsName(), OsCPU());
colour(WHITE, BLACK);
printf("%s\n\n", COPYRIGHT);

View File

@ -147,7 +147,6 @@ int newuser()
} while (badname);
strcpy(FullName, tlcap(temp));
UserCity(mypid, FullName, (char *)"Unknown");
while (TRUE) {
Enter(1);
@ -187,6 +186,7 @@ int newuser()
sprintf(usrconfig.Password, "%s", temp2);
alarm_on();
sprintf(UnixName, "%s", (char *) NameCreate(NameGen(FullName), FullName, temp2));
UserCity(mypid, UnixName, (char *)"Unknown");
strcpy(usrconfig.sUserName, FullName);
strcpy(usrconfig.Name, UnixName);
@ -297,7 +297,7 @@ int newuser()
Enter(1);
} else {
strcpy(usrconfig.sLocation, temp);
UserCity(mypid, FullName, temp);
UserCity(mypid, UnixName, temp);
break;
}
}

View File

@ -203,331 +203,335 @@ void user()
grecno++;
}
if (!FoundName) {
printf("Unknown username: %s\n", sUnixName);
/* FATAL ERROR: You are not in the BBS users file.*/
printf("%s\n", (char *) Language(389));
/* Please run 'newuser' to create an account */
printf("%s\n", (char *) Language(390));
Syslog('?', "FATAL: Could not find user in BBS users file.");
Syslog('?', " and system is using unix accounts\n");
ExitClient(MBERR_OK);
if (!FoundName) {
printf("Unknown username: %s\n", sUnixName);
/* FATAL ERROR: You are not in the BBS users file.*/
printf("%s\n", (char *) Language(389));
/* Please run 'newuser' to create an account */
printf("%s\n", (char *) Language(390));
Syslog('?', "FATAL: Could not find user in BBS users file.");
Syslog('?', " and system is using unix accounts\n");
ExitClient(MBERR_OK);
}
/*
* Copy username, split first and lastname.
*/
strcpy(UserName, usrconfig.sUserName);
if ((strchr(UserName,' ') == NULL && !CFG.iOneName)) {
token = strtok(UserName, " ");
strcpy(FirstName, token);
token = strtok(NULL, "\0");
i = strlen(token);
for(x = 2; x < i; x++) {
if (token[x] == ' ')
token[x] = '\0';
}
strcpy(LastName, token);
} else
strcpy(FirstName, UserName);
strcpy(UserName, usrconfig.sUserName);
Syslog('+', "%s On-Line at %s", UserName, ttyinfo.comment);
IsDoing("Just Logged In");
/*
* Copy username, split first and lastname.
*/
strcpy(UserName, usrconfig.sUserName);
if ((strchr(UserName,' ') == NULL && !CFG.iOneName)) {
token = strtok(UserName, " ");
strcpy(FirstName, token);
token = strtok(NULL, "\0");
i = strlen(token);
for(x = 2; x < i; x++) {
if(token[x] == ' ')
token[x] = '\0';
}
strcpy(LastName, token);
} else
strcpy(FirstName, UserName);
strcpy(UserName, usrconfig.sUserName);
Syslog('+', "%s On-Line at %s", UserName, ttyinfo.comment);
IsDoing("Just Logged In");
/*
* Check some essential files, create them if they don't exist.
*/
ChkFiles();
/*
* Check some essential files, create them if they don't exist.
*/
ChkFiles();
/*
* Setup users favourite language.
*/
Set_Language(usrconfig.iLanguage);
Free_Language();
InitLanguage();
/*
* Setup users favourite language.
*/
Set_Language(usrconfig.iLanguage);
Free_Language();
InitLanguage();
/*
* User logged in, tell it to the server. Check if a location is
* set, if Ask User location for new users is off, this field is
* empty but we have to send something to the server.
*/
if (strlen(usrconfig.sLocation))
UserCity(mypid, usrconfig.Name, usrconfig.sLocation);
else
UserCity(mypid, usrconfig.Name, (char *)"N/A");
/*
* User logged in, tell it to the server. Check if a location is
* set, if Ask User location for new users is off, this field is
* empty but we have to send something to the server.
*/
if (strlen(usrconfig.sLocation))
UserCity(mypid, usrconfig.sUserName, usrconfig.sLocation);
else
UserCity(mypid, usrconfig.sUserName, (char *)"N/A");
/*
* Set last file and message area so these numbers are saved when
* the user hangs up or is logged off before het gets to the main
* menu. Later in this function the areas are set permanent.
*/
iAreaNumber = usrconfig.iLastFileArea;
iMsgAreaNumber = usrconfig.iLastMsgArea;
/*
* See if this user is the Sysop.
*/
strcpy(temp, UserName);
strcpy(temp1, CFG.sysop_name);
if ((strcasecmp(CFG.sysop_name, UserName)) == 0) {
/*
* Set last file and message area so these numbers are saved when
* the user hangs up or is logged off before het gets to the main
* menu. Later in this function the areas are set permanent.
* If login name is sysop, set SYSOP true
*/
iAreaNumber = usrconfig.iLastFileArea;
iLastMsgArea = usrconfig.iLastMsgArea;
SYSOP = TRUE;
Syslog('+', "Sysop is online");
}
/*
* See if this user is the Sysop.
/*
* Is this a new user?
*/
if (usrconfig.iTotalCalls == 0)
IsNew = TRUE;
TermInit(usrconfig.GraphMode);
/*
* Pause after logo screen.
*/
alarm_on();
Pause();
if (usrconfig.Archiver[0] == '\0') {
usrconfig.Archiver[0] = 'Z';
usrconfig.Archiver[1] = 'I';
usrconfig.Archiver[2] = 'P';
Syslog('+', "Setup default archiver ZIP");
}
/*
* Check users date format. We do it strict as we
* need this to be good for several other purposes.
* If it is correct, the users age is set in UserAge
*/
if (!Test_DOB(usrconfig.sDateOfBirth)) {
Syslog('!', "Error in Date of Birth");
Chg_DOB();
strcpy(usrconfig.sDateOfBirth, exitinfo.sDateOfBirth);
}
/*
* Check to see if user must expire
*/
sprintf(temp,"%s", (char *) GetDateDMY());
SwapDate(temp, usrconfig.sExpiryDate);
/* Convert Date1 & Date2 to longs for compare */
l1 = atol(Date1);
l2 = atol(Date2);
if (l1 >= l2 && l2 != 0) {
/*
* If Expiry Date is the same as today expire to
* Expire Sec level
*/
strcpy(temp, UserName);
strcpy(temp1, CFG.sysop_name);
if ((strcasecmp(CFG.sysop_name, UserName)) == 0) {
/*
* If login name is sysop, set SYSOP true
*/
SYSOP = TRUE;
Syslog('+', "Sysop is online");
usrconfig.Security = usrconfig.ExpirySec;
Syslog('!', "User is expired, resetting level");
/*
* Show texfile to user telling him about this.
*/
DisplayFile((char *)"expired");
}
free(Date1);
free(Date2);
/*
* Copy limits.data into memory
*/
sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT"));
if ((pLimits = fopen(temp,"rb")) == NULL) {
WriteError("$Can't open %s", temp);
} else {
fread(&LIMIThdr, sizeof(LIMIThdr), 1, pLimits);
while (fread(&LIMIT, sizeof(LIMIT), 1, pLimits) == 1) {
if (LIMIT.Security == usrconfig.Security.level) {
iFoundLimit = TRUE;
break;
}
}
fclose(pLimits);
}
if (!iFoundLimit) {
WriteError("Unknown Security Level in limits.data");
usrconfig.iTimeLeft = 0; /* Could not find limit, so set to Zero */
usrconfig.iTimeUsed = 0; /* Set to Zero as well */
} else {
/*
* Is this a new user?
*/
if (usrconfig.iTotalCalls == 0)
IsNew = TRUE;
TermInit(usrconfig.GraphMode);
/*
* Pause after logo screen.
*/
alarm_on();
Pause();
if (usrconfig.Archiver[0] == '\0') {
usrconfig.Archiver[0] = 'Z';
usrconfig.Archiver[1] = 'I';
usrconfig.Archiver[2] = 'P';
Syslog('+', "Setup default archiver ZIP");
}
/*
* Check users date format. We do it strict as we
* need this to be good for several other purposes.
* If it is correct, the users age is set in UserAge
*/
if (!Test_DOB(usrconfig.sDateOfBirth)) {
Syslog('!', "Error in Date of Birth");
Chg_DOB();
strcpy(usrconfig.sDateOfBirth, exitinfo.sDateOfBirth);
}
/*
* Check to see if user must expire
* Give user new time limit everyday, also new users get a new limit.
*/
sprintf(temp,"%s", (char *) GetDateDMY());
SwapDate(temp, usrconfig.sExpiryDate);
if (((strcmp(StrDateDMY(usrconfig.tLastLoginDate), temp)) != 0) || IsNew) {
/*
* If no timelimit set give user 24 hours.
*/
if (LIMIT.Time)
usrconfig.iTimeLeft = LIMIT.Time;
else
usrconfig.iTimeLeft = 86400;
usrconfig.iTimeUsed = 0; /* Set time used today to Zero */
usrconfig.iConnectTime = 0; /* Set connect time to Zero */
/* Convert Date1 & Date2 to longs for compare */
l1 = atol(Date1);
l2 = atol(Date2);
if (l1 >= l2 && l2 != 0) {
/*
* If Expiry Date is the same as today expire to
* Expire Sec level
*/
usrconfig.Security = usrconfig.ExpirySec;
Syslog('!', "User is expired, resetting level");
/*
* Show texfile to user telling him about this.
*/
DisplayFile((char *)"expired");
/*
* Give user new bytes and files every day if needed.
*/
if (LIMIT.DownK && LIMIT.DownF) {
usrconfig.DownloadKToday = LIMIT.DownK;
usrconfig.DownloadsToday = LIMIT.DownF;
}
}
} /* End of else */
free(Date1);
free(Date2);
usrconfig.iConnectTime = 0;
/*
* Copy limits.data into memory
*/
sprintf(temp, "%s/etc/limits.data", getenv("MBSE_ROOT"));
/* Copy Users Protocol into Memory */
Set_Protocol(usrconfig.sProtocol);
tlf(usrconfig.sProtocol);
if ((pLimits = fopen(temp,"rb")) == NULL) {
WriteError("$Can't open %s", temp);
} else {
fread(&LIMIThdr, sizeof(LIMIThdr), 1, pLimits);
/*
* Set last login Date and Time, copy previous session
* values in memory.
*/
sprintf(LastLoginDate, "%s", StrDateDMY(usrconfig.tLastLoginDate));
sprintf(LastLoginTime, "%s", StrTimeHMS(usrconfig.tLastLoginDate));
LastLogin = usrconfig.tLastLoginDate;
usrconfig.tLastLoginDate = ltime; /* Set current login to current date */
usrconfig.iTotalCalls++;
while (fread(&LIMIT, sizeof(LIMIT), 1, pLimits) == 1) {
if (LIMIT.Security == usrconfig.Security.level) {
iFoundLimit = TRUE;
break;
}
}
fclose(pLimits);
}
/*
* Update user record.
*/
if (fseek(pUsrConfig, usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize), 0) != 0) {
WriteError("Can't seek in %s/etc/users.data", getenv("MBSE_ROOT"));
} else {
fwrite(&usrconfig, sizeof(usrconfig), 1, pUsrConfig);
fclose(pUsrConfig);
}
if (!iFoundLimit) {
WriteError("Unknown Security Level in limits.data");
usrconfig.iTimeLeft = 0; /* Could not find limit, so set to Zero */
usrconfig.iTimeUsed = 0; /* Set to Zero as well */
} else {
/*
* Give user new time limit everyday, also new users get a new limit.
*/
sprintf(temp,"%s", (char *) GetDateDMY());
if (((strcmp(StrDateDMY(usrconfig.tLastLoginDate), temp)) != 0) || IsNew) {
/*
* If no timelimit set give user 24 hours.
*/
if (LIMIT.Time)
usrconfig.iTimeLeft = LIMIT.Time;
else
usrconfig.iTimeLeft = 86400;
usrconfig.iTimeUsed = 0; /* Set time used today to Zero */
usrconfig.iConnectTime = 0; /* Set connect time to Zero */
/*
* Write users structure to tmp file in ~/home/unixname/exitinfo
* A copy of the userrecord is also in the variable exitinfo.
*/
if (! InitExitinfo())
Good_Bye(MBERR_INIT_ERROR);
/*
* Give user new bytes and files every day if needed.
*/
if (LIMIT.DownK && LIMIT.DownF) {
usrconfig.DownloadKToday = LIMIT.DownK;
usrconfig.DownloadsToday = LIMIT.DownF;
}
}
} /* End of else */
GetLastUser();
StartTime = xstrcpy(GetLocalHM());
ChangeHomeDir(exitinfo.Name, exitinfo.Email);
usrconfig.iConnectTime = 0;
Syslog('+', "User successfully logged into BBS");
Syslog('+', "Level %d (%s), %d mins. left, port %s", usrconfig.Security.level, LIMIT.Description, usrconfig.iTimeLeft, pTTY);
Time2Go = time(NULL);
Time2Go += usrconfig.iTimeLeft * 60;
iUserTimeLeft = exitinfo.iTimeLeft;
/* Copy Users Protocol into Memory */
Set_Protocol(usrconfig.sProtocol);
tlf(usrconfig.sProtocol);
IsDoing("Welcome screens");
DisplayFile((char *)"mainlogo");
DisplayFile((char *)"welcome");
/*
* Set last login Date and Time, copy previous session
* values in memory.
*/
sprintf(LastLoginDate, "%s", StrDateDMY(usrconfig.tLastLoginDate));
sprintf(LastLoginTime, "%s", StrTimeHMS(usrconfig.tLastLoginDate));
LastLogin = usrconfig.tLastLoginDate;
usrconfig.tLastLoginDate = ltime; /* Set current login to current date */
usrconfig.iTotalCalls++;
/*
* The following files are only displayed if the user has
* turned the Bulletins on.
*/
if (exitinfo.ieNEWS) {
DisplayFile((char *)"welcome1");
DisplayFile((char *)"welcome2");
DisplayFile((char *)"welcome3");
DisplayFile((char *)"welcome4");
DisplayFile((char *)"welcome5");
DisplayFile((char *)"welcome6");
DisplayFile((char *)"welcome7");
DisplayFile((char *)"welcome8");
DisplayFile((char *)"welcome9");
sprintf(temp, "%s", (char *) GetDateDMY() );
if ((strcmp(exitinfo.sDateOfBirth, temp)) == 0)
DisplayFile((char *)"birthday");
/*
* Update user record.
* Displays file if it exists DD-MM.A??
*/
if (fseek(pUsrConfig, usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize), 0) != 0) {
WriteError("Can't seek in %s/etc/users.data", getenv("MBSE_ROOT"));
} else {
fwrite(&usrconfig, sizeof(usrconfig), 1, pUsrConfig);
fclose(pUsrConfig);
}
/*
* Write users structure to tmp file in ~/home/unixname/exitinfo
* A copy of the userrecord is also in the variable exitinfo.
*/
if (! InitExitinfo())
Good_Bye(MBERR_INIT_ERROR);
GetLastUser();
StartTime = xstrcpy(GetLocalHM());
ChangeHomeDir(exitinfo.Name, exitinfo.Email);
Syslog('+', "User successfully logged into BBS");
Syslog('+', "Level %d (%s), %d mins. left, port %s",
usrconfig.Security.level, LIMIT.Description, usrconfig.iTimeLeft, pTTY);
Time2Go = time(NULL);
Time2Go += usrconfig.iTimeLeft * 60;
iUserTimeLeft = exitinfo.iTimeLeft;
DisplayFile((char *)"mainlogo");
DisplayFile((char *)"welcome");
/*
* The following files are only displayed if the user has
* turned the Bulletins on.
*/
if (exitinfo.ieNEWS) {
DisplayFile((char *)"welcome1");
DisplayFile((char *)"welcome2");
DisplayFile((char *)"welcome3");
DisplayFile((char *)"welcome4");
DisplayFile((char *)"welcome5");
DisplayFile((char *)"welcome6");
DisplayFile((char *)"welcome7");
DisplayFile((char *)"welcome8");
DisplayFile((char *)"welcome9");
sprintf(temp, "%s", (char *) GetDateDMY() );
if ((strcmp(exitinfo.sDateOfBirth, temp)) == 0)
DisplayFile((char *)"birthday");
/*
* Displays file if it exists DD-MM.A??
*/
sprintf(temp, "%s", (char *) GetDateDMY());
strcpy(temp1, "");
strncat(temp1, temp, 5);
sprintf(temp, "%s", temp1);
DisplayFile(temp);
sprintf(temp, "%s", (char *) GetDateDMY());
strcpy(temp1, "");
strncat(temp1, temp, 5);
sprintf(temp, "%s", temp1);
DisplayFile(temp);
/*
* Displays users security file if it exists
*/
sprintf(temp, "sec%d", exitinfo.Security.level);
DisplayFile(temp);
/*
* Display News file
*/
DisplayFile((char *)"news");
}
/*
* Displays users security file if it exists
*/
sprintf(temp, "sec%d", exitinfo.Security.level);
DisplayFile(temp);
/*
* Display Onceonly file, first get the date of that
* file, search order is the same as in DisplayFile()
* Display News file
*/
st.st_mtime = 0;
if (exitinfo.GraphMode) {
sprintf(temp, "%s/onceonly.ans", lang.TextPath);
stat(temp, &st);
if (st.st_mtime == 0) {
sprintf(temp, "%s/onceonly.ans", CFG.bbs_txtfiles);
stat(temp, &st);
}
}
DisplayFile((char *)"news");
}
/*
* Display Onceonly file, first get the date of that
* file, search order is the same as in DisplayFile()
*/
st.st_mtime = 0;
if (exitinfo.GraphMode) {
sprintf(temp, "%s/onceonly.ans", lang.TextPath);
stat(temp, &st);
if (st.st_mtime == 0) {
sprintf(temp, "%s/onceonly.asc", lang.TextPath);
stat(temp, &st);
if (st.st_mtime == 0) {
sprintf(temp, "%s/onceonly.asc", CFG.bbs_txtfiles);
stat(temp, &st);
}
sprintf(temp, "%s/onceonly.ans", CFG.bbs_txtfiles);
stat(temp, &st);
}
}
if (st.st_mtime == 0) {
sprintf(temp, "%s/onceonly.asc", lang.TextPath);
stat(temp, &st);
if (st.st_mtime == 0) {
sprintf(temp, "%s/onceonly.asc", CFG.bbs_txtfiles);
stat(temp, &st);
}
}
if ((st.st_mtime != 0) && (LastLogin < st.st_mtime))
DisplayFile((char *)"onceonly");
if ((st.st_mtime != 0) && (LastLogin < st.st_mtime))
DisplayFile((char *)"onceonly");
OLR_SyncTags();
OLR_SyncTags();
if (exitinfo.MailScan)
CheckMail();
if (exitinfo.MailScan) {
IsDoing("New mail check");
CheckMail();
}
/*
* We don't show new files to new users.
*/
if (exitinfo.ieFILE && (!IsNew))
NewfileScan(FALSE);
/*
* We don't show new files to new users.
*/
if (exitinfo.ieFILE && (!IsNew)) {
IsDoing("New files check");
NewfileScan(FALSE);
}
/*
* Copy last file Area in to current Area
*/
SetFileArea(exitinfo.iLastFileArea);
/*
* Copy last file Area in to current Area
*/
SetFileArea(exitinfo.iLastFileArea);
/*
* Copy Last Message Area in to Current Msg Area
*/
SetMsgArea(usrconfig.iLastMsgArea);
SetEmailArea((char *)"mailbox");
/*
* Copy Last Message Area in to Current Msg Area
*/
SetMsgArea(usrconfig.iLastMsgArea);
SetEmailArea((char *)"mailbox");
/*
* Set or Reset the DoNotDisturb flag, now is the time
* we may be interrupted.
*/
UserSilent(usrconfig.DoNotDisturb);
/*
* Set or Reset the DoNotDisturb flag, now is the time
* we may be interrupted.
*/
UserSilent(usrconfig.DoNotDisturb);
/*
* Start the menu.
*/
menu();
/*
* Start the menu.
*/
menu();
}

View File

@ -173,10 +173,11 @@ void WhosOn(char *OpData)
/* WhosOn List */
printf("%-15s", (char *) Language(428));
else if (strstr(isdoing, "Offline"))
/* Idle */
/* Offline Reader */
printf("%-15s", (char *) Language(429));
else
printf("System error ");
/* Browsing */ /* This is default when nothing matches */
printf("%-15s", (char *) Language(418));
colour(LIGHTRED, BLACK);
printf("%-25s\n", location);
@ -253,7 +254,6 @@ void WhosDoingWhat(int iStatus)
break;
}
IsDoing(temp);
free(temp);
}