From dfaee3d49030bd6ddaa02db5768f0af3196b4dc4 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Thu, 7 Feb 2002 21:53:04 +0000 Subject: [PATCH] MBSE BBS file permissions auto update added --- ChangeLog | 3 +++ mbsebbs/misc.c | 3 ++- mbsebbs/user.c | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0cb80f0c..ec1a7141 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4269,6 +4269,8 @@ v0.33.19 26-Oct-2001 Added support for xinetd configuration. Changed distribution test for Mandrake. Changed to recognize the e-smith server based on RedHat. + If system runs xinetd instead of inetd, the configuration for + xinetd is updated with info for mbsebbs. installinit.sh: Changed to recognize the e-smith server based on RedHat. @@ -4400,6 +4402,7 @@ v0.33.19 26-Oct-2001 with execute. During startup the username is tried from the environment variables LOGNAME and USER. + Added some automatic file permission corrections. mbnewusr: New program, run by user bbs. This is only to register a new diff --git a/mbsebbs/misc.c b/mbsebbs/misc.c index 701b1bca..044b62a9 100644 --- a/mbsebbs/misc.c +++ b/mbsebbs/misc.c @@ -68,6 +68,7 @@ int ChkFiles() sDataFile = calloc(PATH_MAX, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char)); sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT")); + chmod(sDataFile, 0660); /* * Check if users.data exists, if not create a new one. @@ -180,8 +181,8 @@ void SaveLastCallers() Syslog('+', "Created new lastcall.data"); } fclose(pGLC); - chmod(sFileName, 0660); } + chmod(sFileName, 0660); if ((pGLC = fopen(sFileName,"a+")) == NULL) { WriteError("$Can't open %s", sFileName); diff --git a/mbsebbs/user.c b/mbsebbs/user.c index df9585ab..0a5abfe7 100644 --- a/mbsebbs/user.c +++ b/mbsebbs/user.c @@ -75,7 +75,11 @@ void GetLastUser(void) sDataFile = calloc(PATH_MAX, sizeof(char)); sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT")); - + /* + * Fix security in case it is wrong. + */ + chmod(sDataFile, 0660); + if((pCallerLog = fopen(sDataFile, "r+")) == NULL) WriteError("GetLastUser: Can't open file: %s", sDataFile); else {