r20508: Confirm a special case in samba3 reply_getatr that getatr("") always returns
authorVolker Lendecke <vlendec@samba.org>
Wed, 3 Jan 2007 12:02:44 +0000 (12:02 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 19:36:02 +0000 (14:36 -0500)
HIDDEN.

Volker
(This used to be commit 83a20912061c663ff422b038b41f01a9c7583afe)

source4/torture/raw/samba3misc.c

index 0b196b158799e1495e5cdbb8dc1d84576df7bc0e..490b0c8cde1d85bbfa930e2b77fd10c016ce0199 100644 (file)
@@ -340,6 +340,11 @@ BOOL torture_samba3_badpath(struct torture_context *torture)
        status = smbcli_chkpath(cli_dos->tree, "<\\bla");
        CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRbadpath));
 
+       status = smbcli_chkpath(cli_nt->tree, "");
+       CHECK_STATUS(status, NT_STATUS_OK);
+       status = smbcli_chkpath(cli_dos->tree, "");
+       CHECK_STATUS(status, NT_STATUS_OK);
+
        /*
         * .... And the same gang against getatr. Note that the DOS error codes
         * differ....
@@ -380,6 +385,35 @@ BOOL torture_samba3_badpath(struct torture_context *torture)
        status = smbcli_getatr(cli_dos->tree, "<\\bla", NULL, NULL, NULL);
        CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname));
 
+       {
+               uint16_t attr;
+
+               status = smbcli_getatr(cli_nt->tree, "", &attr, NULL, NULL);
+               CHECK_STATUS(status, NT_STATUS_OK);
+               if (attr != (FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_DIRECTORY)) {
+                       d_printf("(%s) getatr(\"\") returned 0x%x, expected "
+                                "0x%x\n", __location__, attr,
+                                FILE_ATTRIBUTE_HIDDEN
+                                |FILE_ATTRIBUTE_DIRECTORY);
+                       ret = False;
+               }
+
+               status = smbcli_setatr(cli_nt->tree, "",
+                                      FILE_ATTRIBUTE_DIRECTORY, -1);
+               CHECK_STATUS(status, NT_STATUS_ACCESS_DENIED);
+               status = smbcli_setatr(cli_dos->tree, "",
+                                      FILE_ATTRIBUTE_DIRECTORY, -1);
+               CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRnoaccess));
+
+               status = smbcli_setatr(cli_nt->tree, ".",
+                                      FILE_ATTRIBUTE_DIRECTORY, -1);
+               CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_INVALID);
+               status = smbcli_setatr(cli_dos->tree, ".",
+                                      FILE_ATTRIBUTE_DIRECTORY, -1);
+               CHECK_STATUS(status, NT_STATUS_DOS(ERRDOS, ERRinvalidname));
+       }
+               
+
        /* Try the same set with openX. */
 
        status = raw_smbcli_open(cli_nt->tree, "..", O_RDONLY, DENY_NONE, NULL);