Several bugfixes

This commit is contained in:
Michiel Broek 2002-07-08 19:40:22 +00:00
parent bed48c9d4e
commit e04792e4cb
8 changed files with 801 additions and 776 deletions

View File

@ -4,12 +4,28 @@ $Id$
v0.35.03 06-Jul-2002 v0.35.03 06-Jul-2002
lang:
Corrected a spelling error in the Dutch language file.
mbcico: mbcico:
Changed IsDoing information. Changed IsDoing information.
newuser:
Check for Unix accounts is now case sensitive.
Check existing usernames now also checks handles.
mbsebbs:
Check existing usernames now also checks handles.
When a user paged the sysop for a chat, after the timer was
expired, the bbs crashed.
mbtask: mbtask:
Changed logging of multiple logmessages that are equal. Changed logging of multiple logmessages that are equal.
Changed semafore debug logmessages. Changed semafore debug logmessages.
Fixed log problem not always showing the Call flag.
Now forces callmode to None if the callflag was cleared.
The test to add a node to the calllist now also checks the
internal call flag.
v0.35.02 22-Jun-2002 - 06-Jul-2002 v0.35.02 22-Jun-2002 - 06-Jul-2002

View File

@ -380,7 +380,7 @@ JN|Zeker weten? [J/n]:
|Kies taal: |Kies taal:
|De taal is nu: |De taal is nu:
|Het systeem zal nu een "Unix gebruikersnaam" vragen |Het systeem zal nu een "Unix gebruikersnaam" vragen
|Uw "Unix gerbuikersnaam" is gemaakt, U kunt dit de volgende keer gebruiken. |Uw "Unix gebruikersnaam" is gemaakt, U kunt dit de volgende keer gebruiken.
|Geef een inlog naam (Maximaal 8 karakters, kleine letters) |Geef een inlog naam (Maximaal 8 karakters, kleine letters)
|bv. Piet Snot, login = psnot |bv. Piet Snot, login = psnot
|login > |login >

View File

@ -101,7 +101,7 @@ char *adate(time_t now)
struct tm ptm; struct tm ptm;
if (now == 0L) { if (now == 0L) {
sprintf(buf, "N/A"); sprintf(buf, " ");
} else { } else {
ptm = *localtime(&now); ptm = *localtime(&now);
sprintf(buf, "%02d-%02d-%04d %02d:%02d", ptm.tm_mday, ptm.tm_mon +1, ptm.tm_year + 1900, sprintf(buf, "%02d-%02d-%04d %02d:%02d", ptm.tm_mday, ptm.tm_mon +1, ptm.tm_year + 1900,
@ -148,7 +148,7 @@ void MakeStat(void)
fseek(fi, fileptr, SEEK_SET); fseek(fi, fileptr, SEEK_SET);
MacroVars("b", "s", mgroup.Name); MacroVars("b", "s", mgroup.Name);
MacroVars("c", "s", mgroup.Comment); MacroVars("c", "s", mgroup.Comment);
MacroVars("d", "s", aka2str(mgroup.UseAka)); MacroVars("d", "s", mgroup.UseAka.zone ? aka2str(mgroup.UseAka):" ");
MacroVars("e", "s", adate(mgroup.LastDate)); MacroVars("e", "s", adate(mgroup.LastDate));
MacroVars("f", "d", mgroup.MsgsRcvd.lweek); MacroVars("f", "d", mgroup.MsgsRcvd.lweek);
MacroVars("g", "d", mgroup.MsgsRcvd.month[Lm]); MacroVars("g", "d", mgroup.MsgsRcvd.month[Lm]);
@ -227,7 +227,7 @@ void MakeStat(void)
fseek(fi, fileptr, SEEK_SET); fseek(fi, fileptr, SEEK_SET);
MacroVars("b", "s", fgroup.Name); MacroVars("b", "s", fgroup.Name);
MacroVars("c", "s", fgroup.Comment); MacroVars("c", "s", fgroup.Comment);
MacroVars("d", "s", aka2str(fgroup.UseAka)); MacroVars("d", "s", fgroup.UseAka.zone ? aka2str(fgroup.UseAka):" ");
MacroVars("e", "s", adate(fgroup.LastDate)); MacroVars("e", "s", adate(fgroup.LastDate));
MacroVars("f", "d", fgroup.Files.lweek); MacroVars("f", "d", fgroup.Files.lweek);
MacroVars("g", "d", fgroup.KBytes.lweek); MacroVars("g", "d", fgroup.KBytes.lweek);
@ -343,7 +343,7 @@ void MakeStat(void)
fseek(fi, fileptr, SEEK_SET); fseek(fi, fileptr, SEEK_SET);
if (!strcmp(hist.aka.domain, "(null)")) if (!strcmp(hist.aka.domain, "(null)"))
hist.aka.domain[0] = '\0'; hist.aka.domain[0] = '\0';
MacroVars("c", "s", hist.aka.zone ? aka2str(hist.aka):"N/A"); MacroVars("c", "s", hist.aka.zone ? aka2str(hist.aka):" ");
MacroVars("d", "s", hist.system_name); MacroVars("d", "s", hist.system_name);
MacroVars("e", "s", hist.sysop); MacroVars("e", "s", hist.sysop);
MacroVars("f", "s", hist.location); MacroVars("f", "s", hist.location);

View File

@ -78,39 +78,33 @@ int CheckStatus()
/* /*
* Function to check if UserName exists and returns a 0 or 1 * Function to check if UserName/Handle exists and returns a 0 or 1
*/ */
int CheckName(char *Name) int CheckName(char *Name)
{ {
FILE *fp; FILE *fp;
int Status = FALSE; int Status = FALSE;
char *temp, *temp1; char *temp;
struct userhdr ushdr; struct userhdr ushdr;
struct userrec us; struct userrec us;
temp = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
temp1 = calloc(81, sizeof(char));
strcpy(temp1, tl(Name)); sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((fp = fopen(temp,"rb")) != NULL) {
fread(&ushdr, sizeof(ushdr), 1, fp);
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT")); while (fread(&us, ushdr.recsize, 1, fp) == 1) {
if ((fp = fopen(temp,"rb")) != NULL) { if ((strcasecmp(Name, us.sUserName) == 0) || (strcasecmp(Name, us.sHandle) == 0)) {
fread(&ushdr, sizeof(ushdr), 1, fp); Status = TRUE;
break;
}
}
fclose(fp);
}
while (fread(&us, ushdr.recsize, 1, fp) == 1) { free(temp);
strcpy(temp, tl(us.sUserName)); return Status;
if((strcmp(temp, temp1)) == 0) {
Status = TRUE;
break;
}
}
fclose(fp);
}
free(temp);
free(temp1);
return Status;
} }

File diff suppressed because it is too large Load Diff

View File

@ -52,141 +52,144 @@
*/ */
void Page_Sysop(char *String) void Page_Sysop(char *String)
{ {
int i; FILE *pWritingDevice;
FILE *pWritingDevice, *pBusy; int i, iOpenDevice = FALSE; /* Flag to check if you can write to CFG.sChatDevice */
int iOpenDevice = FALSE; /* Flag to check if you can write to CFG.sChatDevice */ char *Reason, temp[81];
char *Reason;
char temp[81];
Reason = calloc(81, sizeof(char)); Reason = calloc(81, sizeof(char));
clear(); clear();
colour(12, 0); colour(12, 0);
/* MBSE BBS Chat */ /* MBSE BBS Chat */
Center((char *) Language(151)); Center((char *) Language(151));
if (CFG.iAskReason) { if (CFG.iAskReason) {
locate(6, 0); locate(6, 0);
colour(1, 0); colour(BLUE, BLACK);
printf("%c", 213); printf("%c", 213);
for(i = 0; i < 78; i++) for (i = 0; i < 78; i++)
printf("%c", 205); printf("%c", 205);
printf("%c ", 184); printf("%c\n", 184);
colour(7, 0); colour(LIGHTGRAY, BLACK);
for(i = 0; i < 78; i++) for (i = 0; i < 78; i++)
printf("%c", 250); printf("%c", 250);
printf("\n"); printf("\n");
colour(1, 0); colour(BLUE, BLACK);
printf("%c", 212); printf("%c", 212);
for(i = 0; i < 78; i++) for (i = 0; i < 78; i++)
printf("%c", 205); printf("%c", 205);
printf("%c\n", 190); printf("%c\n", 190);
locate(7, 2); locate(7, 2);
colour(7, 0); colour(LIGHTGRAY, BLACK);
fflush(stdout); fflush(stdout);
GetPageStr(temp, 76); GetPageStr(temp, 76);
colour(1, 0); colour(BLUE, BLACK);
printf("%c", 212); printf("%c", 212);
for(i = 0; i < 78; i++) for (i = 0; i < 78; i++)
printf("%c", 205); printf("%c", 205);
printf("%c\n", 190); printf("%c\n", 190);
if((strcmp(temp, "")) == 0) if ((strcmp(temp, "")) == 0)
return; return;
Syslog('+', "Chat Reason: %s", temp); Syslog('+', "Chat Reason: %s", temp);
strcpy(Reason, temp); strcpy(Reason, temp);
}
// if (access("/tmp/.BusyChatting", F_OK) == 0) {
// if((pBusy = fopen("/tmp/.BusyChatting", "r")) == NULL)
// WriteError("Unable to open BusyChatting file", pTTY);
// else {
// fscanf(pBusy, "%10s", temp);
// fclose(pBusy);
// }
// colour(13, 0);
// printf("%s%s\n", (char *) Language(152), temp);
// pout(10, 0, (char *) Language(153));
// Enter(2);
// Syslog('+', "SysOp was busy chatting to user on %s", temp);
// Pause();
// free(Reason);
// return;
// }
CFG.iMaxPageTimes--;
if (CFG.iMaxPageTimes <= 0) {
if (!DisplayFile((char *)"maxpage")) {
/* If i is FALSE display hard coded message */
Enter(1);
pout(WHITE, BLACK, (char *) Language(154));
Enter(2);
} }
if (access("/tmp/.BusyChatting", F_OK) == 0) { Syslog('!', "Attempted to page Sysop, above maximum page limit.");
if((pBusy = fopen("/tmp/.BusyChatting", "r")) == NULL) Pause();
WriteError("Unable to open BusyChatting file", pTTY); } else {
else { locate(14, ((80 - strlen(String) ) / 2 - 2));
fscanf(pBusy, "%10s", temp); pout(WHITE, BLACK, (char *)"[");
fclose(pBusy); pout(LIGHTGRAY, BLACK, String);
} pout(WHITE, BLACK, (char *)"]");
colour(13, 0);
printf("%s%s\n", (char *) Language(152), temp); locate(16, ((80 - CFG.iPageLength) / 2 - 2));
pout(10, 0, (char *) Language(153)); pout(WHITE, BLACK, (char *)"[");
Enter(2); colour(BLUE, BLACK);
Syslog('+', "SysOp was busy chatting to user on %s", temp); for (i = 0; i < CFG.iPageLength; i++)
Pause(); printf("%c", 176);
pout(WHITE, BLACK, (char *)"]");
locate(16, ((80 - CFG.iPageLength) / 2 - 2) + 1);
if ((pWritingDevice = fopen(CFG.sChatDevice, "w")) != NULL) {
fprintf(pWritingDevice, "\n\n\n%s is trying to page you on %s.\n", \
usrconfig.sUserName, pTTY);
fprintf(pWritingDevice, "Type: '%s/bin/schat %s' to talk to him, you have", \
getenv("MBSE_ROOT"), pTTY);
fprintf(pWritingDevice, "\n%d seconds to respond!\n\n", CFG.iPageLength);
fprintf(pWritingDevice, "%s\n", temp);
iOpenDevice = TRUE;
}
colour(LIGHTBLUE, BLACK);
for (i = 0; i < CFG.iPageLength; i++) {
printf("\x07");
/* If there weren't any problems opening the writing device */
if (iOpenDevice) {
fprintf(pWritingDevice, "\x07");
fflush(pWritingDevice);
}
printf("%c", 219);
fflush(stdout);
sleep(1);
if (access("/tmp/chatdev", R_OK) == 0) {
fclose(pWritingDevice);
Chat();
free(Reason); free(Reason);
return; return;
}
} }
CFG.iMaxPageTimes--; if (iOpenDevice) {
fclose(pWritingDevice);
if(CFG.iMaxPageTimes <= 0) { iOpenDevice = 0;
if (!DisplayFile((char *)"maxpage")) {
/* If i is FALSE display hard coded message */
Enter(1);
pout(15, 0, (char *) Language(154));
Enter(2);
}
Syslog('!', "Attempted to page Sysop, above maximum page limit.");
Pause();
} else {
locate(14, ((80 - strlen(String) ) / 2 - 2));
pout(15, 0, (char *)"[");
pout(7, 0, String);
pout(15, 0, (char *)"]");
locate(16, ((80 - CFG.iPageLength) / 2 - 2));
pout(15, 0, (char *)"[");
colour(1, 0);
for(i = 0; i < CFG.iPageLength; i++)
printf("%c", 176);
pout(15, 0, (char *)"]");
locate(16, ((80 - CFG.iPageLength) / 2 - 2) + 1);
if((pWritingDevice = fopen(CFG.sChatDevice, "w")) != NULL) {
fprintf(pWritingDevice, "\n\n\n%s is trying to page you on %s.\n", \
usrconfig.sUserName, pTTY);
fprintf(pWritingDevice, "Type: '%s/bin/schat %s' to talk to him, you have", \
getenv("MBSE_ROOT"), pTTY);
fprintf(pWritingDevice, "\n%d seconds to respond!\n\n", CFG.iPageLength);
fprintf(pWritingDevice, "%s\n", temp);
iOpenDevice = TRUE;
}
colour(9, 0);
for(i = 0; i < CFG.iPageLength; i++) {
printf("\x07");
/* If there weren't any problems opening the writing device */
if(iOpenDevice)
fprintf(pWritingDevice, "\x07");
printf("%c", 219);
fflush(pWritingDevice);
fflush(stdout);
sleep(1);
if(access("/tmp/chatdev", R_OK) == 0) {
fclose(pWritingDevice);
Chat();
free(Reason);
return;
}
}
fclose(pWritingDevice);
PageReason();
printf("\n\n\n");
if (strlen(Reason))
SysopComment(Reason);
else
SysopComment((char *)"Failed chat");
} }
PageReason();
printf("\n\n\n");
Pause();
if (strlen(Reason))
SysopComment(Reason);
else
SysopComment((char *)"Failed chat");
}
free(Reason); free(Reason);
Pause(); Pause();
} }
@ -196,41 +199,41 @@ void Page_Sysop(char *String)
*/ */
void GetPageStr(char *sStr, int iMaxlen) void GetPageStr(char *sStr, int iMaxlen)
{ {
unsigned char ch = 0; unsigned char ch = 0;
int iPos = 0; int iPos = 0;
if ((ttyfd = open ("/dev/tty", O_RDWR)) < 0) { if ((ttyfd = open ("/dev/tty", O_RDWR)) < 0) {
perror("open 6"); perror("open 6");
return; return;
} }
Setraw(); Setraw();
strcpy(sStr, ""); strcpy(sStr, "");
alarm_on(); alarm_on();
while (ch != 13) { while (ch != 13) {
ch = Readkey(); ch = Readkey();
if (((ch == 8) || (ch == KEY_DEL) || (ch == 127)) && (iPos > 0)) { if (((ch == 8) || (ch == KEY_DEL) || (ch == 127)) && (iPos > 0)) {
printf("\b%c\b", 250); printf("\b%c\b", 250);
fflush(stdout); fflush(stdout);
sStr[--iPos]='\0'; sStr[--iPos]='\0';
}
if (ch > 31 && ch < 127) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
fflush(stdout);
} else
ch=13;
}
} }
Unsetraw(); if (ch > 31 && ch < 127) {
close(ttyfd); if (iPos <= iMaxlen) {
printf("\n"); iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
fflush(stdout);
} else
ch=13;
}
}
Unsetraw();
close(ttyfd);
printf("\n");
} }
@ -241,58 +244,58 @@ void GetPageStr(char *sStr, int iMaxlen)
*/ */
void PageReason() void PageReason()
{ {
FILE *Page; FILE *Page;
int iLoop = FALSE, id, i, j = 0; int iLoop = FALSE, id, i, j = 0;
int Lines = 0, Count = 0, iFoundString = FALSE; int Lines = 0, Count = 0, iFoundString = FALSE;
char *String; char *String;
char *temp; char *temp;
temp = calloc(128, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
String = calloc(81, sizeof(char)); String = calloc(81, sizeof(char));
sprintf(temp, "%s/page.asc", CFG.bbs_txtfiles); sprintf(temp, "%s/page.asc", CFG.bbs_txtfiles);
if(( Page = fopen(temp, "r")) != NULL) { if ((Page = fopen(temp, "r")) != NULL) {
while (( fgets(String, 80 ,Page)) != NULL) while (( fgets(String, 80 ,Page)) != NULL)
Lines++; Lines++;
rewind(Page); rewind(Page);
Count = Lines; Count = Lines;
id = getpid(); id = getpid();
do { do {
i = rand(); i = rand();
j = i % id; j = i % id;
if ((j <= Count) && (j != 0)) if ((j <= Count) && (j != 0))
iLoop = 1; iLoop = 1;
} while (!iLoop); } while (!iLoop);
Lines = 0; Lines = 0;
while (( fgets(String,80,Page)) != NULL) { while (( fgets(String,80,Page)) != NULL) {
if(Lines == j) { if (Lines == j) {
Striplf(String); Striplf(String);
locate(18, ((78 - strlen(String) ) / 2));
pout(15, 0, (char *)"[");
pout(9, 0, String);
pout(15, 0, (char *)"]");
iFoundString = TRUE;
}
Lines++; /* Increment Lines until correct line is found */
}
} /* End of Else */
if(!iFoundString) {
/* Sysop currently is not available ... please leave a comment */
sprintf(String, "%s", (char *) Language(155));
locate(18, ((78 - strlen(String) ) / 2)); locate(18, ((78 - strlen(String) ) / 2));
pout(15, 0, (char *)"["); pout(15, 0, (char *)"[");
pout(9, 0, String); pout(9, 0, String);
pout(15, 0, (char *)"]"); pout(15, 0, (char *)"]");
} iFoundString = TRUE;
}
free(temp); Lines++; /* Increment Lines until correct line is found */
free(String); }
} /* End of Else */
if (!iFoundString) {
/* Sysop currently is not available ... please leave a comment */
sprintf(String, "%s", (char *) Language(155));
locate(18, ((78 - strlen(String) ) / 2));
pout(15, 0, (char *)"[");
pout(9, 0, String);
pout(15, 0, (char *)"]");
}
free(temp);
free(String);
} }

View File

@ -87,8 +87,9 @@ int check_calllist(void)
if (pots_calls || isdn_calls || inet_calls) { if (pots_calls || isdn_calls || inet_calls) {
call_work = 0; call_work = 0;
for (tmp = alist; tmp; tmp = tmp->next) { for (tmp = alist; tmp; tmp = tmp->next) {
if (((tmp->callmode == CM_INET) && TCFG.max_tcp && internet) || if ((((tmp->callmode == CM_INET) && TCFG.max_tcp && internet) ||
((tmp->callmode == CM_ISDN) && isdn_lines) || ((tmp->callmode == CM_POTS) && pots_lines)) { ((tmp->callmode == CM_ISDN) && isdn_lines) || ((tmp->callmode == CM_POTS) && pots_lines)) &&
((tmp->flavors) & F_CALL)) {
call_work++; call_work++;
/* /*

View File

@ -460,8 +460,6 @@ int outstat()
*/ */
tmp->flavors &= ~F_CALL; tmp->flavors &= ~F_CALL;
} }
if ((tmp->flavors) & F_CALL)
flstr[10]='C';
if (tmp->t1) if (tmp->t1)
flstr[12] = tmp->t1; flstr[12] = tmp->t1;
if (tmp->t2) if (tmp->t2)
@ -520,6 +518,14 @@ int outstat()
} }
} }
if ((tmp->flavors) & F_CALL)
flstr[10]='C';
else
/*
* Safety, clear callmode.
*/
tmp->callmode = CM_NONE;
/* /*
* Show callresult for this node. * Show callresult for this node.
*/ */