diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2000-04-13 10:53:24 +0400 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2000-04-13 10:53:24 +0400 |
commit | b53881fd273aa1f32fdfc944985a5995656dccbd (patch) | |
tree | 601007dd348f1750d6d437764a2937dfb05697bd /winsup/cygwin/security.cc | |
parent | a4bf66dd75a60aa4de00f7dee5dc3e085dfd5e11 (diff) |
* cygwin.din: Add symbol for `lacl'.
* security.cc (ReadSD): Add debug output.
(acl_worker): New static function.
(acl): Call acl_worker now.
(lacl): New function.
(facl): Call acl_worker now.
* include/cygwin/acl.h: Add prototype for `lacl'.
Diffstat (limited to 'winsup/cygwin/security.cc')
-rw-r--r-- | winsup/cygwin/security.cc | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/winsup/cygwin/security.cc b/winsup/cygwin/security.cc index 031400905..73e67e468 100644 --- a/winsup/cygwin/security.cc +++ b/winsup/cygwin/security.cc @@ -396,6 +396,7 @@ ReadSD(const char *file, PSECURITY_DESCRIPTOR sdBuf, LPDWORD sdBufSize) } /* Open file for read */ + debug_printf("file = %s", file); HANDLE hFile = CreateFile (file, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, &sec_none_nih, OPEN_EXISTING, @@ -1518,11 +1519,12 @@ acl_access (const char *path, int flags) return -1; } -extern "C" +static int -acl (const char *path, int cmd, int nentries, aclent_t *aclbufp) +acl_worker (const char *path, int cmd, int nentries, aclent_t *aclbufp, + int nofollow) { - path_conv real_path (path); + path_conv real_path (path, nofollow ? SYMLINK_NOFOLLOW : SYMLINK_FOLLOW, 1); if (real_path.error) { set_errno (real_path.error); @@ -1542,7 +1544,8 @@ acl (const char *path, int cmd, int nentries, aclent_t *aclbufp) case GETACL: if (nentries < 1) set_errno (EINVAL); - else if (! stat (path, &st)) + else if ((nofollow && ! lstat (path, &st)) + || (!nofollow && ! stat (path, &st))) { aclent_t lacl[4]; if (nentries > 0) @@ -1618,6 +1621,20 @@ acl (const char *path, int cmd, int nentries, aclent_t *aclbufp) extern "C" int +acl (const char *path, int cmd, int nentries, aclent_t *aclbufp) +{ + return acl_worker (path, cmd, nentries, aclbufp, 0); +} + +extern "C" +int +lacl (const char *path, int cmd, int nentries, aclent_t *aclbufp) +{ + return acl_worker (path, cmd, nentries, aclbufp, 1); +} + +extern "C" +int facl (int fd, int cmd, int nentries, aclent_t *aclbufp) { if (dtable.not_open (fd)) @@ -1634,7 +1651,7 @@ facl (int fd, int cmd, int nentries, aclent_t *aclbufp) return -1; } syscall_printf ("facl (%d): calling acl (%s)", fd, path); - return acl (path, cmd, nentries, aclbufp); + return acl_worker (path, cmd, nentries, aclbufp, 0); } extern "C" |