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

@ -4286,6 +4286,8 @@ v0.33.19 26-Oct-2001
mbtask:
Changed to handle the External Doors flag in the lastcaller
information.
On new systems, ~/etc/config.data and ~/etc/task.data are
created with mode 0640.
mbmon:
Changed the lastcaller screen to display the External Door

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: jammsg.c
* $Id$
* Purpose ...............: JAM message base functions
* Last modification date : 30-Aug-2001
*
*****************************************************************************
*
@ -517,7 +516,7 @@ int JAM_Open(char *Msgbase)
File = calloc(PATH_MAX, sizeof(char));
sprintf(File, "%s%s", Msgbase, EXT_HDRFILE);
if ((fdHdr = open(File, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)) != -1) {
if ((fdHdr = open(File, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)) != -1) {
if (read(fdHdr, &jamHdrInfo, sizeof(JAMHDRINFO)) != sizeof(JAMHDRINFO)) {
memset(&jamHdrInfo, 0, sizeof(JAMHDRINFO));
jamHdrInfo.Signature[0] = Signature[0];
@ -536,11 +535,11 @@ int JAM_Open(char *Msgbase)
jamHdrInfo.Signature[2] == Signature[2] &&
jamHdrInfo.Signature[3] == Signature[3]) {
sprintf(File, "%s%s", Msgbase, EXT_TXTFILE);
fdJdt = open(File, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
fdJdt = open(File, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
sprintf(File, "%s%s", Msgbase, EXT_IDXFILE);
fdJdx = open(File, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
fdJdx = open(File, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
sprintf(File, "%s%s", Msgbase, EXT_LRDFILE);
fdJlr = open(File, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
fdJlr = open(File, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
RetVal = TRUE;
strcpy(BaseName, Msgbase);
@ -575,13 +574,13 @@ void JAM_Pack(void)
File = calloc(PATH_MAX, sizeof(char));
New = calloc(PATH_MAX, sizeof(char));
sprintf(File, "%s%s", BaseName, ".$dr");
fdnHdr = open(File, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
fdnHdr = open(File, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
sprintf(File, "%s%s", BaseName, ".$dt");
fdnJdt = open(File, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
fdnJdt = open(File, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
sprintf(File, "%s%s", BaseName, ".$dx");
fdnJdx = open(File, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
fdnJdx = open(File, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
sprintf(File, "%s%s", BaseName, ".$lr");
fdnJlr = open(File, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH);
fdnJlr = open(File, O_RDWR|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
if (fdnHdr != -1 && fdnJdt != -1 && fdnJdx != -1 && fdnJlr != -1) {
lseek(fdHdr, 0L, SEEK_SET);

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"

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_archive.c
* $Id$
* Purpose ...............: Setup Archive structure.
* Last modification date : 25-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -162,6 +161,7 @@ int CountArchive(void)
fwrite(&archiver, sizeof(archiver), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 8;
} else
return -1;
@ -264,6 +264,7 @@ void CloseArchive(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"archiver.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: m_domain.c
* $Id$
* Purpose ...............: Domain Setup
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -87,6 +86,7 @@ int CountDomain(void)
sprintf(domtrans.intdom, ".ftn");
fwrite(&domtrans, sizeof(domtrans), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 7;
} else
return -1;
@ -180,6 +180,7 @@ void CloseDomain(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"domtrans.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: m_farea.c
* $Id$
* Purpose ...............: File Setup Program
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -66,6 +65,7 @@ int CountFilearea(void)
areahdr.recsize = sizeof(area);
fwrite(&areahdr, sizeof(areahdr), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 0;
} else
return -1;
@ -146,6 +146,7 @@ void CloseFilearea(int force)
working(1, 0, 0);
if ((rename(fout, fin)) == 0)
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"fareas.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: m_ff.c
* $Id$
* Purpose ...............: Filefind Setup
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -65,6 +64,7 @@ int CountFilefind(void)
scanmgrhdr.recsize = sizeof(scanmgr);
fwrite(&scanmgrhdr, sizeof(scanmgrhdr), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 0;
} else
return -1;
@ -166,6 +166,7 @@ void CloseFilefind(int force)
fclose(fo);
tidy_stlist(&fff);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"scanmgr.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_fgroups.c
* $Id$
* Purpose ...............: Setup FGroups.
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -66,6 +65,7 @@ int CountFGroup(void)
fgrouphdr.recsize = sizeof(fgroup);
fwrite(&fgrouphdr, sizeof(fgrouphdr), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 0;
} else
return -1;
@ -179,6 +179,7 @@ void CloseFGroup(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"fgroups.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_fido.c
* $Id$
* Purpose ...............: Setup Fidonet structure.
* Last modification date : 25-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -91,6 +90,7 @@ int CountFidonet(void)
fwrite(&fidonet, sizeof(fidonet), 1, fil);
fclose(fil);
exp_golded = TRUE;
chmod(ffile, 0640);
return 2;
} else
return -1;
@ -196,6 +196,7 @@ void CloseFidonet(int force)
fclose(fo);
unlink(fout);
tidy_stlist(&fid);
chmod(fin, 0640);
Syslog('+', "Updated \"fidonet.data\"");
return;

View File

@ -89,12 +89,13 @@ int config_read(void)
int config_write(void)
{
some_fd = open(some_fn, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
some_fd = open(some_fn, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR | S_IRGRP);
if (some_fd == -1)
return -1;
write(some_fd, &CFG, sizeof(CFG));
close(some_fd);
chmod(some_fn, 0640);
exp_golded = TRUE;
return 0;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: m_hatch.c
* $Id$
* Purpose ...............: Hatch Setup
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -75,6 +74,7 @@ int CountHatch(void)
hatchhdr.lastupd = time(NULL);
fwrite(&hatchhdr, sizeof(hatchhdr), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 0;
} else
return -1;
@ -185,6 +185,7 @@ void CloseHatch(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"hatch.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_language.c
* $Id$
* Purpose ...............: Setup Languages.
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -118,7 +117,8 @@ int CountLanguage(void)
fwrite(&lang, sizeof(lang), 1, fil);
fclose(fil);
return 2;
chmod(ffile, 0640);
return 5;
} else
return -1;
}
@ -220,6 +220,7 @@ void CloseLanguage(int force)
fclose(fo);
unlink(fout);
tidy_stlist(&lan);
chmod(fin, 0640);
Syslog('+', "Updated \"language.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_limits.c
* $Id$
* Purpose ...............: Setup Limits.
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -128,6 +127,7 @@ int CountLimits(void)
fwrite(&LIMIT, sizeof(LIMIT), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 7;
} else
return -1;
@ -232,6 +232,7 @@ void CloseLimits(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"limits.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_magic.c
* $Id$
* Purpose ...............: Edit Magics
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -65,6 +64,7 @@ int CountMagics(void)
magichdr.recsize = sizeof(magic);
fwrite(&magichdr, sizeof(magichdr), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 0;
} else
return -1;
@ -176,6 +176,7 @@ void CloseMagics(int force)
fclose(fo);
tidy_stlist(&mag);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"magic.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: m_marea.c
* $Id$
* Purpose ...............: Message Areas Setup
* Last modification date : 25-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -72,6 +71,7 @@ int CountMsgarea(void)
fwrite(&msgshdr, sizeof(msgshdr), 1, fil);
fclose(fil);
exp_golded = TRUE;
chmod(ffile, 0660);
return 0;
} else
return -1;
@ -194,6 +194,7 @@ void CloseMsgarea(int Force)
exp_golded = TRUE;
if ((rename(fout, fin)) == 0)
unlink(fout);
chmod(fin, 0660);
Syslog('+', "Updated \"mareas.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: mbsetup/m_menu.c
* $Id$
* Purpose ...............: Edit BBS menus
* Last modification date : 27-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -346,6 +345,7 @@ void EditMenu(char *Name)
fwrite(&menus, sizeof(menus), 1, fil);
}
fclose(fil);
chmod(temp, 0640);
}
working(0, 0, 0);
}
@ -519,6 +519,7 @@ void EditMenus(void)
errmsg("Can't create menu %s", temp);
} else {
fclose(fil);
chmod(p, 0640);
Syslog('+', "Created menufile %s", p);
}
} else {

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_mgroups.c
* $Id$
* Purpose ...............: Setup MGroups.
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -66,6 +65,7 @@ int CountMGroup(void)
mgrouphdr.recsize = sizeof(mgroup);
fwrite(&mgrouphdr, sizeof(mgrouphdr), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 0;
} else
return -1;
@ -179,6 +179,7 @@ void CloseMGroup(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"mgroups.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_modem.c
* $Id$
* Purpose ...............: Setup Modem structure.
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -145,6 +144,7 @@ int CountModem(void)
fwrite(&modem, sizeof(modem), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 4;
} else
return -1;
@ -247,6 +247,7 @@ void CloseModem(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"modem.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: m_fnewfiles.c
* $id$
* Purpose ...............: Newfiles Setup
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -68,6 +67,7 @@ int CountNewfiles(void)
newfileshdr.grpsize = CFG.new_groups * 13;
fwrite(&newfileshdr, sizeof(newfileshdr), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 0;
} else
return -1;
@ -201,6 +201,7 @@ void CloseNewfiles(int force)
fclose(fo);
tidy_stlist(&new);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"newfiles.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_ngroups.c
* $Id$
* Purpose ...............: Setup NGroups.
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -64,6 +63,7 @@ int CountNGroup(void)
ngrouphdr.recsize = sizeof(ngroup);
fwrite(&ngrouphdr, sizeof(ngrouphdr), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 0;
} else
return -1;
@ -175,6 +175,7 @@ void CloseNGroup(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"ngroups.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: m_node.c
* $Id$
* Purpose ...............: Nodes Setup Program
* Last modification date : 25-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -70,6 +69,7 @@ int CountNoderec(void)
nodeshdr.mailgrp = CFG.toss_groups * 13;
fwrite(&nodeshdr, sizeof(nodeshdr), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 0;
} else
return -1;
@ -234,6 +234,7 @@ void CloseNoderec(int Force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"nodes.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_ol.c
* $Id$
* Purpose ...............: Setup Oneliners.
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -63,6 +62,7 @@ int CountOneline(void)
olhdr.recsize = sizeof(ol);
fwrite(&olhdr, sizeof(olhdr), 1, fil);
fclose(fil);
chmod(ffile, 0660);
return 0;
} else
return -1;
@ -148,6 +148,7 @@ void CloseOneline(int force)
working(1, 0, 0);
if ((rename(fout, fin)) == 0)
unlink(fout);
chmod(fin, 0660);
Syslog('+', "Updated \"oneline.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: mbsetup/m_protocol.c
* $Id$
* Purpose ...............: Setup Protocols.
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -108,6 +107,7 @@ int CountProtocol(void)
fwrite(&PROT, sizeof(PROT), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 4;
} else
return -1;
@ -209,6 +209,7 @@ void CloseProtocol(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
tidy_stlist(&pro);
Syslog('+', "Updated \"protocol.data\"");
return;

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: m_service.c
* $Id$
* Purpose ...............: Service Setup
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -83,6 +82,7 @@ int CountService(void)
sprintf(servrec.Service, "raid");
fwrite(&servrec, sizeof(servrec), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 6;
} else
return -1;
@ -184,6 +184,7 @@ void CloseService(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"servrec.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_task.c
* $Id$
* Purpose ...............: Setup TaskManager.
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -84,6 +83,7 @@ void CloseTask(void)
if ((fp = fopen(fin, "w+")) != NULL) {
fwrite(&TCFG, sizeof(TCFG), 1, fp);
fclose(fp);
chmod(fin, 0640);
Syslog('+', "Updated \"task.data\"");
}
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: m_ticareas.c
* $Id$
* Purpose ...............: TIC Areas Setup Program
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -73,6 +72,7 @@ int CountTicarea(void)
tichdr.lastupd = time(NULL);
fwrite(&tichdr, sizeof(tichdr), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 0;
} else
return -1;
@ -219,6 +219,7 @@ void CloseTicarea(int Force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"tic.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_tty.c
* $Id$
* Purpose ...............: Setup Ttyinfo structure.
* Last modification date : 19-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -139,6 +138,7 @@ int CountTtyinfo(void)
}
fclose(fil);
chmod(ffile, 0640);
return 34;
} else
return -1;
@ -241,6 +241,7 @@ void CloseTtyinfo(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"ttyinfo.data\"");
return;
}

View File

@ -65,6 +65,7 @@ int CountUsers(void)
usrconfighdr.recsize = sizeof(usrconfig);
fwrite(&usrconfighdr, sizeof(usrconfighdr), 1, fil);
fclose(fil);
chmod(ffile, 0660);
return 0;
} else
return -1;
@ -150,6 +151,7 @@ void CloseUsers(int force)
working(1, 0, 0);
if ((rename(fout, fin)) == 0)
unlink(fout);
chmod(fin, 0660);
Syslog('+', "Updated \"users.data\"");
return;
}

View File

@ -1,8 +1,7 @@
/*****************************************************************************
*
* File ..................: setup/m_virus.c
* $Id$
* Purpose ...............: Setup Virus structure.
* Last modification date : 25-Oct-2001
*
*****************************************************************************
* Copyright (C) 1997-2001
@ -86,6 +85,7 @@ int CountVirus(void)
fwrite(&virscan, sizeof(virscan), 1, fil);
fclose(fil);
chmod(ffile, 0640);
return 3;
} else
return -1;
@ -188,6 +188,7 @@ void CloseVirus(int force)
fclose(fi);
fclose(fo);
unlink(fout);
chmod(fin, 0640);
Syslog('+', "Updated \"virscan.data\"");
return;
}

View File

@ -396,6 +396,7 @@ void load_maincfg(void)
}
fwrite(&CFG, sizeof(CFG), 1, fp);
fclose(fp);
chmod(cfgfn, 0640);
} else {
fread(&CFG, sizeof(CFG), 1, fp);
fclose(fp);
@ -436,6 +437,7 @@ void load_taskcfg(void)
}
fwrite(&TCFG, sizeof(TCFG), 1, fp);
fclose(fp);
chmod(tcfgfn, 0640);
tasklog('+', "Created new %s", tcfgfn);
} else {
fread(&TCFG, sizeof(TCFG), 1, fp);