+Wed May 24 21:59:00 2000 Corinna Vinschen <corinna@vinschen.de>
+
+ * dir.cc (writable_directory): Comment out previous code,
+ return always 1 for now.
+ (mkdir): Call set_file_attribute explicitely with S_IFDIR mode bit.
+ * syscalls.cc (chown_worker): Ditto.
+ (chmod): Ditto.
+ * security.cc (get_nt_attribute): Fix error in debug output.
+ Never set FILE_DELETE_CHILD for files.
+ Construct appropriate inherit attribute according to file type.
+
2000-05-23 DJ Delorie <dj@cygnus.com>
* syscalls.cc (_cygwin_istext_for_stdio): New, for newlib
int __stdcall
writable_directory (const char *file)
{
+#if 0
char dir[strlen (file) + 1];
strcpy (dir, file);
int acc = access (usedir, W_OK);
return acc == 0;
+#else
+ return 1;
+#endif
}
/* opendir: POSIX 5.1.2.1 */
if (CreateDirectoryA (real_dir.get_win32 (), 0))
{
set_file_attribute (real_dir.has_acls (), real_dir.get_win32 (),
- (mode & 0777) & ~myself->umask);
+ S_IFDIR | ((mode & 0777) & ~myself->umask));
res = 0;
}
else
if (! attribute)
{
- syscall_printf ("file: %s uid %d, gid %d", uid, gid);
+ syscall_printf ("file: %s uid %d, gid %d", file, uid, gid);
return 0;
}
// be (un)set in each ACE.
if (! (attribute & S_IXOTH))
attribute &= ~S_ISVTX;
+ if (! (attribute & S_IFDIR))
+ attribute |= S_ISVTX;
// From here fill ACL
size_t acl_len = sizeof (ACL);
DWORD group_deny = ~group_allow & other_allow;
group_deny &= ~(STANDARD_RIGHTS_READ | FILE_READ_ATTRIBUTES | FILE_READ_EA);
+ // Construct appropriate inherit attribute
+ DWORD inherit = (attribute & S_IFDIR) ? INHERIT_ALL : DONT_INHERIT;
+
// Set deny ACE for owner
if (owner_deny
&& ! add_access_denied_ace (acl, ace_off++, owner_deny,
- owner_sid, acl_len, INHERIT_ALL))
+ owner_sid, acl_len, inherit))
return NULL;
// Set allow ACE for owner
if (! add_access_allowed_ace (acl, ace_off++, owner_allow,
- owner_sid, acl_len, INHERIT_ALL))
+ owner_sid, acl_len, inherit))
return NULL;
// Set deny ACE for group
if (group_deny
&& ! add_access_denied_ace (acl, ace_off++, group_deny,
- group_sid, acl_len, INHERIT_ALL))
+ group_sid, acl_len, inherit))
return NULL;
// Set allow ACE for group
if (! add_access_allowed_ace (acl, ace_off++, group_allow,
- group_sid, acl_len, INHERIT_ALL))
+ group_sid, acl_len, inherit))
return NULL;
// Get owner and group from current security descriptor
// Set allow ACE for everyone
if (! add_access_allowed_ace (acl, ace_off++, other_allow,
- get_world_sid (), acl_len, INHERIT_ALL))
+ get_world_sid (), acl_len, inherit))
return NULL;
// Set AclSize to computed value