if (!Config.chroot_dir) {
leave_suid();
+ setUmask(Config.umask);
_db_init(Config.Log.log, Config.debugOptions);
enter_suid();
}
A list of other DNS names your cache has.
DOC_END
+NAME: umask
+TYPE: int
+LOC: Config.umask
+DEFAULT: 027
+DOC_START
+ Minimum umask which should be enforced while the proxy
+ is running, in addition to the umask set at startup.
+
+ For a traditional octal representation of umasks, start
+ your value with 0.
+DOC_END
+
COMMENT_START
OPTIONS FOR THE CACHE REGISTRATION SERVICE
-----------------------------------------------------------------------------
errorClean();
enter_suid(); /* root to read config file */
parseConfigFile(ConfigFile, manager);
+ setUmask(Config.umask);
Mem::Report();
setEffectiveUser();
_db_init(Config.Log.log, Config.debugOptions);
main(int argc, char **argv)
#endif
{
- mode_t oldmask;
#ifdef _SQUID_WIN32_
int WIN32_init_err;
return parse_err;
}
+ setUmask(Config.umask);
if (-1 == opt_send_signal)
if (checkRunningPid())
exit(1);
SQUIDCEXTERN int isPowTen(int);
SQUIDCEXTERN void parseEtcHosts(void);
SQUIDCEXTERN int getMyPort(void);
+SQUIDCEXTERN void setUmask(mode_t mask);
SQUIDCEXTERN char *strwordtok(char *buf, char **t);
SQUIDCEXTERN void strwordquote(MemBuf * mb, const char *str);
#endif
char *accept_filter;
+ int umask;
};
struct _SquidConfig2
return 0; /* NOT REACHED */
}
+/*
+ * Set the umask to at least the given mask. This is in addition
+ * to the umask set at startup
+ */
+void
+setUmask(mode_t mask)
+{
+ // No way to get the current umask value without setting it.
+ static const mode_t orig_umask = umask(mask); // once, to get
+ umask(mask | orig_umask); // always, to set
+}
/*
* Inverse of strwordtok. Quotes a word if needed