[Dillo-dev]Re: dillo: umask(0) in dpid/main.c?
On Sun, Nov 28, 2004 at 01:03:23PM +0100, Richard Zidlicky wrote:
Hi,
Hi.
I stumbled upon this as I noticed that bookmarks and saved files are world writable. Is there still a good reason to set umask to 0 for all plugins?
Good question! Basically the umask(0) call is there because the "Linux Programming Second Edition Unleashed" recommends so as a standard for daemons ;). Now, looking into it, it makes much more sense to use 077 as a mask for dpis (i.e. only allowing the owner).
Another detail I noticed while checking file creation is this: --- dillo-0.8.3/src/cookies.c.rz 2004-11-28 12:39:33.000000000 +0100 +++ dillo-0.8.3/src/cookies.c 2004-11-28 12:40:22.000000000 +0100 @@ -100,7 +100,7 @@
if ((F_in = fopen(filename, "r+")) == NULL) { /* Create the file */ - fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR, 0777); if (fd != -1) { if (init_str) write(fd, init_str, strlen(init_str));
Well, with the proper mask set to 0077 this would not be required. If the need to add explicit permissions arise, it'd be 0077 too. Comments are welcome. -- Cheers Jorge.-
On Tue, Nov 30, 2004 at 03:10:50PM -0300, Jorge Arellano Cid wrote:
On Sun, Nov 28, 2004 at 01:03:23PM +0100, Richard Zidlicky wrote:
Is there still a good reason to set umask to 0 for all plugins?
... it makes much more sense to use 077 as a mask for dpis (i.e. only allowing the owner).
Comments are welcome.
Well, I'd vote for 077. World-writable files give me the willies. Cheers, Jeremy
On Wed, Dec 01, 2004 at 06:35:33AM +0000, Jeremy Henty wrote:
On Tue, Nov 30, 2004 at 03:10:50PM -0300, Jorge Arellano Cid wrote:
On Sun, Nov 28, 2004 at 01:03:23PM +0100, Richard Zidlicky wrote:
Is there still a good reason to set umask to 0 for all plugins?
... it makes much more sense to use 077 as a mask for dpis (i.e. only allowing the owner).
Comments are welcome.
Well, I'd vote for 077. World-writable files give me the willies.
Just changed dpid's umask to 0077. As Dillo is not designed to share its internal files among users, this seems to be the right setting. Does anyone know better about umask's effects in depth? -- Cheers Jorge.-
On Tue, Dec 21, 2004 at 10:44:15AM -0300, Jorge Arellano Cid wrote:
On Wed, Dec 01, 2004 at 06:35:33AM +0000, Jeremy Henty wrote:
Well, I'd vote for 077. World-writable files give me the willies.
Just changed dpid's umask to 0077.
Cheers!
As Dillo is not designed to share its internal files among users, this seems to be the right setting.
Agreed.
Does anyone know better about umask's effects in depth?
W. Richard Stevens, for one, so I followed up every reference to umask() in "Advanced Programming in the UNIX(R) Environment". The only effect mentioned is that it modifies the file permissions mask passed to open() or creat(). The book also recommends umask(0) for daemons, but since we don't want to allow other processes to see dillo's internals I would still say umask(0077) is right for dpid. Cheers, Jeremy
On Tue, Dec 21, 2004 at 10:44:15AM -0300, Jorge Arellano Cid wrote:
Does anyone know better about umask's effects in depth?
such as? it's only purpose in life is to be able to control the default permissions of created files. file can of course have their permissions changed at any time, so it is entirely possible to write file creation code in a way that any umask that is set will pretty much be ignored. umask() will return the current umask (if this is the first time being called, you will get the umask as set by the shell environment), so you can check and see if any particular umask is prefered by the user, or you can go ahead and ignore that and set things as you will. -brian -- "Now you know why I got the everliving hell OUT of Windows administration. Knowing it doesn't make it any easier. It's just broken-as-designed."
participants (3)
-
Brian Hechinger
-
Jeremy Henty
-
Jorge Arellano Cid