diff options
author | Andrew Tridgell <tridge@samba.org> | 2001-05-30 06:12:21 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2001-05-30 06:12:21 +0000 |
commit | 8bfcdd723d0840d49f6bfb5576e631215aabfc50 (patch) | |
tree | 238042085b9152fb4ea500a69bdec35efbe98f09 | |
parent | 5237500c736e9dcef05421e0b9234a51cb459625 (diff) | |
download | samba-8bfcdd723d0840d49f6bfb5576e631215aabfc50.tar.gz samba-8bfcdd723d0840d49f6bfb5576e631215aabfc50.tar.xz samba-8bfcdd723d0840d49f6bfb5576e631215aabfc50.zip |
make swat recover from previously bad umask from xinetd
(This used to be commit 045d7e1b167efc75bb3d411b3fcc35bba58c4ef7)
-rw-r--r-- | source3/web/swat.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source3/web/swat.c b/source3/web/swat.c index b25641909f1..71239d56813 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); |