Updated datafile security modes

This commit is contained in:
Michiel Broek
2001-11-14 21:37:58 +00:00
parent 1febff88c3
commit 5f06e6e421
41 changed files with 111 additions and 122 deletions

View File

@@ -18,7 +18,7 @@ HDRS = bank.h commonio.h filesub.h language.h mbsebbs.h misc.h offline.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 mball.h mbuseradd.h newuser.h \
pinfo.h rad64.h statetbl.h chat.h file.h getdef.h mbpasswd.h menu.h \
pinfo.h rad64.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 userlist.h timestats.h logentry.h lastcallers.h
MBSEBBS_OBJS = bank.o bbslist.o chat.o file.o funcs.o mail.o menu.o \
@@ -164,9 +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
morefile.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clcomm.h ../lib/common.h input.h language.h morefile.h timeout.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: ../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
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 input.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
@@ -203,7 +203,7 @@ misc.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/records.h ../lib/clc
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 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
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 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

View File

@@ -88,6 +88,7 @@ void Bank()
bankhdr.recsize = sizeof(bank);
fwrite(&bankhdr, sizeof(bankhdr), 1, pBank);
fclose(pBank);
chmod(temp, 0660);
Syslog('-', "Created %s", temp);
AddAccount();
if ((pBank = fopen(temp, "r+")) == NULL) {

View File

@@ -197,6 +197,7 @@ void BBS_Add(void)
fwrite(&bbs, sizeof(bbs), 1, pBBSList);
fclose(pBBSList);
chmod(sFileName, 0660);
free(temp);
free(sFileName);
}
@@ -702,6 +703,7 @@ void BBS_Delete(void)
}
fclose(pBBSLine);
chmod(sFileName, 0660);
}

View File

@@ -1,9 +1,7 @@
/*****************************************************************************
* $Id$
*
* File ..................: mbsebbs/fsedit.c
* $Id$
* Purpose ...............: FullScreen Message editor.
* Last modification date : 29-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@@ -39,7 +37,7 @@
#include "../lib/common.h"
#include "../lib/clcomm.h"
#include "mail.h"
#include "funcs.h"
#include "input.h"
#include "language.h"
#include "timeout.h"
#include "pinfo.h"

View File

@@ -454,6 +454,7 @@ void closepage(FILE *fa, char *Path, int inArea, int Current)
rename(temp2, temp1);
free(temp1);
free(temp2);
chmod(temp1, 0644);
fa = NULL;
}
@@ -656,6 +657,7 @@ void MakeIndex()
fclose(fm);
sprintf(linebuf, "%s/index.html", CFG.ftp_base);
rename(fn, linebuf);
chmod(linebuf, 0644);
fclose(pAreas);
free(sAreas);

View File

@@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: mbtoberep/mbtoberep.c
* $Id$
* Purpose ...............: Show contents of toberep.data
* Last modification date : 09-Aug-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@@ -91,6 +90,7 @@ int main(int argc, char **argv)
}
fclose(fp);
chmod(temp, 0640);
free(temp);
#ifdef MEMWATCH
mwTerm();

View File

@@ -354,6 +354,7 @@ void UserPack(int days, int level, int pack)
}
fclose(fin);
fclose(fout);
chmod(fnin, 0660);
Syslog('+', "Userbase is updated, written %d records", record);
}
unlink(fnout);

View File

@@ -72,7 +72,7 @@ int ChkFiles()
* Check if users.data exists, if not create a new one.
*/
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
if((pUsersFile = fopen(temp,"rb")) == NULL) {
if ((pUsersFile = fopen(temp,"rb")) == NULL) {
if((pUsersFile = fopen(temp,"wb")) == NULL) {
WriteError("$Can't create %s", temp);
ExitClient(1);
@@ -81,13 +81,14 @@ int ChkFiles()
usrconfighdr.recsize = sizeof(usrconfig);
fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, pUsersFile);
fclose(pUsersFile);
chmod(temp, 0660);
}
}
/*
* Check if sysinfo.data exists, if not, create a new one.
*/
if((pCallerLog = fopen(sDataFile, "rb")) == NULL) {
if ((pCallerLog = fopen(sDataFile, "rb")) == NULL) {
if((pCallerLog = fopen(sDataFile, "wb")) == NULL)
WriteError("$ChkFiles: Can't create %s", sDataFile);
else {
@@ -98,6 +99,7 @@ int ChkFiles()
rewind(pCallerLog);
fwrite(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
fclose(pCallerLog);
chmod(sDataFile, 0660);
}
}
free(temp);
@@ -177,9 +179,10 @@ void SaveLastCallers()
Syslog('+', "Created new lastcall.data");
}
fclose(pGLC);
chmod(sFileName, 0660);
}
if(( pGLC = fopen(sFileName,"a+")) == NULL) {
if ((pGLC = fopen(sFileName,"a+")) == NULL) {
WriteError("$Can't open %s", sFileName);
return;
} else {

View File

@@ -58,6 +58,7 @@ void Oneliner_Check()
olhdr.recsize = sizeof(ol);
fwrite(&olhdr, sizeof(olhdr), 1, pOneline);
fclose(pOneline);
chmod(sFileName, 0660);
Syslog('-', "Created oneliner database");
}
}

View File

@@ -373,6 +373,7 @@ int SafeCheckUser(void)
safe.Opened = 0;
fwrite(&safe, sizeof(safe), 1, pSafe);
fclose(pSafe);
chmod(File, 0660);
}
} else {
while ( fread(&safe, sizeof(safe), 1, pSafe) == 1) {

View File

@@ -1,48 +0,0 @@
#ifndef STATETBL_H
#define STATETBL_H
#define SM_DECL(proc,name) \
int proc(void)\
{\
int sm_success=0;\
char *sm_name=name;
#define SM_STATES \
enum {
#define SM_NAMES \
} sm_state;\
char * sm_sname[] = {
#define SM_EDECL \
};
#define SM_START(x) \
sm_state=x;\
Syslog('S', "Statemachine %s start %s (%d)", sm_name, sm_sname[sm_state], sm_state);\
while (!sm_success) switch (sm_state)\
{\
default: WriteError("Statemachine %s error: state=%d",sm_name,sm_state);\
sm_success=-1;
#define SM_STATE(x) \
break;\
case x:
#define SM_END \
}\
#define SM_RETURN \
return (sm_success != 1);\
}
#define SM_PROCEED(x) \
sm_state=x; break;
#define SM_SUCCESS \
sm_success=1; break;
#define SM_ERROR \
sm_success=-1; break;
#endif

View File

@@ -50,7 +50,6 @@
#include "exitinfo.h"
#include "language.h"
#include "offline.h"
#include "statetbl.h"
#include "email.h"