summaryrefslogtreecommitdiff
path: root/source3/web/swat.c
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
commit8bfcdd723d0840d49f6bfb5576e631215aabfc50 (patch)
tree238042085b9152fb4ea500a69bdec35efbe98f09 /source3/web/swat.c
parent5237500c736e9dcef05421e0b9234a51cb459625 (diff)
downloadsamba-8bfcdd723d0840d49f6bfb5576e631215aabfc50.tar.gz
samba-8bfcdd723d0840d49f6bfb5576e631215aabfc50.tar.bz2
samba-8bfcdd723d0840d49f6bfb5576e631215aabfc50.zip
make swat recover from previously bad umask from xinetd
(This used to be commit 045d7e1b167efc75bb3d411b3fcc35bba58c4ef7)
Diffstat (limited to 'source3/web/swat.c')
-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);