* fhandler.cc (fhandler_base::open): Open native symlinks with

FILE_OPEN_REPARSE_POINT flag.  Fix typo in comment.
This commit is contained in:
Corinna Vinschen 2007-10-18 12:40:27 +00:00
parent 5b69737250
commit f3257492c4
2 changed files with 42 additions and 29 deletions

View File

@ -1,3 +1,8 @@
2007-10-18 Corinna Vinschen <corinna@vinschen.de>
* fhandler.cc (fhandler_base::open): Open native symlinks with
FILE_OPEN_REPARSE_POINT flag. Fix typo in comment.
2007-10-18 Corinna Vinschen <corinna@vinschen.de> 2007-10-18 Corinna Vinschen <corinna@vinschen.de>
* include/sys/param.h (MAXPATHLEN): Define as PATH_MAX. * include/sys/param.h (MAXPATHLEN): Define as PATH_MAX.

View File

@ -542,7 +542,14 @@ fhandler_base::open (int flags, mode_t mode)
if ((flags & O_EXCL) && (flags & O_CREAT)) if ((flags & O_EXCL) && (flags & O_CREAT))
create_disposition = FILE_CREATE; create_disposition = FILE_CREATE;
if (flags & O_CREAT && get_device () == FH_FS) if (get_device () == FH_FS)
{
/* Add the reparse point flag to native symlinks, otherwise we open the
target, not the symlink. This would break lstat. */
if (pc.is_rep_symlink ())
create_options |= FILE_OPEN_REPARSE_POINT;
if (flags & O_CREAT)
{ {
file_attributes = FILE_ATTRIBUTE_NORMAL; file_attributes = FILE_ATTRIBUTE_NORMAL;
/* If mode has no write bits set, we set the R/O attribute. */ /* If mode has no write bits set, we set the R/O attribute. */
@ -564,7 +571,7 @@ fhandler_base::open (int flags, mode_t mode)
but the actual owner on the Samba share is the SID of the Unix but the actual owner on the Samba share is the SID of the Unix
account. There's no transparent mapping between these accounts. account. There's no transparent mapping between these accounts.
And Samba has a strange behaviour when creating a file. Apparently And Samba has a strange behaviour when creating a file. Apparently
it *first*( creates the file, *then* it looks if the security it *first* creates the file, *then* it looks if the security
descriptor matches. The result is that the file gets created, but descriptor matches. The result is that the file gets created, but
then NtCreateFile doesn't return a handle to the file and fails then NtCreateFile doesn't return a handle to the file and fails
with STATUS_ACCESS_DENIED. Go figure! */ with STATUS_ACCESS_DENIED. Go figure! */
@ -576,6 +583,7 @@ fhandler_base::open (int flags, mode_t mode)
/* The file attributes are needed for later use in, e.g. fchmod. */ /* The file attributes are needed for later use in, e.g. fchmod. */
pc.file_attributes (file_attributes); pc.file_attributes (file_attributes);
} }
}
status = NtCreateFile (&x, access, &attr, &io, NULL, file_attributes, shared, status = NtCreateFile (&x, access, &attr, &io, NULL, file_attributes, shared,
create_disposition, create_options, NULL, 0); create_disposition, create_options, NULL, 0);