Commit 7f039014 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

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.
parent 0f262d8a
Pipeline #2325 failed with stage
in 7 minutes and 51 seconds
...@@ -1525,6 +1525,7 @@ void alter_areas(str_list_t add_area, str_list_t del_area, fidoaddr_t addr, cons ...@@ -1525,6 +1525,7 @@ void alter_areas(str_list_t add_area, str_list_t del_area, fidoaddr_t addr, cons
unsigned u; unsigned u;
size_t add_count, added = 0; size_t add_count, added = 0;
size_t del_count, deleted = 0; size_t del_count, deleted = 0;
struct stat st = {0};
add_count = strListCount(add_area); add_count = strListCount(add_area);
del_count = strListCount(del_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 ...@@ -1541,6 +1542,8 @@ void alter_areas(str_list_t add_area, str_list_t del_area, fidoaddr_t addr, cons
fclose(nmfile); fclose(nmfile);
return; return;
} }
if(stat(cfg.areafile, &st) == 0)
fchmod(file, st.st_mode);
if((afileout=fdopen(file, "w+"))==NULL) { if((afileout=fdopen(file, "w+"))==NULL) {
lprintf(LOG_ERR,"ERROR %u (%s) line %d fdopening %s",errno,strerror(errno),__LINE__,outpath); lprintf(LOG_ERR,"ERROR %u (%s) line %d fdopening %s",errno,strerror(errno),__LINE__,outpath);
fclose(nmfile); fclose(nmfile);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment