* errno.cc (errmap): Map ERROR_BAD_NET_RESP to ENOSYS.

* fhandler_disk_file.cc (fhandler_disk_file::facl): Handle ENOSYS and
	point to  the explanation.
	* ntdll.h (STATUS_NOT_IMPLEMENTED): Define.
	* path.cc (symlink_info::check): Handle the inability of NT4 to use
	FileNetworkOpenInformation on share root dirs in either direction.
	* path.h (slash_unc_prefix_p): Remove unused declaration.
	* security.cc (get_info_from_sd): Handle ENOSYS from get_file_sd.
	Explain when this happens.
This commit is contained in:
Corinna Vinschen 2010-09-24 12:41:33 +00:00
parent b375557956
commit 3498f76deb
7 changed files with 43 additions and 3 deletions

View File

@ -1,3 +1,15 @@
2010-09-24 Corinna Vinschen <corinna@vinschen.de>
* errno.cc (errmap): Map ERROR_BAD_NET_RESP to ENOSYS.
* fhandler_disk_file.cc (fhandler_disk_file::facl): Handle ENOSYS and
point to the explanation.
* ntdll.h (STATUS_NOT_IMPLEMENTED): Define.
* path.cc (symlink_info::check): Handle the inability of NT4 to use
FileNetworkOpenInformation on share root dirs in either direction.
* path.h (slash_unc_prefix_p): Remove unused declaration.
* security.cc (get_info_from_sd): Handle ENOSYS from get_file_sd.
Explain when this happens.
2010-09-23 Christopher Faylor <me+cygwin@cgf.cx>
* autoload.cc (std_dll_init): Use correct format type when displaying

View File

@ -39,6 +39,7 @@ static NO_COPY struct
X (BAD_DEVICE, ENODEV),
X (BAD_NETPATH, ENOENT),
X (BAD_NET_NAME, ENOENT),
X (BAD_NET_RESP, ENOSYS),
X (BAD_PATHNAME, ENOENT),
X (BAD_PIPE, EINVAL),
X (BAD_UNIT, ENODEV),

View File

@ -1054,9 +1054,15 @@ cant_access_acl:
set_errno(EFAULT);
else
res = getacl (get_stat_handle (), pc, nentries, aclbufp);
/* For this ENOSYS case, see security.cc:get_file_attribute(). */
if (res == -1 && get_errno () == ENOSYS)
goto cant_access_acl;
break;
case GETACLCNT:
res = getacl (get_stat_handle (), pc, 0, NULL);
/* Ditto. */
if (res == -1 && get_errno () == ENOSYS)
goto cant_access_acl;
break;
default:
set_errno (EINVAL);

View File

@ -20,6 +20,7 @@
define to avoid warnings. */
#define STATUS_INVALID_INFO_CLASS ((NTSTATUS) 0xc0000003)
#endif
#define STATUS_NOT_IMPLEMENTED ((NTSTATUS) 0xc0000002)
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xc0000004)
#define STATUS_INVALID_PARAMETER ((NTSTATUS) 0xc000000d)
#define STATUS_NO_SUCH_FILE ((NTSTATUS) 0xc000000f)

View File

@ -2421,6 +2421,23 @@ restart:
{
status = NtQueryInformationFile (h, &io, pfnoi, sizeof *pfnoi,
FileNetworkOpenInformation);
if ((status == STATUS_INVALID_PARAMETER
|| status == STATUS_NOT_IMPLEMENTED)
&& RtlEqualUnicodePathPrefix (&upath, &ro_u_uncp, FALSE))
{
/* This occurs when accessing SMB share root dirs hosted on
NT4 (STATUS_INVALID_PARAMETER), or when trying to access
SMB share root dirs from NT4 (STATUS_NOT_IMPLEMENTED). */
status = NtQueryInformationFile (h, &io, &fbi, sizeof fbi,
FileBasicInformation);
if (NT_SUCCESS (status))
{
memcpy (pfnoi, &fbi, 4 * sizeof (LARGE_INTEGER));
pfnoi->EndOfFile.QuadPart
= pfnoi->AllocationSize.QuadPart = 0;
pfnoi->FileAttributes = fbi.FileAttributes;
}
}
if (NT_SUCCESS (status))
fileattr = pfnoi->FileAttributes;
}

View File

@ -343,8 +343,6 @@ class path_conv
/* Interix symlink marker */
#define INTERIX_SYMLINK_COOKIE "IntxLNK\1"
int __stdcall slash_unc_prefix_p (const char *path) __attribute__ ((regparm(1)));
enum fe_types
{
FE_NADA = 0, /* Nothing special */

View File

@ -358,7 +358,12 @@ get_file_attribute (HANDLE handle, path_conv &pc,
get_info_from_sd (sd, attribute, uidret, gidret);
return 0;
}
else
/* ENOSYS is returned by get_file_sd if fetching the DACL from a remote
share returns STATUS_INVALID_NETWORK_RESPONSE, which in turn is
converted to ERROR_BAD_NET_RESP. This potentially occurs when trying
to fetch DACLs from a NT4 machine which is not part of the domain of
the requesting machine. */
else if (get_errno () != ENOSYS)
{
if (uidret)
*uidret = ILLEGAL_UID;