From 7f0390149d84d79a3b7bfb102f0fbbdcf2f14f22 Mon Sep 17 00:00:00 2001 From: Rob Swindell <rob@synchro.net> Date: Sat, 29 May 2021 20:08:55 -0700 Subject: [PATCH] Keep the same area file (areas.bbs) mode flags (permissions) When executing area manager requests that alter the area file, the temp area file created (with mkstemp) had mode 0600 (owner read/write only). The sysop very possibly had different permission flags they want to keep for their area file, so copy the mode flags from the original area file to the temp/new area file. --- src/sbbs3/sbbsecho.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sbbs3/sbbsecho.c b/src/sbbs3/sbbsecho.c index 6897ab2e36..5e8b55661b 100644 --- a/src/sbbs3/sbbsecho.c +++ b/src/sbbs3/sbbsecho.c @@ -1525,6 +1525,7 @@ void alter_areas(str_list_t add_area, str_list_t del_area, fidoaddr_t addr, cons unsigned u; size_t add_count, added = 0; size_t del_count, deleted = 0; + struct stat st = {0}; add_count = strListCount(add_area); del_count = strListCount(del_area); @@ -1541,6 +1542,8 @@ void alter_areas(str_list_t add_area, str_list_t del_area, fidoaddr_t addr, cons fclose(nmfile); return; } + if(stat(cfg.areafile, &st) == 0) + fchmod(file, st.st_mode); if((afileout=fdopen(file, "w+"))==NULL) { lprintf(LOG_ERR,"ERROR %u (%s) line %d fdopening %s",errno,strerror(errno),__LINE__,outpath); fclose(nmfile); -- GitLab