summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-05-30 06:12:21 +0000
committerAndrew Tridgell <tridge@samba.org>2001-05-30 06:12:21 +0000
commit045d7e1b167efc75bb3d411b3fcc35bba58c4ef7 (patch)
treee73d1f1d0915cf43bd01b359301d1a5c6a9db6b5
parent68c0dcec3d3c17aae76ce093a601c9f452af5a0c (diff)
downloadsamba-045d7e1b167efc75bb3d411b3fcc35bba58c4ef7.tar.gz
samba-045d7e1b167efc75bb3d411b3fcc35bba58c4ef7.tar.xz
samba-045d7e1b167efc75bb3d411b3fcc35bba58c4ef7.zip
make swat recover from previously bad umask from xinetd
-rw-r--r--source/web/swat.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/web/swat.c b/source/web/swat.c
index b25641909f1..71239d56813 100644
--- a/source/web/swat.c
+++ b/source/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);