On Wed, Feb 24, 2010 at 09:56:47AM -0500, Simo Sorce wrote:
On Wed, 24 Feb 2010 12:05:18 +0100 Sumit Bose sbose@redhat.com wrote:
- old_umask = umask(0000);
- ret = mkdir(dirname, 01777);
- umask(old_umask);
- if (ret != EOK) {
DEBUG(1, ("mkdir [%s] failed: [%d][%s].\n", dirname, errno,
strerror(errno)));
return errno;
- }
NACK. We do not want to give every user on the system freedom to write what they want in these directories.
All parents need to be root.root 0755
If the admins wants it differently they will have to pre-create the parent directories themselves.
Simo.
New version attached.
Additionally to the issues mentions above the templates are only parsed once and the expanded path is checked for suspicious patterns like '/../'. If a private directory is created it is chown'd immediately after its creation.
There are two questions where I do not know a good answer:
- The parent directories are always created with 0755 permissions and the owner is root. Should we handle the case where the first existing directory does not belong to root, e.g. if we have /home/u1/a/b/c/ccache_dir/ccfile and a, b and c have to be created?
- The sequence '%P' is expanded to the client's PID. I think the PID does not qualify to be unique for a user and consequently a ccache directory with only this sequence and no other user specific sequences like '%u' is created as public directory. Do you agree?
bye, Sumit