Fixed several small valgrind detected errors
This commit is contained in:
parent
2ab6cacda9
commit
2e58d4339a
@ -19,6 +19,9 @@ v0.39.4 08-Dec-2003
|
|||||||
also fixed the message renumbering bug introduced with previous
|
also fixed the message renumbering bug introduced with previous
|
||||||
version.
|
version.
|
||||||
|
|
||||||
|
mbsebbs:
|
||||||
|
A lot of small fixes for problems found with valgrind.
|
||||||
|
|
||||||
mbsetup:
|
mbsetup:
|
||||||
Added default record for french language.
|
Added default record for french language.
|
||||||
|
|
||||||
|
2
TODO
2
TODO
@ -58,6 +58,8 @@ mbsebbs:
|
|||||||
|
|
||||||
N: Reimplememnt CHRS kludge.
|
N: Reimplememnt CHRS kludge.
|
||||||
|
|
||||||
|
N: There are some bugs in the bbs list menu. Make it a door?
|
||||||
|
|
||||||
newuser:
|
newuser:
|
||||||
N: Test with valgrind.
|
N: Test with valgrind.
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ char *xstrcat(char *src, char *add)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void InitClient(char *user, char *myname, char *where, char *log, long loggr, char *err, char *mgr, char *debug)
|
void InitClient(char *user, char *myname, char *where, char *logfname, long loggr, char *err, char *mgr, char *debug)
|
||||||
{
|
{
|
||||||
if ((getenv("MBSE_ROOT")) == NULL) {
|
if ((getenv("MBSE_ROOT")) == NULL) {
|
||||||
printf("Could not get the MBSE_ROOT environment variable\n");
|
printf("Could not get the MBSE_ROOT environment variable\n");
|
||||||
@ -112,7 +112,7 @@ void InitClient(char *user, char *myname, char *where, char *log, long loggr, ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
sprintf(progname, "%s", myname);
|
sprintf(progname, "%s", myname);
|
||||||
sprintf(logfile, "%s", log);
|
sprintf(logfile, "%s", logfname);
|
||||||
sprintf(errfile, "%s", err);
|
sprintf(errfile, "%s", err);
|
||||||
sprintf(mgrfile, "%s", mgr);
|
sprintf(mgrfile, "%s", mgr);
|
||||||
sprintf(logdebug, "%s", debug);
|
sprintf(logdebug, "%s", debug);
|
||||||
|
@ -1112,7 +1112,7 @@ void fill_binkp_list(binkp_list **bll, file_list *fal, off_t offs)
|
|||||||
|
|
||||||
if (stat(fal->local, &tstat) != 0) {
|
if (stat(fal->local, &tstat) != 0) {
|
||||||
Syslog('!', "$Can't add %s to sendlist", fal->local);
|
Syslog('!', "$Can't add %s to sendlist", fal->local);
|
||||||
exit;
|
return;
|
||||||
}
|
}
|
||||||
if (strstr(fal->remote, (char *)".pkt"))
|
if (strstr(fal->remote, (char *)".pkt"))
|
||||||
nethold += tstat.st_size;
|
nethold += tstat.st_size;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: File forward to a node
|
* Purpose ...............: File forward to a node
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -71,7 +71,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl)
|
|||||||
T_File.Cost = TIC.FileCost + (TIC.FileCost * nodes.AddPerc / 1000);
|
T_File.Cost = TIC.FileCost + (TIC.FileCost * nodes.AddPerc / 1000);
|
||||||
if ((nodes.Credit < (nodes.StopLevel + T_File.Cost)) && (!TIC.Charge)) {
|
if ((nodes.Credit < (nodes.StopLevel + T_File.Cost)) && (!TIC.Charge)) {
|
||||||
Syslog('!', "No forward to %s, not enough credit left", aka2str(Node));
|
Syslog('!', "No forward to %s, not enough credit left", aka2str(Node));
|
||||||
exit;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -134,7 +134,7 @@ lineedit.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/user
|
|||||||
mblang.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/mberrors.h
|
mblang.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/mberrors.h
|
||||||
mbuser.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/mberrors.h mbuser.h
|
mbuser.o: ../config.h ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h ../lib/mberrors.h mbuser.h
|
||||||
page.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h
|
page.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h
|
||||||
bye.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h dispfile.h misc.h language.h bye.h
|
bye.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h ../lib/nodelist.h dispfile.h misc.h language.h bye.h
|
||||||
funcs.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h ../lib/mberrors.h funcs.h
|
funcs.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h ../lib/mberrors.h funcs.h
|
||||||
mail.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h
|
mail.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/nodelist.h ../lib/msgtext.h ../lib/clcomm.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h
|
||||||
newuser.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h
|
newuser.o: ../config.h ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/mberrors.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* Intro New BBS at logon
|
* Intro New BBS at logon
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -598,13 +598,9 @@ void BBS_Show(void)
|
|||||||
void BBS_Delete(void)
|
void BBS_Delete(void)
|
||||||
{
|
{
|
||||||
FILE *pBBSLine;
|
FILE *pBBSLine;
|
||||||
int recno = 0;
|
int recno = 0, nrecno = 0;
|
||||||
long int offset;
|
long offset;
|
||||||
int nrecno = 0;
|
char srecno[7], *sFileName, stemp[50], sUser[35];
|
||||||
char srecno[7];
|
|
||||||
char *sFileName;
|
|
||||||
char stemp[50];
|
|
||||||
char sUser[35];
|
|
||||||
|
|
||||||
sFileName = calloc(PATH_MAX, sizeof(char));
|
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(sFileName,"%s/etc/bbslist.data", getenv("MBSE_ROOT"));
|
sprintf(sFileName,"%s/etc/bbslist.data", getenv("MBSE_ROOT"));
|
||||||
@ -614,7 +610,6 @@ void BBS_Delete(void)
|
|||||||
free(sFileName);
|
free(sFileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
free(sFileName);
|
|
||||||
fread(&bbshdr, sizeof(bbshdr),1 , pBBSLine);
|
fread(&bbshdr, sizeof(bbshdr),1 , pBBSLine);
|
||||||
|
|
||||||
if (exitinfo.GraphMode) {
|
if (exitinfo.GraphMode) {
|
||||||
@ -657,6 +652,7 @@ void BBS_Delete(void)
|
|||||||
pout(12, 0, (char *) Language(319));
|
pout(12, 0, (char *) Language(319));
|
||||||
Enter(2);
|
Enter(2);
|
||||||
fclose(pBBSLine);
|
fclose(pBBSLine);
|
||||||
|
free(sFileName);
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -677,6 +673,8 @@ void BBS_Delete(void)
|
|||||||
/* Record */ /* does not belong to you.*/
|
/* Record */ /* does not belong to you.*/
|
||||||
printf("\n%s%s %s\n\n", (char *) Language(332), stemp, (char *) Language(333));
|
printf("\n%s%s %s\n\n", (char *) Language(332), stemp, (char *) Language(333));
|
||||||
Syslog('!', "User tried to delete somebody else's bbslist record: %s", stemp);
|
Syslog('!', "User tried to delete somebody else's bbslist record: %s", stemp);
|
||||||
|
free(sFileName);
|
||||||
|
fclose(pBBSLine);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -706,6 +704,7 @@ void BBS_Delete(void)
|
|||||||
|
|
||||||
fclose(pBBSLine);
|
fclose(pBBSLine);
|
||||||
chmod(sFileName, 0660);
|
chmod(sFileName, 0660);
|
||||||
|
free(sFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "../lib/clcomm.h"
|
#include "../lib/clcomm.h"
|
||||||
#include "../lib/common.h"
|
#include "../lib/common.h"
|
||||||
#include "../lib/mberrors.h"
|
#include "../lib/mberrors.h"
|
||||||
|
#include "../lib/nodelist.h"
|
||||||
#include "dispfile.h"
|
#include "dispfile.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
@ -45,6 +46,9 @@
|
|||||||
|
|
||||||
extern pid_t mypid;
|
extern pid_t mypid;
|
||||||
extern time_t t_start;
|
extern time_t t_start;
|
||||||
|
extern char *StartTime;
|
||||||
|
|
||||||
|
|
||||||
int do_mailout = FALSE;
|
int do_mailout = FALSE;
|
||||||
|
|
||||||
|
|
||||||
@ -129,6 +133,9 @@ void Good_Bye(int onsig)
|
|||||||
Unsetraw();
|
Unsetraw();
|
||||||
Free_Language();
|
Free_Language();
|
||||||
free(pTTY);
|
free(pTTY);
|
||||||
|
if (StartTime)
|
||||||
|
free(StartTime);
|
||||||
|
deinitnl();
|
||||||
exit(onsig);
|
exit(onsig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,6 +159,8 @@ void Quick_Bye(int onsig)
|
|||||||
|
|
||||||
Free_Language();
|
Free_Language();
|
||||||
free(pTTY);
|
free(pTTY);
|
||||||
|
if (StartTime)
|
||||||
|
free(StartTime);
|
||||||
exit(MBERR_OK);
|
exit(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -841,12 +841,14 @@ void Write_Email(void)
|
|||||||
sprintf(Msg.From, "%s@%s (%s)", exitinfo.sUserName, ascinode(Dest, 0x2f), exitinfo.sUserName);
|
sprintf(Msg.From, "%s@%s (%s)", exitinfo.sUserName, ascinode(Dest, 0x2f), exitinfo.sUserName);
|
||||||
} else
|
} else
|
||||||
sprintf(Msg.From, "%s@%s (%s)", exitinfo.Name, CFG.sysdomain, exitinfo.sUserName);
|
sprintf(Msg.From, "%s@%s (%s)", exitinfo.Name, CFG.sysdomain, exitinfo.sUserName);
|
||||||
|
|
||||||
for (i = 0; i < strlen(Msg.From); i++) {
|
for (i = 0; i < strlen(Msg.From); i++) {
|
||||||
if (Msg.From[i] == ' ')
|
if (Msg.From[i] == ' ')
|
||||||
Msg.From[i] = '_';
|
Msg.From[i] = '_';
|
||||||
if (Msg.From[i] == '@')
|
if (Msg.From[i] == '@')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
printf("%s", Msg.From);
|
printf("%s", Msg.From);
|
||||||
Syslog('b', "Setting From: %s", Msg.From);
|
Syslog('b', "Setting From: %s", Msg.From);
|
||||||
@ -862,6 +864,7 @@ void Write_Email(void)
|
|||||||
for (i = 0; i < (TEXTBUFSIZE + 1); i++)
|
for (i = 0; i < (TEXTBUFSIZE + 1); i++)
|
||||||
free(Message[i]);
|
free(Message[i]);
|
||||||
SetEmailArea(orgbox);
|
SetEmailArea(orgbox);
|
||||||
|
free(orgbox);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -883,6 +886,7 @@ void Write_Email(void)
|
|||||||
for (i = 0; i < (TEXTBUFSIZE + 1); i++)
|
for (i = 0; i < (TEXTBUFSIZE + 1); i++)
|
||||||
free(Message[i]);
|
free(Message[i]);
|
||||||
SetEmailArea(orgbox);
|
SetEmailArea(orgbox);
|
||||||
|
free(orgbox);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -897,6 +901,7 @@ void Write_Email(void)
|
|||||||
free(Message[i]);
|
free(Message[i]);
|
||||||
|
|
||||||
SetEmailArea(orgbox);
|
SetEmailArea(orgbox);
|
||||||
|
free(orgbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -297,12 +297,12 @@ void Download(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fclose(tf);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If anything left to download...
|
* If anything left to download...
|
||||||
*/
|
*/
|
||||||
if (!Count) {
|
if (!Count) {
|
||||||
fclose(tf);
|
|
||||||
SetFileArea(OldArea);
|
SetFileArea(OldArea);
|
||||||
unlink("taglist");
|
unlink("taglist");
|
||||||
/* No files marked for download */
|
/* No files marked for download */
|
||||||
@ -458,6 +458,7 @@ void Download(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fclose(tf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -899,8 +900,7 @@ int NewfileScan(int AskStart)
|
|||||||
|
|
||||||
while (fread(&area, areahdr.recsize, 1, pAreas) == 1) {
|
while (fread(&area, areahdr.recsize, 1, pAreas) == 1) {
|
||||||
|
|
||||||
if ((Access(exitinfo.Security, area.LTSec)) && (area.Available) &&
|
if ((Access(exitinfo.Security, area.LTSec)) && (area.Available) && (strlen(area.Password) == 0) && (area.New)) {
|
||||||
(strlen(area.Password) == 0) && (area.New)) {
|
|
||||||
|
|
||||||
if ((pFile = OpenFileBase(arecno, FALSE)) != NULL ) {
|
if ((pFile = OpenFileBase(arecno, FALSE)) != NULL ) {
|
||||||
|
|
||||||
@ -928,6 +928,8 @@ int NewfileScan(int AskStart)
|
|||||||
if (iLC(2) == 1) {
|
if (iLC(2) == 1) {
|
||||||
free(Date);
|
free(Date);
|
||||||
free(temp);
|
free(temp);
|
||||||
|
fclose(pFile);
|
||||||
|
fclose(pAreas);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
@ -946,6 +948,8 @@ int NewfileScan(int AskStart)
|
|||||||
if (ShowOneFile() == 1) {
|
if (ShowOneFile() == 1) {
|
||||||
free(Date);
|
free(Date);
|
||||||
free(temp);
|
free(temp);
|
||||||
|
fclose(pFile);
|
||||||
|
fclose(pAreas);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -962,6 +966,7 @@ int NewfileScan(int AskStart)
|
|||||||
if (iLC(2) == 1) {
|
if (iLC(2) == 1) {
|
||||||
free(Date);
|
free(Date);
|
||||||
free(temp);
|
free(temp);
|
||||||
|
fclose(pAreas);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -225,6 +225,13 @@ int Crash_Option(faddr *Dest)
|
|||||||
printf("%c", Keystroke(462, 1));
|
printf("%c", Keystroke(462, 1));
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
|
if (Nlent->addr.domain)
|
||||||
|
free(Nlent->addr.domain);
|
||||||
|
Nlent->addr.domain = NULL;
|
||||||
|
if (Nlent->url)
|
||||||
|
free(Nlent->url);
|
||||||
|
Nlent->url = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Dest->point = point;
|
Dest->point = point;
|
||||||
@ -399,7 +406,7 @@ void Post_Msg()
|
|||||||
int i, x, cc;
|
int i, x, cc;
|
||||||
char *FidoNode;
|
char *FidoNode;
|
||||||
faddr *Dest = NULL;
|
faddr *Dest = NULL;
|
||||||
node *Nlent;
|
node *Nlent = NULL;
|
||||||
unsigned short point;
|
unsigned short point;
|
||||||
|
|
||||||
Line = 1;
|
Line = 1;
|
||||||
@ -505,6 +512,13 @@ void Post_Msg()
|
|||||||
point = Dest->point;
|
point = Dest->point;
|
||||||
Dest->point = 0;
|
Dest->point = 0;
|
||||||
if (((Nlent = getnlent(Dest)) != NULL) && (Nlent->addr.zone)) {
|
if (((Nlent = getnlent(Dest)) != NULL) && (Nlent->addr.zone)) {
|
||||||
|
if (Nlent->url)
|
||||||
|
free(Nlent->url);
|
||||||
|
Nlent->url = NULL;
|
||||||
|
if (Nlent->addr.domain)
|
||||||
|
free(Nlent->addr.domain);
|
||||||
|
Nlent->addr.domain = NULL;
|
||||||
|
|
||||||
colour(YELLOW, BLACK);
|
colour(YELLOW, BLACK);
|
||||||
if (point)
|
if (point)
|
||||||
printf("Boss : ");
|
printf("Boss : ");
|
||||||
@ -577,6 +591,7 @@ void Post_Msg()
|
|||||||
if (toupper(Getone()) == Keystroke(162, 0)) {
|
if (toupper(Getone()) == Keystroke(162, 0)) {
|
||||||
for(i = 0; i < (TEXTBUFSIZE + 1); i++)
|
for(i = 0; i < (TEXTBUFSIZE + 1); i++)
|
||||||
free(Message[i]);
|
free(Message[i]);
|
||||||
|
tidy_faddr(Dest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -642,6 +657,7 @@ void Post_Msg()
|
|||||||
|
|
||||||
for (i = 0; i < (TEXTBUFSIZE + 1); i++)
|
for (i = 0; i < (TEXTBUFSIZE + 1); i++)
|
||||||
free(Message[i]);
|
free(Message[i]);
|
||||||
|
tidy_faddr(Dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,9 +143,9 @@ int main(int argc, char **argv)
|
|||||||
* Trap signals
|
* Trap signals
|
||||||
*/
|
*/
|
||||||
for(i = 0; i < NSIG; i++) {
|
for(i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
|
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else
|
else if ((i != SIGKILL) && (i != SIGSTOP))
|
||||||
signal(i, SIG_IGN);
|
signal(i, SIG_IGN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Misc functions
|
* Purpose ...............: Misc functions
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -62,52 +62,51 @@ int LC_Door = FALSE;
|
|||||||
|
|
||||||
int ChkFiles()
|
int ChkFiles()
|
||||||
{
|
{
|
||||||
FILE *pCallerLog, *pUsersFile;
|
FILE *fp;
|
||||||
char *sDataFile;
|
|
||||||
time_t Now;
|
|
||||||
char *temp;
|
char *temp;
|
||||||
|
time_t Now;
|
||||||
|
|
||||||
sDataFile = calloc(PATH_MAX, sizeof(char));
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
|
||||||
chmod(sDataFile, 0660);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if users.data exists, if not create a new one.
|
* Check if users.data exists, if not create a new one.
|
||||||
*/
|
*/
|
||||||
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
||||||
if ((pUsersFile = fopen(temp,"rb")) == NULL) {
|
if ((fp = fopen(temp,"rb")) == NULL) {
|
||||||
if((pUsersFile = fopen(temp,"wb")) == NULL) {
|
if ((fp = fopen(temp,"wb")) == NULL) {
|
||||||
WriteError("$Can't create %s", temp);
|
WriteError("$Can't create %s", temp);
|
||||||
ExitClient(MBERR_INIT_ERROR);
|
ExitClient(MBERR_INIT_ERROR);
|
||||||
} else {
|
} else {
|
||||||
usrconfighdr.hdrsize = sizeof(usrconfighdr);
|
usrconfighdr.hdrsize = sizeof(usrconfighdr);
|
||||||
usrconfighdr.recsize = sizeof(usrconfig);
|
usrconfighdr.recsize = sizeof(usrconfig);
|
||||||
fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, pUsersFile);
|
fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, fp);
|
||||||
fclose(pUsersFile);
|
fclose(fp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
chmod(temp, 0660);
|
chmod(temp, 0660);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if sysinfo.data exists, if not, create a new one.
|
* Check if sysinfo.data exists, if not, create a new one.
|
||||||
*/
|
*/
|
||||||
if ((pCallerLog = fopen(sDataFile, "rb")) == NULL) {
|
sprintf(temp, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
||||||
if((pCallerLog = fopen(sDataFile, "wb")) == NULL)
|
if ((fp = fopen(temp, "rb")) == NULL) {
|
||||||
WriteError("$ChkFiles: Can't create %s", sDataFile);
|
if ((fp = fopen(temp, "wb")) == NULL) {
|
||||||
else {
|
WriteError("$ChkFiles: Can't create %s", temp);
|
||||||
|
} else {
|
||||||
memset((char *)&SYSINFO, 0, sizeof(SYSINFO));
|
memset((char *)&SYSINFO, 0, sizeof(SYSINFO));
|
||||||
Now = time(NULL);
|
Now = time(NULL);
|
||||||
SYSINFO.StartDate = Now;
|
SYSINFO.StartDate = Now;
|
||||||
|
fwrite(&SYSINFO, sizeof(SYSINFO), 1, fp);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
chmod(temp, 0660);
|
||||||
|
|
||||||
rewind(pCallerLog);
|
|
||||||
fwrite(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
|
|
||||||
fclose(pCallerLog);
|
|
||||||
chmod(sDataFile, 0660);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
free(temp);
|
free(temp);
|
||||||
free(sDataFile);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,14 +149,11 @@ void Setup(char *Option, char *variable)
|
|||||||
void SaveLastCallers()
|
void SaveLastCallers()
|
||||||
{
|
{
|
||||||
FILE *pGLC;
|
FILE *pGLC;
|
||||||
char *sFileName;
|
char *sFileName, sFileDate[9], sDate[9];
|
||||||
char sFileDate[9];
|
|
||||||
char sDate[9];
|
|
||||||
struct stat statfile;
|
struct stat statfile;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First check if we passed midnight, in that case we
|
* First check if we passed midnight, in that case we create a fresh file.
|
||||||
* create a fresh file.
|
|
||||||
*/
|
*/
|
||||||
sFileName = calloc(PATH_MAX, sizeof(char));
|
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT"));
|
sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT"));
|
||||||
@ -172,20 +168,24 @@ void SaveLastCallers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if file exists, if not create the file and
|
* Check if file exists, if not create the file and write the fileheader.
|
||||||
* write the fileheader.
|
|
||||||
*/
|
*/
|
||||||
if ((pGLC = fopen(sFileName, "r")) == NULL) {
|
if ((pGLC = fopen(sFileName, "r")) == NULL) {
|
||||||
if ((pGLC = fopen(sFileName, "w")) != NULL) {
|
if ((pGLC = fopen(sFileName, "w")) != NULL) {
|
||||||
LCALLhdr.hdrsize = sizeof(LCALLhdr);
|
LCALLhdr.hdrsize = sizeof(LCALLhdr);
|
||||||
LCALLhdr.recsize = sizeof(LCALL);
|
LCALLhdr.recsize = sizeof(LCALL);
|
||||||
fwrite(&LCALLhdr, sizeof(LCALLhdr), 1, pGLC);
|
fwrite(&LCALLhdr, sizeof(LCALLhdr), 1, pGLC);
|
||||||
|
fclose(pGLC);
|
||||||
Syslog('+', "Created new lastcall.data");
|
Syslog('+', "Created new lastcall.data");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
fclose(pGLC);
|
fclose(pGLC);
|
||||||
}
|
}
|
||||||
chmod(sFileName, 0660);
|
chmod(sFileName, 0660);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now append a record
|
||||||
|
*/
|
||||||
if ((pGLC = fopen(sFileName,"a+")) == NULL) {
|
if ((pGLC = fopen(sFileName,"a+")) == NULL) {
|
||||||
WriteError("$Can't open %s", sFileName);
|
WriteError("$Can't open %s", sFileName);
|
||||||
return;
|
return;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Offline Reader
|
* Purpose ...............: Offline Reader
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -2544,13 +2544,13 @@ union Converter {
|
|||||||
|
|
||||||
float IEEToMSBIN(float f)
|
float IEEToMSBIN(float f)
|
||||||
{
|
{
|
||||||
int sign, exp;
|
int sign, expo;
|
||||||
union Converter t;
|
union Converter t;
|
||||||
|
|
||||||
t.f[0] = f;
|
t.f[0] = f;
|
||||||
sign = t.uc[3] / 0x80;
|
sign = t.uc[3] / 0x80;
|
||||||
exp = ((t.ui[1] >> 7) - 0x7F + 0x81) & 0xFF;
|
expo = ((t.ui[1] >> 7) - 0x7F + 0x81) & 0xFF;
|
||||||
t.ui[1] = (t.ui[1] & 0x7F) | (sign << 7) | (exp << 8);
|
t.ui[1] = (t.ui[1] & 0x7F) | (sign << 7) | (expo << 8);
|
||||||
|
|
||||||
return t.f[0];
|
return t.f[0];
|
||||||
}
|
}
|
||||||
@ -2560,12 +2560,12 @@ float IEEToMSBIN(float f)
|
|||||||
float MSBINToIEEE(float f)
|
float MSBINToIEEE(float f)
|
||||||
{
|
{
|
||||||
union Converter t;
|
union Converter t;
|
||||||
int sign, exp;
|
int sign, expo;
|
||||||
|
|
||||||
t.f[0] = f;
|
t.f[0] = f;
|
||||||
sign = t.uc[2] / 0x80;
|
sign = t.uc[2] / 0x80;
|
||||||
exp = (t.uc[3] - 0x81 + 0x7f) & 0xff;
|
expo = (t.uc[3] - 0x81 + 0x7f) & 0xff;
|
||||||
t.ui[1] = (t.ui[1] & 0x7f) | (exp << 7) | (sign << 15);
|
t.ui[1] = (t.ui[1] & 0x7f) | (expo << 7) | (sign << 15);
|
||||||
return t.f[0];
|
return t.f[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: Oneliner functions.
|
* Purpose ...............: Oneliner functions.
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2002
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -51,7 +51,7 @@ void Oneliner_Check()
|
|||||||
FILE *pOneline;
|
FILE *pOneline;
|
||||||
char *sFileName;
|
char *sFileName;
|
||||||
|
|
||||||
sFileName = calloc(128, sizeof(char));
|
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(sFileName, "%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
sprintf(sFileName, "%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if ((pOneline = fopen(sFileName, "r")) == NULL) {
|
if ((pOneline = fopen(sFileName, "r")) == NULL) {
|
||||||
@ -60,10 +60,13 @@ void Oneliner_Check()
|
|||||||
olhdr.recsize = sizeof(ol);
|
olhdr.recsize = sizeof(ol);
|
||||||
fwrite(&olhdr, sizeof(olhdr), 1, pOneline);
|
fwrite(&olhdr, sizeof(olhdr), 1, pOneline);
|
||||||
fclose(pOneline);
|
fclose(pOneline);
|
||||||
chmod(sFileName, 0660);
|
|
||||||
Syslog('-', "Created oneliner database");
|
Syslog('-', "Created oneliner database");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
fclose(pOneline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
chmod(sFileName, 0660);
|
||||||
free(sFileName);
|
free(sFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
extern int sock;
|
extern int sock;
|
||||||
extern pid_t mypid;
|
extern pid_t mypid;
|
||||||
char *StartTime;
|
char *StartTime = NULL;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -352,7 +352,7 @@ void chat_cleanuser(pid_t pid)
|
|||||||
void chat_msg(int channel, char *nick, char *msg)
|
void chat_msg(int channel, char *nick, char *msg)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char buf[128], *log;
|
char buf[128], *logm;
|
||||||
|
|
||||||
if (nick == NULL)
|
if (nick == NULL)
|
||||||
sprintf(buf, "%s", msg);
|
sprintf(buf, "%s", msg);
|
||||||
@ -360,10 +360,10 @@ void chat_msg(int channel, char *nick, char *msg)
|
|||||||
sprintf(buf, "<%s> %s", nick, msg);
|
sprintf(buf, "<%s> %s", nick, msg);
|
||||||
|
|
||||||
if (CFG.iAutoLog && strlen(CFG.chat_log)) {
|
if (CFG.iAutoLog && strlen(CFG.chat_log)) {
|
||||||
log = calloc(PATH_MAX, sizeof(char));
|
logm = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(log, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log);
|
sprintf(logm, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log);
|
||||||
ulog(log, (char *)"+", chat_channels[channel].name, (char *)"-1", buf);
|
ulog(logm, (char *)"+", chat_channels[channel].name, (char *)"-1", buf);
|
||||||
free(log);
|
free(logm);
|
||||||
}
|
}
|
||||||
buf[79] = '\0';
|
buf[79] = '\0';
|
||||||
|
|
||||||
|
@ -422,7 +422,7 @@ char *reg_ipm(char *data)
|
|||||||
*/
|
*/
|
||||||
int reg_spm(char *data)
|
int reg_spm(char *data)
|
||||||
{
|
{
|
||||||
char *cnt, *from, *too, *txt, *log;
|
char *cnt, *from, *too, *txt, *logm;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
cnt = strtok(data, ",");
|
cnt = strtok(data, ",");
|
||||||
@ -463,10 +463,10 @@ int reg_spm(char *data)
|
|||||||
reginfo[i].ismsg = TRUE;
|
reginfo[i].ismsg = TRUE;
|
||||||
|
|
||||||
if (CFG.iAutoLog && strlen(CFG.chat_log)) {
|
if (CFG.iAutoLog && strlen(CFG.chat_log)) {
|
||||||
log = calloc(PATH_MAX, sizeof(char));
|
logm = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(log, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log);
|
sprintf(logm, "%s/log/%s", getenv("MBSE_ROOT"), CFG.chat_log);
|
||||||
ulog(log, (char *)"+", from, (char *)"-1", txt);
|
ulog(logm, (char *)"+", from, (char *)"-1", txt);
|
||||||
free(log);
|
free(logm);
|
||||||
}
|
}
|
||||||
|
|
||||||
Syslog('+', "reg_spm: rec=%d in=%d out=%d ismsg=%d", i, reginfo[i].ptr_in, reginfo[i].ptr_out, reginfo[i].ismsg);
|
Syslog('+', "reg_spm: rec=%d in=%d out=%d ismsg=%d", i, reginfo[i].ptr_in, reginfo[i].ptr_out, reginfo[i].ismsg);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
* Purpose ...............: MBSE BBS Task Manager, utilities
|
* Purpose ...............: MBSE BBS Task Manager, utilities
|
||||||
*
|
*
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1997-2001
|
* Copyright (C) 1997-2003
|
||||||
*
|
*
|
||||||
* Michiel Broek FIDO: 2:280/2802
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
* Beekmansbos 10
|
* Beekmansbos 10
|
||||||
@ -194,30 +194,30 @@ void Syslog(int grade, const char *format, ...)
|
|||||||
int ulog(char *fn, char *grade, char *prname, char *prpid, char *format)
|
int ulog(char *fn, char *grade, char *prname, char *prpid, char *format)
|
||||||
{
|
{
|
||||||
int i, oldmask;
|
int i, oldmask;
|
||||||
FILE *log;
|
FILE *fp;
|
||||||
|
|
||||||
oldmask = umask(066);
|
oldmask = umask(066);
|
||||||
log = fopen(fn, "a");
|
fp = fopen(fn, "a");
|
||||||
umask(oldmask);
|
umask(oldmask);
|
||||||
if (log == NULL) {
|
if (fp == NULL) {
|
||||||
oserr = errno;
|
oserr = errno;
|
||||||
Syslog('!', "$Cannot open user logfile %s", fn);
|
Syslog('!', "$Cannot open user logfile %s", fn);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(log, "%s %s %s[%s] ", grade, date(), prname, prpid);
|
fprintf(fp, "%s %s %s[%s] ", grade, date(), prname, prpid);
|
||||||
for (i = 0; i < strlen(format); i++) {
|
for (i = 0; i < strlen(format); i++) {
|
||||||
if (iscntrl(format[i])) {
|
if (iscntrl(format[i])) {
|
||||||
fputc('^', log);
|
fputc('^', fp);
|
||||||
fputc(format[i] + 64, log);
|
fputc(format[i] + 64, fp);
|
||||||
} else {
|
} else {
|
||||||
fputc(format[i], log);
|
fputc(format[i], fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fputc('\n', log);
|
fputc('\n', fp);
|
||||||
fflush(log);
|
fflush(fp);
|
||||||
|
|
||||||
if (fclose(log) != 0) {
|
if (fclose(fp) != 0) {
|
||||||
oserr = errno;
|
oserr = errno;
|
||||||
Syslog('!', "$Cannot close user logfile %s", fn);
|
Syslog('!', "$Cannot close user logfile %s", fn);
|
||||||
return -1;
|
return -1;
|
||||||
|
Reference in New Issue
Block a user