a lot of mbsebbs cleanups

This commit is contained in:
Michiel Broek
2001-11-12 21:42:17 +00:00
parent d91305ad80
commit 686f670a43
49 changed files with 1886 additions and 1691 deletions

View File

@@ -5,33 +5,33 @@
include ../Makefile.global
SRCS = bank.c commonio.c filesub.c language.c mbfbgen.c mbtoberep.c \
msgutil.c oneline.c sgetpwent.c xmalloc.c bbslist.c \
msgutil.c oneline.c sgetpwent.c xmalloc.c bbslist.c morefile.c \
email.c fsedit.c lineedit.c mblang.c mbuser.c myname.c page.c \
pwio.c shadowio.c bye.c encrypt.c funcs.c mail.c mbpasswd.c \
mbuseradd.c newuser.c pinfo.c rad64.c timecheck.c change.c \
exitinfo.c funcs4.c mball.c mbsebbs.c menu.c nextuser.c pop3.c \
exitinfo.c mball.c mbsebbs.c menu.c nextuser.c pop3.c lastcallers.c \
safe.c timeout.c chat.c file.c getdef.c mbchat.c mbstat.c misc.c \
offline.c putpwent.c salt.c user.c mbnewusr.c input.c whoson.c \
door.c dispfile.c
door.c dispfile.c userlist.c timestats.c logentry.c
HDRS = bank.h commonio.h filesub.h language.h mbsebbs.h misc.h offline.h \
putpwent.h salt.h timeout.h bbslist.h email.h fsedit.h lineedit.h \
mbstat.h msgutil.h oneline.h sgetpwent.h user.h bye.h \
mbstat.h msgutil.h oneline.h sgetpwent.h user.h bye.h morefile.h \
encrypt.h funcs.h mail.h mbuser.h myname.h page.h pwio.h shadowio.h \
xmalloc.h change.h exitinfo.h funcs4.h mball.h mbuseradd.h newuser.h \
xmalloc.h change.h exitinfo.h mball.h mbuseradd.h newuser.h \
pinfo.h rad64.h statetbl.h chat.h file.h getdef.h mbpasswd.h menu.h \
nextuser.h pop3.h safe.h timecheck.h mbnewusr.h input.h whoson.h \
door.h dispfile.h
MBSEBBS_OBJS = bank.o bbslist.o chat.o file.o funcs.o funcs4.o mail.o menu.o \
door.h dispfile.h userlist.h timestats.h logentry.h lastcallers.h
MBSEBBS_OBJS = bank.o bbslist.o chat.o file.o funcs.o mail.o menu.o \
misc.o pinfo.o nextuser.o oneline.o page.o fsedit.o \
bye.o change.o mbsebbs.o safe.o timeout.o user.o timecheck.o \
exitinfo.o filesub.o lineedit.o offline.o language.o msgutil.o \
pop3.o email.o input.o whoson.o door.o dispfile.o
pop3.o email.o input.o whoson.o door.o dispfile.o userlist.o timestats.o \
logentry.o morefile.o lastcallers.o
MBSEBBS_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a \
../lib/libdbase.a ../lib/libmbinet.a
MBNEWUSR_OBJS = mbnewusr.o newuser.o language.o timeout.o dispfile.o oneline.o \
timecheck.o input.o exitinfo.o mail.o email.o msgutil.o whoson.o \
pop3.o funcs.o misc.o lineedit.o fsedit.o funcs4.o change.o \
filesub.o
timecheck.o input.o exitinfo.o funcs.o misc.o change.o \
filesub.o mail.o email.o msgutil.o pop3.o lineedit.o fsedit.o whoson.o
MBNEWUSR_LIBS = ../lib/libmemwatch.a ../lib/libclcomm.a ../lib/libcommon.a ../lib/libmsgbase.a \
../lib/libdbase.a ../lib/libmbinet.a
MBALL_OBJS = mball.o
@@ -155,7 +155,7 @@ depend:
# Dependencies generated by make depend
bank.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bank.h input.h language.h dispfile.h timeout.h timecheck.h whoson.h exitinfo.h
commonio.o: ../config.h commonio.h
filesub.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h funcs.h language.h funcs4.h input.h misc.h timeout.h exitinfo.h change.h
filesub.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h funcs.h language.h input.h misc.h timeout.h exitinfo.h change.h
language.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h language.h
mbfbgen.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h
mbtoberep.o: ../lib/libs.h ../lib/structs.h
@@ -164,8 +164,9 @@ oneline.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/
sgetpwent.o: ../config.h sgetpwent.h
xmalloc.o: ../config.h xmalloc.h
bbslist.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h bbslist.h funcs.h input.h language.h
morefile.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h morefile.h
email.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/msgtext.h ../lib/msg.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h input.h email.h whoson.h
fsedit.o: fsedit.h
fsedit.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/ansi.h ../lib/common.h ../lib/clcomm.h mail.h funcs.h language.h timeout.h pinfo.h fsedit.h
lineedit.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mail.h input.h language.h timeout.h lineedit.h
mblang.o: ../lib/libs.h ../lib/structs.h ../lib/records.h
mbuser.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbuser.h
@@ -175,37 +176,40 @@ pwio.o: ../config.h sgetpwent.h commonio.h putpwent.h pwio.h
shadowio.o: ../config.h commonio.h shadowio.h
bye.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h dispfile.h misc.h language.h bye.h
encrypt.o: ../config.h encrypt.h
funcs.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h funcs4.h language.h input.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h mail.h email.h
funcs.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h
mail.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.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 whoson.h
mbpasswd.o: ../config.h encrypt.h rad64.h myname.h xmalloc.h pwio.h shadowio.h mbpasswd.h
mbuseradd.o: ../config.h mbuseradd.h
newuser.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs4.h input.h newuser.h language.h timeout.h change.h dispfile.h
newuser.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h
pinfo.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h pinfo.h input.h
rad64.o: ../config.h rad64.h
timecheck.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h timecheck.h funcs.h funcs4.h misc.h bye.h exitinfo.h language.h
change.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h change.h dispfile.h funcs.h funcs4.h input.h language.h misc.h timeout.h exitinfo.h bye.h
timecheck.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h timecheck.h funcs.h bye.h exitinfo.h language.h input.h
change.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h change.h dispfile.h funcs.h input.h language.h misc.h timeout.h exitinfo.h bye.h
exitinfo.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h funcs.h input.h language.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h
funcs4.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h ../lib/msg.h funcs4.h input.h misc.h timeout.h language.h
mball.o: ../lib/libs.h ../lib/structs.h ../lib/mbse.h ../lib/records.h ../lib/common.h ../lib/dbcfg.h ../lib/clcomm.h mball.h
mbsebbs.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h mbsebbs.h user.h dispfile.h funcs4.h language.h menu.h misc.h bye.h timeout.h
menu.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h oneline.h mail.h bbslist.h change.h bank.h chat.h file.h funcs.h funcs4.h input.h misc.h nextuser.h safe.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h whoson.h language.h offline.h email.h door.h dispfile.h
mbsebbs.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h mbsebbs.h user.h dispfile.h language.h menu.h misc.h bye.h timeout.h funcs.h
menu.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h oneline.h mail.h bbslist.h change.h bank.h chat.h file.h funcs.h input.h misc.h nextuser.h safe.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h whoson.h language.h offline.h email.h door.h dispfile.h userlist.h timestats.h logentry.h morefile.h lastcallers.h
nextuser.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/ansi.h ../lib/clcomm.h ../lib/common.h nextuser.h funcs.h input.h language.h timeout.h
pop3.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/msgtext.h ../lib/msg.h msgutil.h pop3.h
lastcallers.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h language.h lastcallers.h
safe.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h whoson.h dispfile.h input.h misc.h safe.h timeout.h language.h
timeout.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h timeout.h funcs.h funcs4.h bye.h filesub.h language.h
timeout.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h timeout.h funcs.h bye.h filesub.h language.h
chat.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h chat.h funcs.h input.h language.h misc.h whoson.h
file.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h filesub.h file.h funcs.h input.h language.h misc.h timeout.h exitinfo.h whoson.h change.h
getdef.o: ../config.h getdef.h
mbchat.o: ../lib/libs.h ../lib/structs.h ../lib/common.h ../lib/clcomm.h
mbstat.o: ../lib/libs.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbstat.h
misc.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h funcs4.h input.h language.h misc.h timeout.h exitinfo.h
offline.o: ../lib/libs.h ../lib/structs.h ../lib/mbse.h ../lib/records.h ../lib/bluewave.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h funcs4.h input.h language.h file.h filesub.h exitinfo.h timeout.h msgutil.h pop3.h offline.h whoson.h
misc.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h funcs.h input.h language.h misc.h timeout.h exitinfo.h
offline.o: ../lib/libs.h ../lib/structs.h ../lib/mbse.h ../lib/records.h ../lib/bluewave.h ../lib/common.h ../lib/clcomm.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h file.h filesub.h exitinfo.h timeout.h msgutil.h pop3.h offline.h whoson.h
putpwent.o: ../config.h putpwent.h
salt.o: ../config.h rad64.h getdef.h
user.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h timeout.h user.h dispfile.h funcs4.h input.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h statetbl.h email.h
mbnewusr.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mbnewusr.h funcs.h funcs4.h input.h language.h misc.h timeout.h newuser.h
user.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h timeout.h user.h dispfile.h funcs.h input.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h statetbl.h email.h
mbnewusr.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mbnewusr.h funcs.h input.h language.h misc.h timeout.h newuser.h
input.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h timeout.h language.h
whoson.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h language.h exitinfo.h whoson.h
door.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h input.h timeout.h exitinfo.h whoson.h door.h
dispfile.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h funcs4.h language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h dispfile.h
dispfile.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/msgtext.h ../lib/msg.h ../lib/clcomm.h funcs.h language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h dispfile.h
userlist.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h userlist.h language.h input.h timeout.h
timestats.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h timestats.h funcs.h language.h input.h exitinfo.h
logentry.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/common.h ../lib/clcomm.h logentry.h
# End of generated dependencies

View File

@@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/bye.c
* $Id$
* Purpose ...............: Hangup functions
* Last modification date : 26-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@@ -70,7 +69,7 @@ void Good_Bye(int onsig)
*/
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pUsrConfig = fopen(temp,"r+b")) != NULL) {
sprintf(temp, "%s/tmp/.bbs-exitinfo.%s", getenv("MBSE_ROOT"), pTTY);
sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, exitinfo.Name);
if ((pExitinfo = fopen(temp,"rb")) != NULL) {
fread(&usrconfighdr, sizeof(usrconfighdr), 1, pUsrConfig);
offset = usrconfighdr.hdrsize + (grecno * usrconfighdr.recsize);
@@ -111,7 +110,7 @@ void Good_Bye(int onsig)
sprintf(temp, "%s/tmp/mbsebbs%d", getenv("MBSE_ROOT"), getpid());
unlink(temp);
sprintf(temp, "%s/tmp/.bbs-exitinfo.%s", getenv("MBSE_ROOT"), pTTY);
sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, exitinfo.Name);
unlink(temp);
free(temp);
unlink("taglist");

View File

@@ -37,7 +37,6 @@
#include "change.h"
#include "dispfile.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"
@@ -224,6 +223,45 @@ void Chg_Password()
/*
* Function to check if User Handle exists and returns a 0 or 1
*/
int CheckHandle(char *);
int CheckHandle(char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp, *temp1;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char));
temp1 = calloc(PATH_MAX, sizeof(char));
strcpy(temp1, tl(Name));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if(( fp = fopen(temp,"rb")) != NULL) {
fread(&uhdr, sizeof(uhdr), 1, fp);
while (fread(&u, uhdr.recsize, 1, fp) == 1) {
strcpy(temp, tl(u.sHandle));
if((strcmp(temp, temp1)) == 0) {
Status = TRUE;
break;
}
}
free(temp);
free(temp1);
fclose(fp);
}
return Status;
}
/*
* Function will allow a user to change his handle
*/

View File

@@ -37,7 +37,6 @@
#include "../lib/msg.h"
#include "../lib/clcomm.h"
#include "funcs.h"
#include "funcs4.h"
#include "language.h"
#include "oneline.h"
#include "misc.h"
@@ -441,7 +440,7 @@ void ControlCodeK(int ch)
break;
case 'E':
printf("%d", Speed() );
printf("%ld", Speed());
break;
case 'F':
@@ -514,6 +513,10 @@ void ControlCodeK(int ch)
}
break;
case 'Q':
printf("%s %s", StrDateDMY(LastCallerTime), StrTimeHMS(LastCallerTime));
break;
default:
printf(" ");

View File

@@ -45,11 +45,9 @@
#include "exitinfo.h"
//extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
/*
* Copy usersrecord into ~/tmp/.bbs-exitinfo.tty
* Copy usersrecord into ~/home/unixname/exitinfo
*/
int InitExitinfo()
{
@@ -79,8 +77,7 @@ int InitExitinfo()
exitinfo = usrconfig;
fclose(pUsrConfig);
sprintf(temp, "%s/tmp/.bbs-exitinfo.%s", getenv("MBSE_ROOT"), pTTY);
mkdirs(temp);
sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, usrconfig.Name);
if ((pExitinfo = fopen(temp, "w+b")) == NULL) {
WriteError("$Can't open %s for writing", temp);
free(temp);
@@ -88,6 +85,8 @@ int InitExitinfo()
} else {
fwrite(&exitinfo, sizeof(exitinfo), 1, pExitinfo);
fclose(pExitinfo);
if (chmod(temp, 0600))
WriteError("$Can't chmod 0600 %s", temp);
}
free(temp);
return TRUE;
@@ -105,9 +104,9 @@ void ReadExitinfo()
char *temp;
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/tmp/.bbs-exitinfo.%s", getenv("MBSE_ROOT"), pTTY);
sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, sUnixName);
mkdirs(temp);
if(( pExitinfo = fopen(temp,"r+b")) == NULL)
if ((pExitinfo = fopen(temp,"r+b")) == NULL)
InitExitinfo();
else {
fflush(stdin);
@@ -130,8 +129,8 @@ void WriteExitinfo()
temp = calloc(PATH_MAX, sizeof(char));
sprintf(temp, "%s/tmp/.bbs-exitinfo.%s", getenv("MBSE_ROOT"), pTTY);
if(( pExitinfo = fopen(temp,"w+b")) == NULL)
sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, sUnixName);
if ((pExitinfo = fopen(temp,"w+b")) == NULL)
WriteError("$WriteExitinfo() failed");
else {
fwrite(&exitinfo, sizeof(exitinfo), 1, pExitinfo);

View File

@@ -53,6 +53,40 @@ int FileRecno = 0;
int CheckFile(char *, int);
int CheckFile(char *File, int iArea)
{
FILE *pFileB;
int iFile = FALSE;
char *sFileArea;
sFileArea = calloc(PATH_MAX, sizeof(char));
sprintf(sFileArea,"%s/fdb/fdb%d.dta", getenv("MBSE_ROOT"), iArea);
if(( pFileB = fopen(sFileArea,"r+")) == NULL) {
mkdir(sFileArea, 755);
return FALSE;
}
while ( fread(&file, sizeof(file), 1, pFileB) == 1) {
if((strcmp(tl(file.Name), tl(File))) == 0) {
iFile = TRUE;
fclose(pFileB);
return TRUE;
}
}
fclose(pFileB);
free(sFileArea);
if(!iFile)
return FALSE;
return 1;
}
/*
* Show filelist from current area, called from the menu.
*/

View File

@@ -37,7 +37,6 @@
#include "filesub.h"
#include "funcs.h"
#include "language.h"
#include "funcs4.h"
#include "input.h"
#include "misc.h"
#include "timeout.h"

View File

@@ -30,6 +30,19 @@
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*****************************************************************************/
#include "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/ansi.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "mail.h"
#include "funcs.h"
#include "language.h"
#include "timeout.h"
#include "pinfo.h"
#include "fsedit.h"

View File

@@ -3,20 +3,6 @@
/* $Id$ */
/* Includes needed for fsedit.c */
#include "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/ansi.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "mail.h"
#include "funcs4.h"
#include "language.h"
#include "timeout.h"
#include "pinfo.h"
int Fs_Edit(void); /* The fullscreen message editor */

View File

@@ -37,24 +37,322 @@
#include "../lib/msg.h"
#include "../lib/clcomm.h"
#include "funcs.h"
#include "funcs4.h"
#include "language.h"
#include "input.h"
#include "oneline.h"
#include "misc.h"
#include "bye.h"
#include "timeout.h"
#include "timecheck.h"
#include "exitinfo.h"
//#include "whoson.h"
#include "mail.h"
#include "email.h"
extern long ActiveMsgs;
//extern time_t t_start;
//extern int e_pid;
//extern char **environ;
extern pid_t mypid; /* Original pid */
void UserSilent(int flag)
{
SockS("ADIS:2,%d,%d;", mypid, flag);
}
/*
* Check BBS open status, return FALSE if the bbs is closed.
* Display the reason why to the user.
*/
int CheckStatus()
{
static char buf[81];
sprintf(buf, "SBBS:0;");
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:2,0", 7) == 0)
return TRUE;
if ((strncmp(buf, "100:2,2", 7) == 0) && (!ttyinfo.honor_zmh))
return TRUE;
buf[strlen(buf) -1] = '\0';
printf("\n\n\007*** %s ***\n\n\n", buf+8);
fflush(stdout);
}
return FALSE;
}
/*
* Function to check if UserName exists and returns a 0 or 1
*/
int CheckName(char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp, *temp1;
struct userhdr ushdr;
struct userrec us;
temp = calloc(81, 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);
while (fread(&us, ushdr.recsize, 1, fp) == 1) {
strcpy(temp, tl(us.sUserName));
if((strcmp(temp, temp1)) == 0) {
Status = TRUE;
break;
}
}
fclose(fp);
}
free(temp);
free(temp1);
return Status;
}
/*
* Function will check and create a home directory for the user if
* needed. It will also change into the users home directory when
* they login.
*/
char *ChangeHomeDir(char *Name, int Mailboxes)
{
char *temp;
static char temp1[PATH_MAX];
FILE *fp;
temp = calloc(PATH_MAX, sizeof(char));
/*
* set umask bits to zero's then reset with mkdir
*/
umask(000);
/*
* First check to see if users home directory exists
* else try create directory, as set in CFG.bbs_usersdir
*/
if ((access(CFG.bbs_usersdir, R_OK)) != 0) {
WriteError("$FATAL: Access to %s failed", CFG.bbs_usersdir);
free(temp);
ExitClient(1);
}
sprintf(temp1, "%s/%s", CFG.bbs_usersdir, Name);
/*
* Then check to see if users directory exists in the home dir
*/
if ((access(temp1, R_OK)) != 0) {
WriteError("$FATAL: Users homedir %s doesn't exist", temp1);
free(temp);
ExitClient(1);
}
/*
* Change to users home directory
*/
if (chdir(temp1) != 0) {
WriteError("$FATAL: Can't change to users home dir, aborting: %s", temp1);
free(temp);
ExitClient(1);
}
setenv("HOME", temp1, 1);
/*
* Check if user has a .signature file.
* If not, create a simple one.
*/
sprintf(temp, "%s/%s/.signature", CFG.bbs_usersdir, Name);
if (access(temp, R_OK)) {
Syslog('+', "Creating users .signature file");
if ((fp = fopen(temp, "w")) == NULL) {
WriteError("$Can't create %s", temp);
} else {
fprintf(fp, " Gtx, %s\n", exitinfo.sUserName);
if (CFG.EmailMode == E_PRMISP)
fprintf(fp, " email: %s@%s\n", exitinfo.Name, CFG.sysdomain);
fclose(fp);
}
}
/*
* Check subdirectories, create them if they don't exist.
*/
sprintf(temp, "%s/wrk", temp1);
CheckDir(temp);
sprintf(temp, "%s/tag", temp1);
CheckDir(temp);
sprintf(temp, "%s/upl", temp1);
CheckDir(temp);
sprintf(temp, "%s/tmp", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu/run", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu/tmp", temp1);
CheckDir(temp);
umask(007);
/*
* Check users private emailboxes
*/
if (Mailboxes) {
sprintf(temp, "%s/mailbox", temp1);
if (Msg_Open(temp))
Msg_Close();
sprintf(temp, "%s/archive", temp1);
if (Msg_Open(temp))
Msg_Close();
sprintf(temp, "%s/trash", temp1);
if (Msg_Open(temp))
Msg_Close();
}
free(temp);
return temp1;
}
void CheckDir(char *dir)
{
if ((access(dir, R_OK) != 0)) {
Syslog('+', "Creating %s", dir);
if (mkdir(dir, 0770))
WriteError("$Can't create %s", dir);
}
}
/*
* Function will find where MBSE is located on system and load
* the file $MBSE_ROOT/etc/config.data in memory.
*/
void FindMBSE()
{
FILE *pDataFile;
static char p[81];
char *FileName;
struct passwd *pw;
FileName = calloc(PATH_MAX, sizeof(char));
/*
* Check if the environment is set, if not, then we create the
* environment from the passwd file.
*/
if (getenv("MBSE_ROOT") == NULL) {
pw = getpwnam("mbse");
memset(&p, 0, sizeof(p));
sprintf(p, "MBSE_ROOT=%s", pw->pw_dir);
putenv(p);
}
if (getenv("MBSE_ROOT") == NULL) {
printf("FATAL ERROR: Environment variable MBSE_ROOT not set\n");
free(FileName);
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
sprintf(FileName, "%s/etc/config.data", getenv("MBSE_ROOT"));
if(( pDataFile = fopen(FileName, "rb")) == NULL) {
printf("FATAL ERROR: Can't open %s for reading!\n", FileName);
printf("Please run mbsetup to create configuration file.\n");
printf("Or check that your environment variable MBSE_ROOT is set to the BBS Path!\n");
free(FileName);
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
fread(&CFG, sizeof(CFG), 1, pDataFile);
free(FileName);
fclose(pDataFile);
}
/*
* Returns Mmm in the users language.
*/
char *GetMonth(int Month)
{
static char month[10];
switch (Month) {
case 1:
strcpy(month, *(mLanguage + 398));
break;
case 2:
strcpy(month, *(mLanguage + 399));
break;
case 3:
strcpy(month, *(mLanguage + 400));
break;
case 4:
strcpy(month, *(mLanguage + 401));
break;
case 5:
strcpy(month, *(mLanguage + 402));
break;
case 6:
strcpy(month, *(mLanguage + 403));
break;
case 7:
strcpy(month, *(mLanguage + 404));
break;
case 8:
strcpy(month, *(mLanguage + 405));
break;
case 9:
strcpy(month, *(mLanguage + 406));
break;
case 10:
strcpy(month, *(mLanguage + 407));
break;
case 11:
strcpy(month, *(mLanguage + 408));
break;
case 12:
strcpy(month, *(mLanguage + 409));
break;
default:
strcpy(month, "Unknown");
}
return(month);
}
/* Returns DD-Mmm-YYYY */
char *GLCdateyy()
{
static char GLcdateyy[15];
char ntime[15];
time(&Time_Now);
l_date = localtime(&Time_Now);
sprintf(GLcdateyy,"%02d-",
l_date->tm_mday);
sprintf(ntime,"-%02d", l_date->tm_year+1900);
strcat(GLcdateyy, GetMonth(l_date->tm_mon+1));
strcat(GLcdateyy,ntime);
return(GLcdateyy);
}
/*
@@ -78,277 +376,3 @@ int Access(securityrec us, securityrec ref)
}
void UserList(char *OpData)
{
FILE *pUsrConfig;
int LineCount = 2;
int iFoundName = FALSE;
int iNameCount = 0;
char *Name, *sTemp, *User;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char));
Name = calloc(37, sizeof(char));
sTemp = calloc(81, sizeof(char));
User = calloc(81, sizeof(char));
clear();
/* User List */
language(15, 0, 126);
Enter(1);
LineCount = 1;
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pUsrConfig = fopen(temp, "rb")) == NULL) {
WriteError("UserList: Can't open file: %s", temp);
return;
}
fread(&uhdr, sizeof(uhdr), 1, pUsrConfig);
/* Enter Username search string or (Enter) for all users: */
language(15, 0, 127);
colour(CFG.InputColourF, CFG.InputColourB);
alarm_on();
GetstrC(Name,35);
clear();
/* Name Location Last On Calls */
language(15, 0, 128);
Enter(1);
colour(2, 0);
fLine(79);
colour(3, 0);
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1) {
if ((strcmp(Name,"")) != 0) {
if((strcmp(OpData, "/H")) == 0)
sprintf(User, "%s", u.sHandle);
else
sprintf(User, "%s", u.sUserName);
if ((strstr(tl(User), tl(Name)) != NULL)) {
if ((!u.Hidden) && (!u.Deleted)) {
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else
printf("%-25s", u.sUserName);
} else
printf("%-25s", u.sUserName);
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
iFoundName = TRUE;
LineCount++;
iNameCount++;
}
}
} else
if ((!u.Hidden) && (!u.Deleted) && (strlen(u.sUserName) > 0)) {
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else
printf("%-25s", u.sUserName);
} else
printf("%-25s", u.sUserName);
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
iFoundName = TRUE;
LineCount++;
iNameCount++;
Enter(1);
}
if (LineCount >= exitinfo.iScreenLen - 2) {
LineCount = 0;
Pause();
colour(3, 0);
}
}
if(!iFoundName) {
language(3, 0, 129);
Enter(1);
}
fclose(pUsrConfig);
colour(2, 0);
fLine(79);
free(temp);
free(Name);
free(sTemp);
free(User);
Pause();
}
void TimeStats()
{
clear();
ReadExitinfo();
colour(15, 0);
/* TIME STATISTICS for */
printf("\n%s%s ", (char *) Language(134), exitinfo.sUserName);
/* on */
printf("%s %s\n", (char *) Language(135), (char *) logdate());
colour(12, 0);
fLine(79);
printf("\n");
colour(10, 0);
/* Current Time */
printf("%s %s\n", (char *) Language(136), (char *) GetLocalHMS());
/* Current Date */
printf("%s %s\n\n", (char *) Language(137), (char *) GLCdateyy());
/* Connect time */
printf("%s %d %s\n", (char *) Language(138), exitinfo.iConnectTime, (char *) Language(471));
/* Time used today */
printf("%s %d %s\n", (char *) Language(139), exitinfo.iTimeUsed, (char *) Language(471));
/* Time remaining today */
printf("%s %d %s\n", (char *) Language(140), exitinfo.iTimeLeft, (char *) Language(471));
/* Daily time limit */
printf("%s %d %s\n", (char *) Language(141), exitinfo.iTimeUsed + exitinfo.iTimeLeft, (char *) Language(471));
printf("\n");
Pause();
}
int CheckFile(char *File, int iArea)
{
FILE *pFileB;
int iFile = FALSE;
char *sFileArea;
sFileArea = calloc(PATH_MAX, sizeof(char));
sprintf(sFileArea,"%s/fdb/fdb%d.dta", getenv("MBSE_ROOT"), iArea);
if(( pFileB = fopen(sFileArea,"r+")) == NULL) {
mkdir(sFileArea, 755);
return FALSE;
}
while ( fread(&file, sizeof(file), 1, pFileB) == 1) {
if((strcmp(tl(file.Name), tl(File))) == 0) {
iFile = TRUE;
fclose(pFileB);
return TRUE;
}
}
fclose(pFileB);
free(sFileArea);
if(!iFile)
return FALSE;
return 1;
}
/*
* View a textfile.
*/
void ViewTextFile(char *Textfile)
{
FILE *fp;
int iLine = 0;
char *temp, *temp1;
char sPrompt[] = "\n(More (Y/n/=): ";
int i, x, z;
x = strlen(sPrompt);
temp1 = calloc(PATH_MAX, sizeof(char));
temp = calloc(81, sizeof(char));
sprintf(temp1, "%s", Textfile);
if(( fp = fopen (temp1, "r")) != NULL) {
while (fgets(temp, 80, fp) != NULL) {
printf("%s", temp);
++iLine;
if(iLine >= exitinfo.iScreenLen && iLine < 1000) {
iLine = 0;
pout(CFG.MoreF, CFG.MoreB, sPrompt);
fflush(stdout);
z = Getone();
switch(z) {
case 'n':
case 'N':
printf("\n");
break;
case '=':
iLine = 1000;
}
for(i = 0; i < x; i++)
printf("\b");
for(i = 0; i < x; i++)
printf(" ");
printf("\r");
}
}
fclose(fp);
}
Pause();
free(temp1);
free(temp);
}
/*
* Function will make log entry in users logfile
* Understands @ for Fileareas and ^ for Message Areas
*/
void LogEntry(char *Log)
{
char *Entry, *temp;
int i;
Entry = calloc(256, sizeof(char));
temp = calloc(1, sizeof(char));
for(i = 0; i < strlen(Log); i++) {
if(*(Log + i) == '@')
strcat(Entry, sAreaDesc);
else
if(*(Log + i) == '^')
strcat(Entry, sMsgAreaDesc);
else {
sprintf(temp, "%c", *(Log + i));
strcat(Entry, temp);
}
}
Syslog('+', Entry);
free(Entry);
free(temp);
}

View File

@@ -3,12 +3,15 @@
#ifndef _FUNCS_H
#define _FUNCS_H
int Access(securityrec, securityrec); /* Check security access */
void UserList(char *); /* Get complete users list */
void TimeStats(void); /* Get users Time Statistics */
int CheckFile(char *, int); /* Check for Dupe file in Database */
void ViewTextFile(char *); /* View text file */
void LogEntry(char *); /* Create log entry in logfile */
void UserSilent(int); /* Update users silent flag info */
int CheckStatus(void); /* Check BBS open status */
int CheckName(char *); /* Check if user name exists */
char *ChangeHomeDir(char *, int); /* Change and Create Users Home Directories */
void CheckDir(char *); /* Check and create directory */
void FindMBSE(void); /* Load Configuration file in memory */
char *GLCdateyy(void); /* Returns current date DD-Mmm-YYYY */
char *GetMonth(int); /* Returns Mmm */
int Access(securityrec, securityrec); /* Check security access */
#endif

View File

@@ -1,597 +0,0 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Misc functions, also for some utils.
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
* 1971 BV IJmuiden
* the Netherlands
*
* This file is part of MBSE BBS.
*
* This BBS is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* MBSE BBS is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MBSE BBS; see the file COPYING. If not, write to the Free
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*****************************************************************************/
#include "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "../lib/msg.h"
#include "funcs4.h"
#include "input.h"
#include "misc.h"
#include "timeout.h"
#include "language.h"
extern pid_t mypid; /* Original pid */
void UserSilent(int flag)
{
SockS("ADIS:2,%d,%d;", mypid, flag);
}
/*
* Check BBS open status, return FALSE if the bbs is closed.
* Display the reason why to the user.
*/
int CheckStatus()
{
static char buf[81];
sprintf(buf, "SBBS:0;");
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:2,0", 7) == 0)
return TRUE;
if ((strncmp(buf, "100:2,2", 7) == 0) && (!ttyinfo.honor_zmh))
return TRUE;
buf[strlen(buf) -1] = '\0';
printf("\n\n\007*** %s ***\n\n\n", buf+8);
fflush(stdout);
}
return FALSE;
}
/*
* Function will Scan Users Database for existing phone numbers. If
* found, it will write a log entry to the logfile. The user WILL NOT
* be notified about the same numbers
*/
int TelephoneScan(char *Number, char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(81, sizeof(char));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if(( fp = fopen(temp,"rb")) != NULL) {
fread(&uhdr, sizeof(uhdr), 1, fp);
while (fread(&u, uhdr.recsize, 1, fp) == 1) {
if (strcasecmp(u.sUserName, Name) != 0)
if ((strlen(u.sVoicePhone) && (strcmp(u.sVoicePhone, Number) == 0)) ||
(strlen(u.sDataPhone) && (strcmp(u.sDataPhone, Number) == 0))) {
Status = TRUE;
Syslog('b', "Dupe phones ref: \"%s\" voice: \"%s\" data: \"%s\"",
Number, u.sVoicePhone, u.sDataPhone);
Syslog('+', "Uses the same telephone number as %s", u.sUserName);
}
}
fclose(fp);
}
free(temp);
return Status;
}
/*
* Function to check if UserName exists and returns a 0 or 1
*/
int CheckName(char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp, *temp1;
struct userhdr ushdr;
struct userrec us;
temp = calloc(81, 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);
while (fread(&us, ushdr.recsize, 1, fp) == 1) {
strcpy(temp, tl(us.sUserName));
if((strcmp(temp, temp1)) == 0) {
Status = TRUE;
break;
}
}
fclose(fp);
}
free(temp);
free(temp1);
return Status;
}
/*
* This function returns the date in the following format:
* DD-Mon HH:MM:SS (Day-Month Time)
* The users language is used.
*/
char *logdate()
{
static char Logdate[15];
time(&Time_Now);
l_date = localtime(&Time_Now);
sprintf(Logdate,"%02d-%s %02d:%02d:%02d", l_date->tm_mday, GetMonth(l_date->tm_mon+1),
l_date->tm_hour, l_date->tm_min, l_date->tm_sec);
return(Logdate);
}
/*
* Function will ask user to create a unix login
* Name cannot be longer than 8 characters
*/
char *NameGen(char *FidoName)
{
char *sUserName;
struct passwd *pw;
sUserName = calloc(10, sizeof(char));
Syslog('+', "NameGen(%s)", FidoName);
setpwent();
while ((strcmp(sUserName, "") == 0 || (pw = getpwnam(sUserName)) != NULL) || (strlen(sUserName) < 3)) {
colour(12, 0);
printf("\n%s\n\n", (char *) Language(381));
colour(15, 0);
/* Please enter a login name (Maximum 8 characters) */
printf("\n%s\n", (char *) Language(383));
/* ie. John Doe, login = jdoe */
printf("%s\n", (char *) Language(384));
colour(10, 0);
/* login > */
printf("%s", (char *) Language(385));
fflush(stdout);
fflush(stdin);
GetstrU(sUserName, 7);
setpwent();
if (pw = getpwnam(tl(sUserName)), pw != NULL) {
/* That login name already exists, please choose another one. */
colour(12, 0);
printf("\n%s\n", (char *) Language(386));
setpwent();
}
}
return tl(sUserName);
}
/*
* Function will create the users name in the passwd file
*/
char *NameCreate(char *Name, char *Comment, char *Password)
{
char *PassEnt;
PassEnt = calloc(256, sizeof(char));
/*
* Call mbuseradd, this is a special setuid root program to create
* unix acounts and home directories.
*/
sprintf(PassEnt, "%s/bin/mbuseradd %d %s \"%s\" %s",
getenv("MBSE_ROOT"), getgid(), Name, Comment, CFG.bbs_usersdir);
Syslog('+', "%s", PassEnt);
fflush(stdout);
fflush(stdin);
if (system(PassEnt) != 0) {
WriteError("Failed to create unix account");
free(PassEnt);
ExitClient(1);
}
sprintf(PassEnt, "%s/bin/mbpasswd -f %s %s", getenv("MBSE_ROOT"), Name, Password);
Syslog('+', "%s/bin/mbpasswd -f %s ******", getenv("MBSE_ROOT"), Name);
if (system(PassEnt) != 0) {
WriteError("Failed to set unix password");
free(PassEnt);
ExitClient(1);
}
colour(14, 0);
/* Your "Unix Account" is created, you may use it the next time you call */
printf("\n%s\n", (char *) Language(382));
Syslog('+', "Created Unix account %s for %s", Name, Comment);
free(PassEnt);
return Name;
}
/*
* Function will check and create a home directory for the user if
* needed. It will also change into the users home directory when
* they login.
*/
char *ChangeHomeDir(char *Name, int Mailboxes)
{
char *temp;
static char temp1[PATH_MAX];
FILE *fp;
temp = calloc(PATH_MAX, sizeof(char));
/*
* set umask bits to zero's then reset with mkdir
*/
umask(000);
/*
* First check to see if users home directory exists
* else try create directory, as set in CFG.bbs_usersdir
*/
if ((access(CFG.bbs_usersdir, R_OK)) != 0) {
WriteError("$FATAL: Access to %s failed", CFG.bbs_usersdir);
free(temp);
ExitClient(1);
}
sprintf(temp1, "%s/%s", CFG.bbs_usersdir, Name);
/*
* Then check to see if users directory exists in the home dir
*/
if ((access(temp1, R_OK)) != 0) {
WriteError("$FATAL: Users homedir %s doesn't exist", temp1);
free(temp);
ExitClient(1);
}
/*
* Change to users home directory
*/
if (chdir(temp1) != 0) {
WriteError("$FATAL: Can't change to users home dir, aborting: %s", temp1);
free(temp);
ExitClient(1);
}
setenv("HOME", temp1, 1);
/*
* Check if user has a .signature file.
* If not, create a simple one.
*/
sprintf(temp, "%s/%s/.signature", CFG.bbs_usersdir, Name);
if (access(temp, R_OK)) {
Syslog('+', "Creating users .signature file");
if ((fp = fopen(temp, "w")) == NULL) {
WriteError("$Can't create %s", temp);
} else {
fprintf(fp, " Gtx, %s\n", exitinfo.sUserName);
if (CFG.EmailMode == E_PRMISP)
fprintf(fp, " email: %s@%s\n", exitinfo.Name, CFG.sysdomain);
fclose(fp);
}
}
/*
* Check subdirectories, create them if they don't exist.
*/
sprintf(temp, "%s/wrk", temp1);
CheckDir(temp);
sprintf(temp, "%s/tag", temp1);
CheckDir(temp);
sprintf(temp, "%s/upl", temp1);
CheckDir(temp);
sprintf(temp, "%s/tmp", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu/run", temp1);
CheckDir(temp);
sprintf(temp, "%s/.dosemu/tmp", temp1);
CheckDir(temp);
umask(007);
/*
* Check users private emailboxes
*/
if (Mailboxes) {
sprintf(temp, "%s/mailbox", temp1);
if (Msg_Open(temp))
Msg_Close();
sprintf(temp, "%s/archive", temp1);
if (Msg_Open(temp))
Msg_Close();
sprintf(temp, "%s/trash", temp1);
if (Msg_Open(temp))
Msg_Close();
}
free(temp);
return temp1;
}
void CheckDir(char *dir)
{
if ((access(dir, R_OK) != 0)) {
Syslog('+', "Creating %s", dir);
if (mkdir(dir, 0770))
WriteError("$Can't create %s", dir);
}
}
/*
* Function will check /etc/passwd for users fidonet login name.
* This will allow users to login in with there full name instead of
* their login name, to cut out confusion between unix accounts
* and normal bbs logins.
*/
int Check4UnixLogin(char *UsersName)
{
unsigned UID = -1; /* Set to -1 incase user is not found */
struct passwd *pw;
while ((pw = getpwent())) {
if(strcmp(pw->pw_gecos, UsersName) == 0) {
UID = pw->pw_uid;
break;
}
}
return UID;
}
/*
* Function to check if User Handle exists and returns a 0 or 1
*/
int CheckHandle(char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp, *temp1;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char));
temp1 = calloc(PATH_MAX, sizeof(char));
strcpy(temp1, tl(Name));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if(( fp = fopen(temp,"rb")) != NULL) {
fread(&uhdr, sizeof(uhdr), 1, fp);
while (fread(&u, uhdr.recsize, 1, fp) == 1) {
strcpy(temp, tl(u.sHandle));
if((strcmp(temp, temp1)) == 0) {
Status = TRUE;
break;
}
}
free(temp);
free(temp1);
fclose(fp);
}
return Status;
}
/*
* Function will check for unwanted user names
*/
int BadNames(char *Username)
{
FILE *fp;
short iFoundName = FALSE;
char *temp, *String, *User;
temp = calloc(PATH_MAX, sizeof(char));
String = calloc(81, sizeof(char));
User = calloc(81, sizeof(char));
strcpy(User, tl(Username));
sprintf(temp, "%s/etc/badnames.ctl", getenv("MBSE_ROOT"));
if(( fp = fopen(temp, "r")) != NULL) {
while((fgets(String, 80, fp)) != NULL) {
strcpy(String, tl(String));
Striplf(String);
if((strstr(User, String)) != NULL) {
printf("\nSorry that name is not acceptable on this system\n");
iFoundName = TRUE;
break;
}
}
fclose(fp);
}
free(temp);
free(String);
free(User);
return iFoundName;
}
/*
* Function will find where MBSE is located on system and load
* the file $MBSE_ROOT/etc/config.data in memory.
*/
void FindMBSE()
{
FILE *pDataFile;
static char p[81];
char *FileName;
struct passwd *pw;
FileName = calloc(PATH_MAX, sizeof(char));
/*
* Check if the environment is set, if not, then we create the
* environment from the passwd file.
*/
if (getenv("MBSE_ROOT") == NULL) {
pw = getpwnam("mbse");
memset(&p, 0, sizeof(p));
sprintf(p, "MBSE_ROOT=%s", pw->pw_dir);
putenv(p);
}
if (getenv("MBSE_ROOT") == NULL) {
printf("FATAL ERROR: Environment variable MBSE_ROOT not set\n");
free(FileName);
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
sprintf(FileName, "%s/etc/config.data", getenv("MBSE_ROOT"));
if(( pDataFile = fopen(FileName, "rb")) == NULL) {
printf("FATAL ERROR: Can't open %s for reading!\n", FileName);
printf("Please run mbsetup to create configuration file.\n");
printf("Or check that your environment variable MBSE_ROOT is set to the BBS Path!\n");
free(FileName);
#ifdef MEMWATCH
mwTerm();
#endif
exit(1);
}
fread(&CFG, sizeof(CFG), 1, pDataFile);
free(FileName);
fclose(pDataFile);
}
/*
* Returns Mmm in the users language.
*/
char *GetMonth(int Month)
{
static char month[10];
switch (Month) {
case 1:
strcpy(month, *(mLanguage + 398));
break;
case 2:
strcpy(month, *(mLanguage + 399));
break;
case 3:
strcpy(month, *(mLanguage + 400));
break;
case 4:
strcpy(month, *(mLanguage + 401));
break;
case 5:
strcpy(month, *(mLanguage + 402));
break;
case 6:
strcpy(month, *(mLanguage + 403));
break;
case 7:
strcpy(month, *(mLanguage + 404));
break;
case 8:
strcpy(month, *(mLanguage + 405));
break;
case 9:
strcpy(month, *(mLanguage + 406));
break;
case 10:
strcpy(month, *(mLanguage + 407));
break;
case 11:
strcpy(month, *(mLanguage + 408));
break;
case 12:
strcpy(month, *(mLanguage + 409));
break;
default:
strcpy(month, "Unknown");
}
return(month);
}
/* Returns DD-Mmm-YYYY */
char *GLCdateyy()
{
static char GLcdateyy[15];
char ntime[15];
time(&Time_Now);
l_date = localtime(&Time_Now);
sprintf(GLcdateyy,"%02d-",
l_date->tm_mday);
sprintf(ntime,"-%02d", l_date->tm_year+1900);
strcat(GLcdateyy, GetMonth(l_date->tm_mon+1));
strcat(GLcdateyy,ntime);
return(GLcdateyy);
}

View File

@@ -1,24 +0,0 @@
/* $Id$ */
#ifndef _FUNCS4_H
#define _FUNCS4_H
void UserSilent(int); /* Update users silent flag info */
int CheckStatus(void); /* Check BBS open status */
int TelephoneScan(char *, char *);/* Scans for Duplicate User Phone Numbers */
int CheckName(char *); /* Check if user name exists */
char *logdate(void); /* Returns DD-Mon HH:MM:SS */
char *NameGen(char *); /* Get and test for unix login */
char *NameCreate(char *, char *, char *);/* Create users login in passwd file */
char *ChangeHomeDir(char *, int); /* Change and Create Users Home Directories */
void CheckDir(char *); /* Check and create directory */
int Check4UnixLogin(char *); /* Check Passwd File for Users Login */
int CheckHandle(char *); /* Check if user handle exists */
int BadNames(char *); /* Check for Unwanted user names */
void FindMBSE(void); /* Load Configuration file in memory */
char *GLCdateyy(void); /* Returns current date DD-Mmm-YYYY */
char *GetMonth(int); /* Returns Mmm */
#endif

152
mbsebbs/lastcallers.c Normal file
View File

@@ -0,0 +1,152 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Display Last Callers
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
* 1971 BV IJmuiden
* the Netherlands
*
* This file is part of MBSE BBS.
*
* This BBS is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* MBSE BBS is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MBSE BBS; see the file COPYING. If not, write to the Free
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*****************************************************************************/
#include "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "input.h"
#include "language.h"
#include "lastcallers.h"
/*
* Last caller action flags
*/
extern int LC_Download;
extern int LC_Upload;
extern int LC_Read;
extern int LC_Wrote;
extern int LC_Chat;
extern int LC_Olr;
extern int LC_Door;
/*
* Display last callers screen.
*/
void LastCallers(char *OpData)
{
FILE *pLC;
int LineCount = 5;
int count = 0;
char *sFileName;
char *Heading;
char *Underline;
int i, x;
struct lastcallers lcall;
struct lastcallershdr lcallhdr;
sFileName = calloc(PATH_MAX, sizeof(char));
Heading = calloc(81, sizeof(char));
Underline = calloc(81, sizeof(char));
clear();
sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT"));
if((pLC = fopen(sFileName,"r")) == NULL)
WriteError("$LastCallers: Can't open %s", sFileName);
else {
fread(&lcallhdr, sizeof(lcallhdr), 1, pLC);
colour(15, 0);
/* Todays callers to */
sprintf(Heading, "%s%s", (char *) Language(84), CFG.bbs_name);
Center(Heading);
x = strlen(Heading);
for(i = 0; i < x; i++)
sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
colour(12, 0);
Center(Underline);
printf("\n");
/* # User Name Device timeOn Calls Location */
pout(10, 0, (char *) Language(85));
Enter(1);
colour(2, 0);
fLine(79);
while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) {
if(!lcall.Hidden) {
count++;
colour(15,0);
printf("%-5d", count);
colour(11, 0);
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' '))
printf("%-20s", lcall.Handle);
else
printf("%-20s", lcall.UserName);
} else
printf("%-20s", lcall.UserName);
colour(9, 0);
printf("%-8s", lcall.Device);
colour(13, 0);
printf("%-8s", lcall.TimeOn);
colour(14, 0);
printf("%-7d", lcall.Calls);
colour(12, 0);
printf("%-32s\n", lcall.Location);
LineCount++;
if (LineCount == exitinfo.iScreenLen) {
Pause();
LineCount = 0;
}
} /* End of check if user is sysop */
}
colour(2, 0);
fLine(79);
fclose(pLC);
printf("\n");
Pause();
}
free(sFileName);
free(Heading);
free(Underline);
}

8
mbsebbs/lastcallers.h Normal file
View File

@@ -0,0 +1,8 @@
/* $Id$ */
#ifndef _LASTCALLERS_H
#define _LASTCALLERS_H
void LastCallers(char *);
#endif

70
mbsebbs/logentry.c Normal file
View File

@@ -0,0 +1,70 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Make a log entry
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
* 1971 BV IJmuiden
* the Netherlands
*
* This file is part of MBSE BBS.
*
* This BBS is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* MBSE BBS is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MBSE BBS; see the file COPYING. If not, write to the Free
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*****************************************************************************/
#include "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "logentry.h"
/*
* Function will make log entry in users logfile
* Understands @ for Fileareas and ^ for Message Areas
*/
void LogEntry(char *Log)
{
char *Entry, *temp;
int i;
Entry = calloc(256, sizeof(char));
temp = calloc(1, sizeof(char));
for(i = 0; i < strlen(Log); i++) {
if(*(Log + i) == '@')
strcat(Entry, sAreaDesc);
else
if(*(Log + i) == '^')
strcat(Entry, sMsgAreaDesc);
else {
sprintf(temp, "%c", *(Log + i));
strcat(Entry, temp);
}
}
Syslog('+', Entry);
free(Entry);
free(temp);
}

9
mbsebbs/logentry.h Normal file
View File

@@ -0,0 +1,9 @@
/* $Id$ */
#ifndef _LOGENTRY_H
#define _LOGENTRY_H
void LogEntry(char *); /* Create log entry in logfile */
#endif

View File

@@ -111,10 +111,10 @@ int main(int argc, char **argv)
if (strncmp( (tty = *(argv+1)), "/dev/", 5 ) == 0 ) {
tty+=5;
sprintf(pid,"%s/tmp/.bbs-exitinfo.%s",BBSpath,tty);
sprintf(pid,"%s/bbs/exitinfo", CFG.bbs_usersdir);
strcpy(sTTY,"");
} else {
sprintf(pid,"%s/tmp/.bbs-exitinfo.%s",BBSpath,*(argv+1));
sprintf(pid,"%s/bbs/exitinfo", CFG.bbs_usersdir);
strcpy(sTTY,"/dev/");
}

View File

@@ -36,7 +36,6 @@
#include "../lib/clcomm.h"
#include "mbnewusr.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"

View File

@@ -38,12 +38,13 @@
#include "mbsebbs.h"
#include "user.h"
#include "dispfile.h"
#include "funcs4.h"
#include "language.h"
#include "menu.h"
#include "misc.h"
#include "bye.h"
#include "timeout.h"
#include "funcs.h"
extern int do_quiet; /* Logging quiet flag */
time_t t_start;

View File

@@ -42,7 +42,6 @@
#include "chat.h"
#include "file.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "misc.h"
#include "nextuser.h"
@@ -59,6 +58,11 @@
#include "email.h"
#include "door.h"
#include "dispfile.h"
#include "userlist.h"
#include "timestats.h"
#include "logentry.h"
#include "morefile.h"
#include "lastcallers.h"

View File

@@ -35,7 +35,6 @@
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "misc.h"
@@ -43,7 +42,6 @@
#include "exitinfo.h"
extern pid_t mypid; /* Pid of this program */
extern char *StartTime; /* Time user logged in */
/*
@@ -58,112 +56,6 @@ int LC_Olr = FALSE;
int LC_Door = FALSE;
int MoreFile(char *filename)
{
char Buf[81];
static FILE *fptr;
int lines;
int input;
int ignore = FALSE;
int maxlines;
maxlines = lines = exitinfo.iScreenLen - 2;
if ((fptr = fopen(filename,"r")) == NULL) {
printf("%s%s\n", (char *) Language(72), filename);
return(0);
}
printf("\n");
while (fgets(Buf,80,fptr) != NULL) {
if ((lines != 0) || (ignore)) {
lines--;
printf("%s",Buf);
}
if (strlen(Buf) == 0) {
fclose(fptr);
return(0);
}
if (lines == 0) {
fflush(stdin);
/* More (Y/n/=) */
printf(" %sY\x08", (char *) Language(61));
fflush(stdout);
alarm_on();
input = toupper(getchar());
if ((input == Keystroke(61, 0)) || (input == '\r'))
lines = maxlines;
if (input == Keystroke(61, 1)) {
fclose(fptr);
return(0);
}
if (input == Keystroke(61, 2))
ignore = TRUE;
else
lines = maxlines;
}
}
Pause();
fclose(fptr);
return 1;
}
int GetLastUser()
{
FILE *pCallerLog;
char *sDataFile;
sDataFile = calloc(PATH_MAX, sizeof(char));
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
if((pCallerLog = fopen(sDataFile, "r+")) == NULL)
WriteError("GetLastUser: Can't open file: %s", sDataFile);
else {
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
/* Get lastcaller in memory */
strcpy(LastCaller, SYSINFO.LastCaller);
/* Set next lastcaller (this user) */
if(!usrconfig.Hidden)
strcpy(SYSINFO.LastCaller,exitinfo.sUserName);
SYSINFO.SystemCalls++;
switch(ttyinfo.type) {
case POTS:
SYSINFO.Pots++;
break;
case ISDN:
SYSINFO.ISDN++;
break;
case NETWORK:
SYSINFO.Network++;
break;
case LOCAL:
SYSINFO.Local++;
break;
}
rewind(pCallerLog);
fwrite(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
fclose(pCallerLog);
}
free(sDataFile);
return 1;
}
int ChkFiles()
{
@@ -338,128 +230,3 @@ char *GLCdate()
/*
* Display last callers screen.
*/
void LastCallers(char *OpData)
{
FILE *pLC;
int LineCount = 5;
int count = 0;
char *sFileName;
char *Heading;
char *Underline;
int i, x;
struct lastcallers lcall;
struct lastcallershdr lcallhdr;
sFileName = calloc(PATH_MAX, sizeof(char));
Heading = calloc(81, sizeof(char));
Underline = calloc(81, sizeof(char));
clear();
sprintf(sFileName,"%s/etc/lastcall.data", getenv("MBSE_ROOT"));
if((pLC = fopen(sFileName,"r")) == NULL)
WriteError("$LastCallers: Can't open %s", sFileName);
else {
fread(&lcallhdr, sizeof(lcallhdr), 1, pLC);
colour(15, 0);
/* Todays callers to */
sprintf(Heading, "%s%s", (char *) Language(84), CFG.bbs_name);
Center(Heading);
x = strlen(Heading);
for(i = 0; i < x; i++)
sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
colour(12, 0);
Center(Underline);
printf("\n");
/* # User Name Device timeOn Calls Location */
pout(10, 0, (char *) Language(85));
Enter(1);
colour(2, 0);
fLine(79);
while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) {
if(!lcall.Hidden) {
count++;
colour(15,0);
printf("%-5d", count);
colour(11, 0);
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' '))
printf("%-20s", lcall.Handle);
else
printf("%-20s", lcall.UserName);
} else
printf("%-20s", lcall.UserName);
colour(9, 0);
printf("%-8s", lcall.Device);
colour(13, 0);
printf("%-8s", lcall.TimeOn);
colour(14, 0);
printf("%-7d", lcall.Calls);
colour(12, 0);
printf("%-32s\n", lcall.Location);
LineCount++;
if (LineCount == exitinfo.iScreenLen) {
Pause();
LineCount = 0;
}
} /* End of check if user is sysop */
}
colour(2, 0);
fLine(79);
fclose(pLC);
printf("\n");
Pause();
}
free(sFileName);
free(Heading);
free(Underline);
}
/*
* Check for a personal message, this will go via mbsed. If there
* is a message, it will be displayed, else nothing happens.
*/
void Check_PM(void)
{
static char buf[128];
char resp[128];
sprintf(buf, "CIPM:1,%d;", mypid);
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) == 0)
return;
strcpy(resp, strtok(buf, ":"));
strcpy(resp, strtok(NULL, ","));
colour(CYAN, BLACK);
/* ** Message ** from */
printf("\n\n\007%s %s:\n", (char *)Language(434), strtok(NULL, ","));
printf("%s\n", strtok(NULL, ";"));
Pause();
}
}

View File

@@ -1,15 +1,12 @@
/* $Id$ */
#ifndef _MISC_H
#define _MISC_H
void Setup(char *, char *); /* This function replaces a string in the users file */
int GetLastUser(void);
void LastCallers(char *);
void SaveLastCallers(void);
char *GLCdate(void); /* Returns current date DD-Mmm */
void DisplayLogo(void);
int ChkFiles(void);
int MoreFile(char *);
void Check_PM(void); /* Check for personal message */
#endif

116
mbsebbs/morefile.c Normal file
View File

@@ -0,0 +1,116 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Display file with more
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
* 1971 BV IJmuiden
* the Netherlands
*
* This file is part of MBSE BBS.
*
* This BBS is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* MBSE BBS is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MBSE BBS; see the file COPYING. If not, write to the Free
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*****************************************************************************/
#include "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
//#include "funcs.h"
//#include "input.h"
//#include "language.h"
#include "morefile.h"
//#include "timeout.h"
//#include "exitinfo.h"
//extern pid_t mypid; /* Pid of this program */
//extern char *StartTime; /* Time user logged in */
/*
* Last caller action flags
*/
//int LC_Download = FALSE;
//int LC_Upload = FALSE;
//int LC_Read = FALSE;
//int LC_Wrote = FALSE;
//int LC_Chat = FALSE;
//int LC_Olr = FALSE;
//int LC_Door = FALSE;
int MoreFile(char *filename)
{
char Buf[81];
static FILE *fptr;
int lines;
int input;
int ignore = FALSE;
int maxlines;
maxlines = lines = exitinfo.iScreenLen - 2;
if ((fptr = fopen(filename,"r")) == NULL) {
printf("%s%s\n", (char *) Language(72), filename);
return(0);
}
printf("\n");
while (fgets(Buf,80,fptr) != NULL) {
if ((lines != 0) || (ignore)) {
lines--;
printf("%s",Buf);
}
if (strlen(Buf) == 0) {
fclose(fptr);
return(0);
}
if (lines == 0) {
fflush(stdin);
/* More (Y/n/=) */
printf(" %sY\x08", (char *) Language(61));
fflush(stdout);
alarm_on();
input = toupper(getchar());
if ((input == Keystroke(61, 0)) || (input == '\r'))
lines = maxlines;
if (input == Keystroke(61, 1)) {
fclose(fptr);
return(0);
}
if (input == Keystroke(61, 2))
ignore = TRUE;
else
lines = maxlines;
}
}
Pause();
fclose(fptr);
return 1;
}

8
mbsebbs/morefile.h Normal file
View File

@@ -0,0 +1,8 @@
/* $Id$ */
#ifndef _MOREFILE_H
#define _MOREFILE_H
int MoreFile(char *);
#endif

View File

@@ -35,7 +35,7 @@
#include "../lib/records.h"
#include "../lib/clcomm.h"
#include "../lib/common.h"
#include "funcs4.h"
#include "funcs.h"
#include "input.h"
#include "newuser.h"
#include "language.h"
@@ -44,15 +44,30 @@
#include "dispfile.h"
extern int do_quiet; /* No logging to the screen */
extern pid_t mypid; /* Pid of this program */
char UnixName[9]; /* Unix Name */
extern char *ieHandle; /* Users Handle */
extern time_t t_start; /* Program starttime */
int do_mailout = FALSE; /* Just for linking */
/*
* Internal prototypes
*/
char *NameGen(char *); /* Get and test for unix login */
char *NameCreate(char *, char *, char *); /* Create users login in passwd file */
int BadNames(char *); /* Check for Unwanted user names */
int TelephoneScan(char *, char *); /* Scans for Duplicate User Phone Numbers */
/*
* Variables
*/
extern int do_quiet; /* No logging to the screen */
extern pid_t mypid; /* Pid of this program */
char UnixName[9]; /* Unix Name */
extern char *ieHandle; /* Users Handle */
extern time_t t_start; /* Program starttime */
int do_mailout = FALSE; /* Just for linking */
/*
* The main newuser registration function
*/
int newuser()
{
FILE *pUsrConfig;
@@ -574,3 +589,161 @@ void Good_Bye(int onsig)
}
/*
* Function will ask user to create a unix login
* Name cannot be longer than 8 characters
*/
char *NameGen(char *FidoName)
{
char *sUserName;
struct passwd *pw;
sUserName = calloc(10, sizeof(char));
Syslog('+', "NameGen(%s)", FidoName);
setpwent();
while ((strcmp(sUserName, "") == 0 || (pw = getpwnam(sUserName)) != NULL) || (strlen(sUserName) < 3)) {
colour(12, 0);
printf("\n%s\n\n", (char *) Language(381));
colour(15, 0);
/* Please enter a login name (Maximum 8 characters) */
printf("\n%s\n", (char *) Language(383));
/* ie. John Doe, login = jdoe */
printf("%s\n", (char *) Language(384));
colour(10, 0);
/* login > */
printf("%s", (char *) Language(385));
fflush(stdout);
fflush(stdin);
GetstrU(sUserName, 7);
setpwent();
if (pw = getpwnam(tl(sUserName)), pw != NULL) {
/* That login name already exists, please choose another one. */
colour(12, 0);
printf("\n%s\n", (char *) Language(386));
setpwent();
}
}
return tl(sUserName);
}
/*
* Function will create the users name in the passwd file
*/
char *NameCreate(char *Name, char *Comment, char *Password)
{
char *PassEnt;
PassEnt = calloc(256, sizeof(char));
/*
* Call mbuseradd, this is a special setuid root program to create
* unix acounts and home directories.
*/
sprintf(PassEnt, "%s/bin/mbuseradd %d %s \"%s\" %s",
getenv("MBSE_ROOT"), getgid(), Name, Comment, CFG.bbs_usersdir);
Syslog('+', "%s", PassEnt);
fflush(stdout);
fflush(stdin);
if (system(PassEnt) != 0) {
WriteError("Failed to create unix account");
free(PassEnt);
ExitClient(1);
}
sprintf(PassEnt, "%s/bin/mbpasswd -f %s %s", getenv("MBSE_ROOT"), Name, Password);
Syslog('+', "%s/bin/mbpasswd -f %s ******", getenv("MBSE_ROOT"), Name);
if (system(PassEnt) != 0) {
WriteError("Failed to set unix password");
free(PassEnt);
ExitClient(1);
}
colour(14, 0);
/* Your "Unix Account" is created, you may use it the next time you call */
printf("\n%s\n", (char *) Language(382));
Syslog('+', "Created Unix account %s for %s", Name, Comment);
free(PassEnt);
return Name;
}
/*
* Function will check for unwanted user names
*/
int BadNames(char *Username)
{
FILE *fp;
short iFoundName = FALSE;
char *temp, *String, *User;
temp = calloc(PATH_MAX, sizeof(char));
String = calloc(81, sizeof(char));
User = calloc(81, sizeof(char));
strcpy(User, tl(Username));
sprintf(temp, "%s/etc/badnames.ctl", getenv("MBSE_ROOT"));
if(( fp = fopen(temp, "r")) != NULL) {
while((fgets(String, 80, fp)) != NULL) {
strcpy(String, tl(String));
Striplf(String);
if((strstr(User, String)) != NULL) {
printf("\nSorry that name is not acceptable on this system\n");
iFoundName = TRUE;
break;
}
}
fclose(fp);
}
free(temp);
free(String);
free(User);
return iFoundName;
}
/*
* Function will Scan Users Database for existing phone numbers. If
* found, it will write a log entry to the logfile. The user WILL NOT
* be notified about the same numbers
*/
int TelephoneScan(char *Number, char *Name)
{
FILE *fp;
int Status = FALSE;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(81, sizeof(char));
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if(( fp = fopen(temp,"rb")) != NULL) {
fread(&uhdr, sizeof(uhdr), 1, fp);
while (fread(&u, uhdr.recsize, 1, fp) == 1) {
if (strcasecmp(u.sUserName, Name) != 0)
if ((strlen(u.sVoicePhone) && (strcmp(u.sVoicePhone, Number) == 0)) ||
(strlen(u.sDataPhone) && (strcmp(u.sDataPhone, Number) == 0))) {
Status = TRUE;
Syslog('b', "Dupe phones ref: \"%s\" voice: \"%s\" data: \"%s\"",
Number, u.sVoicePhone, u.sDataPhone);
Syslog('+', "Uses the same telephone number as %s", u.sUserName);
}
}
fclose(fp);
}
free(temp);
return Status;
}

View File

@@ -42,7 +42,6 @@
#include "../lib/msg.h"
#include "mail.h"
#include "funcs.h"
#include "funcs4.h"
#include "input.h"
#include "language.h"
#include "file.h"

View File

@@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: bbs/timecheck.c
* $Id$
* Purpose ...............: Timecheck functions
* Last modification date : 28-May-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@@ -37,11 +36,42 @@
#include "../lib/common.h"
#include "timecheck.h"
#include "funcs.h"
#include "funcs4.h"
#include "misc.h"
//#include "misc.h"
#include "bye.h"
#include "exitinfo.h"
#include "language.h"
#include "input.h"
extern pid_t mypid; /* Pid of this program */
/*
* Check for a personal message, this will go via mbsed. If there
* is a message, it will be displayed, else nothing happens.
*/
void Check_PM(void);
void Check_PM(void)
{
static char buf[128];
char resp[128];
sprintf(buf, "CIPM:1,%d;", mypid);
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) == 0)
return;
strcpy(resp, strtok(buf, ":"));
strcpy(resp, strtok(NULL, ","));
colour(CYAN, BLACK);
/* ** Message ** from */
printf("\n\n\007%s %s:\n", (char *)Language(434), strtok(NULL, ","));
printf("%s\n", strtok(NULL, ";"));
Pause();
}
}
/*

View File

@@ -37,7 +37,6 @@
#include "../lib/msg.h"
#include "timeout.h"
#include "funcs.h"
#include "funcs4.h"
#include "bye.h"
#include "filesub.h"
#include "language.h"

91
mbsebbs/timestats.c Normal file
View File

@@ -0,0 +1,91 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Time Statistics
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
* 1971 BV IJmuiden
* the Netherlands
*
* This file is part of MBSE BBS.
*
* This BBS is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* MBSE BBS is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MBSE BBS; see the file COPYING. If not, write to the Free
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*****************************************************************************/
#include "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/common.h"
#include "timestats.h"
#include "funcs.h"
#include "language.h"
#include "input.h"
#include "exitinfo.h"
void TimeStats()
{
char Logdate[15];
time(&Time_Now);
l_date = localtime(&Time_Now);
sprintf(Logdate,"%02d-%s %02d:%02d:%02d", l_date->tm_mday, GetMonth(l_date->tm_mon+1),
l_date->tm_hour, l_date->tm_min, l_date->tm_sec);
clear();
ReadExitinfo();
colour(15, 0);
/* TIME STATISTICS for */
printf("\n%s%s ", (char *) Language(134), exitinfo.sUserName);
/* on */
printf("%s %s\n", (char *) Language(135), Logdate);
colour(12, 0);
fLine(79);
printf("\n");
colour(10, 0);
/* Current Time */
printf("%s %s\n", (char *) Language(136), (char *) GetLocalHMS());
/* Current Date */
printf("%s %s\n\n", (char *) Language(137), (char *) GLCdateyy());
/* Connect time */
printf("%s %d %s\n", (char *) Language(138), exitinfo.iConnectTime, (char *) Language(471));
/* Time used today */
printf("%s %d %s\n", (char *) Language(139), exitinfo.iTimeUsed, (char *) Language(471));
/* Time remaining today */
printf("%s %d %s\n", (char *) Language(140), exitinfo.iTimeLeft, (char *) Language(471));
/* Daily time limit */
printf("%s %d %s\n", (char *) Language(141), exitinfo.iTimeUsed + exitinfo.iTimeLeft, (char *) Language(471));
printf("\n");
Pause();
}

9
mbsebbs/timestats.h Normal file
View File

@@ -0,0 +1,9 @@
/* $Id$ */
#ifndef _TIMESTATS_H
#define _TIMESTATS_H
void TimeStats(void); /* Get users Time Statistics */
#endif

View File

@@ -39,7 +39,7 @@
#include "timeout.h"
#include "user.h"
#include "dispfile.h"
#include "funcs4.h"
#include "funcs.h"
#include "input.h"
#include "misc.h"
#include "bye.h"
@@ -67,6 +67,59 @@ void SwapDate(char *, char *); /* Swap two Date strings around
void GetLastUser(void);
void GetLastUser(void)
{
FILE *pCallerLog;
char *sDataFile;
sDataFile = calloc(PATH_MAX, sizeof(char));
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
if((pCallerLog = fopen(sDataFile, "r+")) == NULL)
WriteError("GetLastUser: Can't open file: %s", sDataFile);
else {
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
/* Get lastcaller in memory */
strcpy(LastCaller, SYSINFO.LastCaller);
LastCallerTime = SYSINFO.LastTime;
/* Set next lastcaller (this user) */
if (!usrconfig.Hidden) {
strcpy(SYSINFO.LastCaller,exitinfo.sUserName);
SYSINFO.LastTime = time(NULL);
}
SYSINFO.SystemCalls++;
switch(ttyinfo.type) {
case POTS:
SYSINFO.Pots++;
break;
case ISDN:
SYSINFO.ISDN++;
break;
case NETWORK:
SYSINFO.Network++;
break;
case LOCAL:
SYSINFO.Local++;
break;
}
rewind(pCallerLog);
fwrite(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
fclose(pCallerLog);
}
free(sDataFile);
}
/*
* Function will take two date strings in the following format DD-MM-YYYY and
* swap them around in the following format YYYYMMDD
@@ -343,7 +396,7 @@ void user()
}
/*
* Write users structure to tmp file in ~/tmp/.bbs-exitinfo.ttyxx
* Write users structure to tmp file in ~/home/unixname/exitinfo
* A copy of the userrecord is also in the variable exitinfo.
*/
if (! InitExitinfo())

154
mbsebbs/userlist.c Normal file
View File

@@ -0,0 +1,154 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: Display Userlist
*
*****************************************************************************
* Copyright (C) 1997-2001
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
* 1971 BV IJmuiden
* the Netherlands
*
* This file is part of MBSE BBS.
*
* This BBS is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* MBSE BBS is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MBSE BBS; see the file COPYING. If not, write to the Free
* Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*****************************************************************************/
#include "../lib/libs.h"
#include "../lib/mbse.h"
#include "../lib/structs.h"
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "userlist.h"
#include "language.h"
#include "input.h"
#include "timeout.h"
void UserList(char *OpData)
{
FILE *pUsrConfig;
int LineCount = 2;
int iFoundName = FALSE;
int iNameCount = 0;
char *Name, *sTemp, *User;
char *temp;
struct userhdr uhdr;
struct userrec u;
temp = calloc(PATH_MAX, sizeof(char));
Name = calloc(37, sizeof(char));
sTemp = calloc(81, sizeof(char));
User = calloc(81, sizeof(char));
clear();
/* User List */
language(WHITE, BLACK, 126);
Enter(1);
LineCount = 1;
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if ((pUsrConfig = fopen(temp, "rb")) == NULL) {
WriteError("UserList: Can't open file: %s", temp);
return;
}
fread(&uhdr, sizeof(uhdr), 1, pUsrConfig);
/* Enter Username search string or (Enter) for all users: */
language(WHITE, BLACK, 127);
colour(CFG.InputColourF, CFG.InputColourB);
alarm_on();
GetstrC(Name, 35);
clear();
/* Name Location Last On Calls */
language(WHITE, BLACK, 128);
Enter(1);
colour(GREEN, BLACK);
fLine(79);
colour(CYAN, BLACK);
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1) {
if ((strcmp(Name,"")) != 0) {
if((strcmp(OpData, "/H")) == 0)
sprintf(User, "%s", u.sHandle);
else
sprintf(User, "%s", u.sUserName);
if ((strstr(tl(User), tl(Name)) != NULL)) {
if ((!u.Hidden) && (!u.Deleted)) {
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else
printf("%-25s", u.sUserName);
} else
printf("%-25s", u.sUserName);
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
iFoundName = TRUE;
LineCount++;
iNameCount++;
}
}
} else
if ((!u.Hidden) && (!u.Deleted) && (strlen(u.sUserName) > 0)) {
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
printf("%-25s", u.sHandle);
else
printf("%-25s", u.sUserName);
} else
printf("%-25s", u.sUserName);
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
iFoundName = TRUE;
LineCount++;
iNameCount++;
Enter(1);
}
if (LineCount >= exitinfo.iScreenLen - 2) {
LineCount = 0;
Pause();
colour(CYAN, BLACK);
}
}
if(!iFoundName) {
language(CYAN, BLACK, 129);
Enter(1);
}
fclose(pUsrConfig);
colour(GREEN, BLACK);
fLine(79);
free(temp);
free(Name);
free(sTemp);
free(User);
Pause();
}

8
mbsebbs/userlist.h Normal file
View File

@@ -0,0 +1,8 @@
/* $Id$ */
#ifndef _USERLIST_H
#define _USERLIST_H
void UserList(char *); /* Get complete users list */
#endif

View File

@@ -34,14 +34,8 @@
#include "../lib/records.h"
#include "../lib/common.h"
#include "../lib/clcomm.h"
//#include "funcs.h"
#include "input.h"
#include "language.h"
//#include "oneline.h"
//#include "misc.h"
//#include "bye.h"
//#include "timeout.h"
//#include "timecheck.h"
#include "exitinfo.h"
#include "whoson.h"
@@ -56,125 +50,115 @@ extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
*/
void WhosOn(char *OpData)
{
FILE *pExitinfo;
DIR *Directory;
char *Heading, *Underline, *temp, *tmp, *device;
struct dirent *Dir;
int i, x;
char buf[128], *Heading, *Underline, *cnt, *isdoing, *location, *device;
int i, x, Start = TRUE;
Underline = calloc(81, sizeof(char));
Heading = calloc(81, sizeof(char));
temp = calloc(PATH_MAX, sizeof(char));
tmp = calloc(PATH_MAX, sizeof(char));
WhosDoingWhat(WHOSON);
clear();
Enter(1);
colour(15, 0);
colour(WHITE, BLACK);
/* Callers On-Line to */
sprintf(Heading, "%s%s", (char *) Language(414), CFG.bbs_name);
Center(Heading);
x = strlen(Heading);
for(i = 0; i < x; i++)
sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
colour(12, 0);
colour(LIGHTRED, BLACK);
Center(Underline);
printf("\n");
pout(10, 0, (char *) Language(415));
/* Name Device Status Location */
pout(LIGHTGREEN, BLACK, (char *) Language(415));
Enter(1);
colour(2, 0);
colour(GREEN, BLACK);
fLine(79);
sprintf(tmp, "%s/tmp", getenv("MBSE_ROOT"));
if ((Directory = opendir(tmp)) != NULL)
while ((Dir = readdir( Directory )) != NULL)
if((strstr(Dir->d_name, ".bbs-exitinfo.")) != NULL) {
sprintf(temp, "%s/%s", tmp, Dir->d_name);
if(( pExitinfo = fopen(temp, "rb")) != NULL) {
fread(&exitinfo, sizeof(exitinfo), 1, pExitinfo);
while (TRUE) {
if (Start)
sprintf(buf, "GMON:1,1;");
else
sprintf(buf, "GMON:1,0;");
Start = FALSE;
if (socket_send(buf) == 0) {
strcpy(buf, socket_receive());
if (strncmp(buf, "100:0;", 6) == 0)
break; /* No more data */
if (strstr(buf, "mbsebbs")) {
cnt = strtok(buf, ",");
strtok(NULL, ",");
device = xstrcpy(strtok(NULL, ","));
/*
* We are only interested in copies of the mbsebbs program
*/
if ((strcmp(OpData, "/H")) == 0) {
/*
* The mbtask daemon has only the users real names, we
* want the handle instead.
*/
}
colour(LIGHTCYAN, BLACK);
printf("%-30s", strtok(NULL, ","));
colour(11, 0);
if((strcmp(OpData, "/H")) == 0) {
if((strcmp(exitinfo.sHandle, "") != 0 && *(exitinfo.sHandle) != ' '))
printf("%-30s", exitinfo.sHandle);
else
printf("%-30s", exitinfo.sUserName);
} else
printf("%-30s", exitinfo.sUserName);
colour(LIGHTBLUE, BLACK);
printf("%-9s", device);
free(device);
strtok(NULL, ",");
location = xstrcpy(strtok(NULL, ","));
isdoing = xstrcpy(strtok(NULL, ","));
colour(9, 0);
if((device = strstr(Dir->d_name, "tty")) != NULL)
printf("%-9s", device);
else
printf("%-9s", "None");
colour(WHITE, BLACK);
if (strstr(isdoing, "Browsing"))
/* Browseng */
printf("%-15s", (char *) Language(418));
else if (strstr(isdoing, "Downloading"))
/* Downloading */
printf("%-15s", (char *) Language(419));
else if (strstr(isdoing, "Uploading"))
/* Uploading */
printf("%-15s", (char *) Language(420));
else if (strstr(isdoing, "Read"))
/* Msg Section */
printf("%-15s", (char *) Language(421));
else if (strstr(isdoing, "External"))
/* External Door */
printf("%-15s", (char *) Language(422));
else if (strstr(isdoing, "Chat"))
/* Chatting */
printf("%-15s", (char *) Language(423));
else if (strstr(isdoing, "Files"))
/* Listing Files */
printf("%-15s", (char *) Language(424));
else if (strstr(isdoing, "Time"))
/* Banking Door */
printf("%-15s", (char *) Language(426));
else if (strstr(isdoing, "Safe"))
/* Safe Door */
printf("%-15s", (char *) Language(427));
else if (strstr(isdoing, "Whoson"))
/* WhosOn List */
printf("%-15s", (char *) Language(428));
else if (strstr(isdoing, "Offline"))
/* Idle */
printf("%-15s", (char *) Language(429));
else
printf("System error ");
colour(15, 0);
colour(LIGHTRED, BLACK);
printf("%-25s\n", location);
free(location);
free(isdoing);
}
}
}
/* Browseng */
if(exitinfo.iStatus == BROWSING)
printf("%-15s", (char *) Language(418));
/* Downloading */
else if(exitinfo.iStatus == DOWNLOAD)
printf("%-15s", (char *) Language(419));
/* Uploading */
else if(exitinfo.iStatus == UPLOAD)
printf("%-15s", (char *) Language(420));
/* Msg Section */
else if(exitinfo.iStatus == READ_POST)
printf("%-15s", (char *) Language(421));
/* External Door */
else if(exitinfo.iStatus == DOOR)
printf("%-15s", (char *) Language(422));
/* Chatting */
else if(exitinfo.iStatus == SYSOPCHAT)
printf("%-15s", (char *) Language(423));
/* Listing Files */
else if(exitinfo.iStatus == FILELIST)
printf("%-15s", (char *) Language(424));
/* Banking Door */
else if(exitinfo.iStatus == TIMEBANK)
printf("%-15s", (char *) Language(426));
/* Safe Door */
else if(exitinfo.iStatus == SAFE)
printf("%-15s", (char *) Language(427));
/* WhosOn List */
else if(exitinfo.iStatus == WHOSON)
printf("%-15s", (char *) Language(428));
/* Idle */
else
printf("%s", (char *) Language(429));
colour(12, 0);
printf("%-25s\n", exitinfo.sLocation);
fclose(pExitinfo);
}
}
closedir(Directory);
ReadExitinfo();
colour(2, 0);
colour(GREEN, BLACK);
fLine(79);
free(tmp);
free(temp);
free(Underline);
free(Heading);