From 5f06e6e421736d1494241a335581acf00587e65c Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Wed, 14 Nov 2001 21:37:58 +0000 Subject: [PATCH] Updated datafile security modes --- ChangeLog | 2 ++ lib/jammsg.c | 19 +++++++++--------- mbsebbs/Makefile | 8 ++++---- mbsebbs/bank.c | 1 + mbsebbs/bbslist.c | 2 ++ mbsebbs/fsedit.c | 6 ++---- mbsebbs/mball.c | 2 ++ mbsebbs/mbtoberep.c | 4 ++-- mbsebbs/mbuser.c | 1 + mbsebbs/misc.c | 9 ++++++--- mbsebbs/oneline.c | 1 + mbsebbs/safe.c | 1 + mbsebbs/statetbl.h | 48 -------------------------------------------- mbsebbs/user.c | 1 - mbsetup/m_archive.c | 5 +++-- mbsetup/m_domain.c | 5 +++-- mbsetup/m_farea.c | 5 +++-- mbsetup/m_ff.c | 5 +++-- mbsetup/m_fgroup.c | 5 +++-- mbsetup/m_fido.c | 5 +++-- mbsetup/m_global.c | 3 ++- mbsetup/m_hatch.c | 5 +++-- mbsetup/m_lang.c | 7 ++++--- mbsetup/m_limits.c | 5 +++-- mbsetup/m_magic.c | 5 +++-- mbsetup/m_marea.c | 5 +++-- mbsetup/m_menu.c | 5 +++-- mbsetup/m_mgroup.c | 5 +++-- mbsetup/m_modem.c | 5 +++-- mbsetup/m_new.c | 5 +++-- mbsetup/m_ngroup.c | 5 +++-- mbsetup/m_node.c | 5 +++-- mbsetup/m_ol.c | 5 +++-- mbsetup/m_protocol.c | 5 +++-- mbsetup/m_service.c | 5 +++-- mbsetup/m_task.c | 4 ++-- mbsetup/m_ticarea.c | 5 +++-- mbsetup/m_tty.c | 5 +++-- mbsetup/m_users.c | 2 ++ mbsetup/m_virus.c | 5 +++-- mbtask/mbtask.c | 2 ++ 41 files changed, 111 insertions(+), 122 deletions(-) delete mode 100644 mbsebbs/statetbl.h diff --git a/ChangeLog b/ChangeLog index 2eb33484..9747be38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/lib/jammsg.c b/lib/jammsg.c index 152910bf..5fab447c 100644 --- a/lib/jammsg.c +++ b/lib/jammsg.c @@ -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); diff --git a/mbsebbs/Makefile b/mbsebbs/Makefile index 26a20fe5..67158e5e 100644 --- a/mbsebbs/Makefile +++ b/mbsebbs/Makefile @@ -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 diff --git a/mbsebbs/bank.c b/mbsebbs/bank.c index 5c963af9..f6536c76 100644 --- a/mbsebbs/bank.c +++ b/mbsebbs/bank.c @@ -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) { diff --git a/mbsebbs/bbslist.c b/mbsebbs/bbslist.c index 0c444ec0..d033738f 100644 --- a/mbsebbs/bbslist.c +++ b/mbsebbs/bbslist.c @@ -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); } diff --git a/mbsebbs/fsedit.c b/mbsebbs/fsedit.c index 48343bdd..6d3c7bc2 100644 --- a/mbsebbs/fsedit.c +++ b/mbsebbs/fsedit.c @@ -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" diff --git a/mbsebbs/mball.c b/mbsebbs/mball.c index bf0e1668..8f36a1e8 100644 --- a/mbsebbs/mball.c +++ b/mbsebbs/mball.c @@ -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); diff --git a/mbsebbs/mbtoberep.c b/mbsebbs/mbtoberep.c index bc6e86e4..c666231f 100644 --- a/mbsebbs/mbtoberep.c +++ b/mbsebbs/mbtoberep.c @@ -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(); diff --git a/mbsebbs/mbuser.c b/mbsebbs/mbuser.c index cd654360..b69f0ff6 100644 --- a/mbsebbs/mbuser.c +++ b/mbsebbs/mbuser.c @@ -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); diff --git a/mbsebbs/misc.c b/mbsebbs/misc.c index 77a3edbd..57cd3553 100644 --- a/mbsebbs/misc.c +++ b/mbsebbs/misc.c @@ -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 { diff --git a/mbsebbs/oneline.c b/mbsebbs/oneline.c index 2f51569a..07139cfe 100644 --- a/mbsebbs/oneline.c +++ b/mbsebbs/oneline.c @@ -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"); } } diff --git a/mbsebbs/safe.c b/mbsebbs/safe.c index d51bdb4c..dde58a5c 100644 --- a/mbsebbs/safe.c +++ b/mbsebbs/safe.c @@ -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) { diff --git a/mbsebbs/statetbl.h b/mbsebbs/statetbl.h deleted file mode 100644 index 5ed4475f..00000000 --- a/mbsebbs/statetbl.h +++ /dev/null @@ -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 diff --git a/mbsebbs/user.c b/mbsebbs/user.c index 1b5e53c7..4dcfb492 100644 --- a/mbsebbs/user.c +++ b/mbsebbs/user.c @@ -50,7 +50,6 @@ #include "exitinfo.h" #include "language.h" #include "offline.h" -#include "statetbl.h" #include "email.h" diff --git a/mbsetup/m_archive.c b/mbsetup/m_archive.c index 5cbb6e7a..161de918 100644 --- a/mbsetup/m_archive.c +++ b/mbsetup/m_archive.c @@ -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; } diff --git a/mbsetup/m_domain.c b/mbsetup/m_domain.c index 4a97862a..2039090d 100644 --- a/mbsetup/m_domain.c +++ b/mbsetup/m_domain.c @@ -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; } diff --git a/mbsetup/m_farea.c b/mbsetup/m_farea.c index 5409d36f..2f8acea7 100644 --- a/mbsetup/m_farea.c +++ b/mbsetup/m_farea.c @@ -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; } diff --git a/mbsetup/m_ff.c b/mbsetup/m_ff.c index 8c8dc125..62632905 100644 --- a/mbsetup/m_ff.c +++ b/mbsetup/m_ff.c @@ -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; } diff --git a/mbsetup/m_fgroup.c b/mbsetup/m_fgroup.c index 092d70c8..97f6b838 100644 --- a/mbsetup/m_fgroup.c +++ b/mbsetup/m_fgroup.c @@ -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; } diff --git a/mbsetup/m_fido.c b/mbsetup/m_fido.c index 36ff3896..89f25fef 100644 --- a/mbsetup/m_fido.c +++ b/mbsetup/m_fido.c @@ -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; diff --git a/mbsetup/m_global.c b/mbsetup/m_global.c index 2a7665d6..abdd618d 100644 --- a/mbsetup/m_global.c +++ b/mbsetup/m_global.c @@ -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; } diff --git a/mbsetup/m_hatch.c b/mbsetup/m_hatch.c index e1e8fee1..52945513 100644 --- a/mbsetup/m_hatch.c +++ b/mbsetup/m_hatch.c @@ -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; } diff --git a/mbsetup/m_lang.c b/mbsetup/m_lang.c index 70bcd606..0897d64d 100644 --- a/mbsetup/m_lang.c +++ b/mbsetup/m_lang.c @@ -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; } diff --git a/mbsetup/m_limits.c b/mbsetup/m_limits.c index 8f85f4e5..f55b99d0 100644 --- a/mbsetup/m_limits.c +++ b/mbsetup/m_limits.c @@ -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; } diff --git a/mbsetup/m_magic.c b/mbsetup/m_magic.c index 5cf9d74e..9b91e5b7 100644 --- a/mbsetup/m_magic.c +++ b/mbsetup/m_magic.c @@ -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; } diff --git a/mbsetup/m_marea.c b/mbsetup/m_marea.c index 10ad43c7..e1626c60 100644 --- a/mbsetup/m_marea.c +++ b/mbsetup/m_marea.c @@ -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; } diff --git a/mbsetup/m_menu.c b/mbsetup/m_menu.c index 9de3efb9..36526170 100644 --- a/mbsetup/m_menu.c +++ b/mbsetup/m_menu.c @@ -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 { diff --git a/mbsetup/m_mgroup.c b/mbsetup/m_mgroup.c index 67712c3e..7cf89cd1 100644 --- a/mbsetup/m_mgroup.c +++ b/mbsetup/m_mgroup.c @@ -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; } diff --git a/mbsetup/m_modem.c b/mbsetup/m_modem.c index dc1e4960..44967539 100644 --- a/mbsetup/m_modem.c +++ b/mbsetup/m_modem.c @@ -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; } diff --git a/mbsetup/m_new.c b/mbsetup/m_new.c index 6ee51ae6..9a58c34f 100644 --- a/mbsetup/m_new.c +++ b/mbsetup/m_new.c @@ -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; } diff --git a/mbsetup/m_ngroup.c b/mbsetup/m_ngroup.c index 76726942..c4f633f2 100644 --- a/mbsetup/m_ngroup.c +++ b/mbsetup/m_ngroup.c @@ -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; } diff --git a/mbsetup/m_node.c b/mbsetup/m_node.c index af645aab..069979d9 100644 --- a/mbsetup/m_node.c +++ b/mbsetup/m_node.c @@ -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; } diff --git a/mbsetup/m_ol.c b/mbsetup/m_ol.c index 0894a811..b35fca4a 100644 --- a/mbsetup/m_ol.c +++ b/mbsetup/m_ol.c @@ -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; } diff --git a/mbsetup/m_protocol.c b/mbsetup/m_protocol.c index 5cc1722a..0bc70ef1 100644 --- a/mbsetup/m_protocol.c +++ b/mbsetup/m_protocol.c @@ -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; diff --git a/mbsetup/m_service.c b/mbsetup/m_service.c index f9a606e7..661b56bf 100644 --- a/mbsetup/m_service.c +++ b/mbsetup/m_service.c @@ -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; } diff --git a/mbsetup/m_task.c b/mbsetup/m_task.c index 98cbcc51..3bbba229 100644 --- a/mbsetup/m_task.c +++ b/mbsetup/m_task.c @@ -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\""); } } diff --git a/mbsetup/m_ticarea.c b/mbsetup/m_ticarea.c index 03791089..55882f59 100644 --- a/mbsetup/m_ticarea.c +++ b/mbsetup/m_ticarea.c @@ -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; } diff --git a/mbsetup/m_tty.c b/mbsetup/m_tty.c index f7190689..1d312503 100644 --- a/mbsetup/m_tty.c +++ b/mbsetup/m_tty.c @@ -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; } diff --git a/mbsetup/m_users.c b/mbsetup/m_users.c index f5738e58..f67699dc 100644 --- a/mbsetup/m_users.c +++ b/mbsetup/m_users.c @@ -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; } diff --git a/mbsetup/m_virus.c b/mbsetup/m_virus.c index 919dbf09..4410da02 100644 --- a/mbsetup/m_virus.c +++ b/mbsetup/m_virus.c @@ -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; } diff --git a/mbtask/mbtask.c b/mbtask/mbtask.c index 39127b7c..1f96c0f7 100644 --- a/mbtask/mbtask.c +++ b/mbtask/mbtask.c @@ -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);