summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/web/swat.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/web/swat.c b/source3/web/swat.c
index b25641909f..71239d5681 100644
--- a/source3/web/swat.c
+++ b/source3/web/swat.c
@@ -344,8 +344,7 @@ static void write_config(FILE *f, BOOL show_defaults, char *(*dos_to_ext)(char *
static int save_reload(int snum)
{
FILE *f;
-
- umask(022);
+ struct stat st;
f = sys_fopen(servicesf,"w");
if (!f) {
@@ -353,6 +352,12 @@ static int save_reload(int snum)
return 0;
}
+ /* just in case they have used the buggy xinetd to create the file */
+ if (fstat(fileno(f), &st) == 0 &&
+ (st.st_mode & S_IWOTH)) {
+ fchmod(fileno(f), S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
+ }
+
write_config(f, False, _dos_to_unix);
if (snum)
lp_dump_one(f, False, snum, _dos_to_unix);
@@ -986,6 +991,7 @@ static void printers_page(void)
char *page;
fault_setup(NULL);
+ umask(S_IWGRP | S_IWOTH);
#if defined(HAVE_SET_AUTH_PARAMETERS)
set_auth_parameters(argc, argv);