r22732: - Testing of libsmbclient against Vista revealed what is likely a bug in
authorDerrell Lipman <derrell@samba.org>
Mon, 7 May 2007 03:07:39 +0000 (03:07 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:21:52 +0000 (12:21 -0500)
  Vista.  Vista provides a plethora of kludges to simulate older versions of
  Windows.  The kludges are in the form of shortcuts (or more likely symbolic
  links, but I don't know enough about Vista to determine that definitively)
  and in most cases, attempts to access them get back an "access denied"
  error.  On one particular folder, however, "<share>/Users/All Users", it
  returns an unknown (to ethereal and the Samba3 code) NT status code:
  0x8000002d.  Although this code does not have a high byte of 0xc0 indicating
  that it is an error, it appears to be an alternate form of "access denied".

  Without this patch, libsmbclient times out on an attempt to enumerate that
  folder rather than returning an error to the caller.  This patch corrects
  that problem.
(This used to be commit cc0cd3a12f76b8cd711e3165d4cfe920552f256d)

source3/include/nterr.h
source3/libsmb/clierror.c
source3/libsmb/clitrans.c

index 913ea5799e3bfd0f2b33a104d81c9091bc1983a2..e14f341de13f1723fa2738504a16c44c1c42b73d 100644 (file)
@@ -30,6 +30,9 @@
 #define STATUS_NO_MORE_FILES              NT_STATUS(0x80000006)
 #define NT_STATUS_NO_MORE_ENTRIES         NT_STATUS(0x8000001a)
 
+/* Vista Status codes. */
+#define NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT         NT_STATUS(0x8000002d)
+
 #define STATUS_MORE_ENTRIES               NT_STATUS(0x0105)
 #define STATUS_SOME_UNMAPPED              NT_STATUS(0x0107)
 #define ERROR_INVALID_PARAMETER                  NT_STATUS(0x0057)
index 4b222c901553e3213ca10a16f53f7e3d360a5dc9..d98f42821790c151df0c0e91c67c76ef423003d1 100644 (file)
@@ -385,6 +385,15 @@ int cli_errno(struct cli_state *cli)
                return cli_errno_from_nt(status);
         }
 
+        /*
+         * Yuck!  A special case for this Vista error.  Since its high-order
+         * byte isn't 0xc0, it doesn't match cli_is_nt_error() above.
+         */
+        status = cli_nt_error(cli);
+        if (NT_STATUS_V(status) == NT_STATUS_V(NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT)) {
+            return EACCES;
+        }
+
        /* for other cases */
        return EINVAL;
 }
index 3e3ebc1ce1e97ffd5b1630bdf3ddc5d149124295..d7492b31c351a3da13aee30070d6d3d67a939973 100644 (file)
@@ -196,11 +196,18 @@ BOOL cli_receive_trans(struct cli_state *cli,int trans,
         * returned when a trans2 findfirst/next finishes.
         * When setting up an encrypted transport we can also
         * see NT_STATUS_MORE_PROCESSING_REQUIRED here.
+         *
+         * Vista returns NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT if the folder
+         * "<share>/Users/All Users" is enumerated.  This is a special pseudo
+         * folder, and the response does not have parameters (nor a parameter
+         * length).
         */
        status = cli_nt_error(cli);
        
        if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
-               if (NT_STATUS_IS_ERR(status) || NT_STATUS_EQUAL(status,STATUS_NO_MORE_FILES)) {
+               if (NT_STATUS_IS_ERR(status) ||
+                    NT_STATUS_EQUAL(status,STATUS_NO_MORE_FILES) ||
+                    NT_STATUS_EQUAL(status,NT_STATUS_INACCESSIBLE_SYSTEM_SHORTCUT)) {
                        goto out;
                }
        }