* security.h (setacl): Add parameter for writability flag.
* sec_acl.cc (setacl): Ditto. Set to true if any ACE with write permissions is created. * fhandler_disk_file.cc (fhandler_disk_file::facl): Reset FILE_ATTRIBUTE_READONLY if ACL contains an ACE with write permissions.
This commit is contained in:
parent
7ce031f211
commit
6bcc8fd7b1
|
@ -1,3 +1,11 @@
|
||||||
|
2007-01-07 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* security.h (setacl): Add parameter for writability flag.
|
||||||
|
* sec_acl.cc (setacl): Ditto. Set to true if any ACE with write
|
||||||
|
permissions is created.
|
||||||
|
* fhandler_disk_file.cc (fhandler_disk_file::facl): Reset
|
||||||
|
FILE_ATTRIBUTE_READONLY if ACL contains an ACE with write permissions.
|
||||||
|
|
||||||
2007-01-05 Corinna Vinschen <corinna@vinschen.de>
|
2007-01-05 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* include/strings.h: Don't include string.h. Only declare functions
|
* include/strings.h: Don't include string.h. Only declare functions
|
||||||
|
|
|
@ -746,7 +746,12 @@ fhandler_disk_file::facl (int cmd, int nentries, __aclent32_t *aclbufp)
|
||||||
{
|
{
|
||||||
case SETACL:
|
case SETACL:
|
||||||
if (!aclsort32 (nentries, 0, aclbufp))
|
if (!aclsort32 (nentries, 0, aclbufp))
|
||||||
res = setacl (get_io_handle (), pc, nentries, aclbufp);
|
{
|
||||||
|
bool rw = false;
|
||||||
|
res = setacl (get_io_handle (), pc, nentries, aclbufp, rw);
|
||||||
|
if (rw)
|
||||||
|
SetFileAttributes (pc, (DWORD) pc & ~FILE_ATTRIBUTE_READONLY);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case GETACL:
|
case GETACL:
|
||||||
if (!aclbufp)
|
if (!aclbufp)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* sec_acl.cc: Sun compatible ACL functions.
|
/* sec_acl.cc: Sun compatible ACL functions.
|
||||||
|
|
||||||
Copyright 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
|
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
|
||||||
|
|
||||||
Written by Corinna Vinschen <corinna@vinschen.de>
|
Written by Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
@ -44,7 +44,8 @@ searchace (__aclent32_t *aclp, int nentries, int type, __uid32_t id = ILLEGAL_UI
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
setacl (HANDLE handle, const char *file, int nentries, __aclent32_t *aclbufp)
|
setacl (HANDLE handle, const char *file, int nentries, __aclent32_t *aclbufp,
|
||||||
|
bool &writable)
|
||||||
{
|
{
|
||||||
security_descriptor sd_ret;
|
security_descriptor sd_ret;
|
||||||
|
|
||||||
|
@ -108,6 +109,9 @@ setacl (HANDLE handle, const char *file, int nentries, __aclent32_t *aclbufp)
|
||||||
__seterrno ();
|
__seterrno ();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
writable = false;
|
||||||
|
|
||||||
for (int i = 0; i < nentries; ++i)
|
for (int i = 0; i < nentries; ++i)
|
||||||
{
|
{
|
||||||
DWORD allow;
|
DWORD allow;
|
||||||
|
@ -119,7 +123,10 @@ setacl (HANDLE handle, const char *file, int nentries, __aclent32_t *aclbufp)
|
||||||
if (aclbufp[i].a_perm & S_IROTH)
|
if (aclbufp[i].a_perm & S_IROTH)
|
||||||
allow |= FILE_GENERIC_READ;
|
allow |= FILE_GENERIC_READ;
|
||||||
if (aclbufp[i].a_perm & S_IWOTH)
|
if (aclbufp[i].a_perm & S_IWOTH)
|
||||||
allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE;
|
{
|
||||||
|
allow |= STANDARD_RIGHTS_WRITE | FILE_GENERIC_WRITE;
|
||||||
|
writable = true;
|
||||||
|
}
|
||||||
if (aclbufp[i].a_perm & S_IXOTH)
|
if (aclbufp[i].a_perm & S_IXOTH)
|
||||||
allow |= FILE_GENERIC_EXECUTE;
|
allow |= FILE_GENERIC_EXECUTE;
|
||||||
if ((aclbufp[i].a_perm & (S_IWOTH | S_IXOTH)) == (S_IWOTH | S_IXOTH))
|
if ((aclbufp[i].a_perm & (S_IWOTH | S_IXOTH)) == (S_IWOTH | S_IXOTH))
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* security.h: security declarations
|
/* security.h: security declarations
|
||||||
|
|
||||||
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.
|
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -360,7 +360,7 @@ struct __acl32;
|
||||||
extern "C" int aclsort32 (int, int, __acl32 *);
|
extern "C" int aclsort32 (int, int, __acl32 *);
|
||||||
extern "C" int acl32 (const char *, int, int, __acl32 *);
|
extern "C" int acl32 (const char *, int, int, __acl32 *);
|
||||||
int getacl (HANDLE, const char *, DWORD, int, __acl32 *);
|
int getacl (HANDLE, const char *, DWORD, int, __acl32 *);
|
||||||
int setacl (HANDLE, const char *, int, __acl32 *);
|
int setacl (HANDLE, const char *, int, __acl32 *, bool &);
|
||||||
|
|
||||||
struct _UNICODE_STRING;
|
struct _UNICODE_STRING;
|
||||||
void __stdcall str2buf2uni (_UNICODE_STRING &, WCHAR *, const char *) __attribute__ ((regparm (3)));
|
void __stdcall str2buf2uni (_UNICODE_STRING &, WCHAR *, const char *) __attribute__ ((regparm (3)));
|
||||||
|
|
Loading…
Reference in New Issue