Ensure we cope correctly with ea length of zero. Detect torture fail correctly.
authorJeremy Allison <jra@samba.org>
Tue, 30 Mar 2004 18:38:21 +0000 (18:38 +0000)
committerJeremy Allison <jra@samba.org>
Tue, 30 Mar 2004 18:38:21 +0000 (18:38 +0000)
Jeremy.
(This used to be commit 43db249fb814cef99afecd22c20a824d2519faf9)

source3/libsmb/clifile.c
source3/torture/torture.c

index 52164dc0b4748ea8cbff3d965ad80922cc232f01..bf7923ec78869a2ccdac29b82bc06b552d91b4af 100644 (file)
@@ -1297,6 +1297,12 @@ static BOOL cli_get_ea_list(struct cli_state *cli,
                goto out;
        }
 
+       if (ea_size == 0) {
+               /* No EA's present. */
+               ret = True;
+               goto out;
+       }
+
        p = rdata + 4;
        ea_size -= 4;
 
index ead9d69cf159480edd9f432bfe02f77c8cb7c9c6..17a2ee00a8db0f874e902efbad54c0581c82194d 100644 (file)
@@ -4366,6 +4366,12 @@ static BOOL run_eatest(int dummy)
        }
 
        printf("num_eas = %d\n", num_eas);
+
+       if (num_eas != 20) {
+               printf("Should be 20 EA's stored... failing.\n");
+               correct = False;
+       }
+
        for (i = 0; i < num_eas; i++) {
                printf("%d: ea_name = %s. Val = ", i, ea_list[i].name);
                dump_data(0, ea_list[i].value.data, ea_list[i].value.length);
@@ -4399,6 +4405,12 @@ static BOOL run_eatest(int dummy)
                correct = False;
        }
 
+       /* Try and delete a non existant EA. */
+       if (!cli_set_ea_path(cli, fname, "foo", "", 0)) {
+               printf("deleting non-existant EA 'foo' should succeed. %s\n", cli_errstr(cli));
+               correct = False;
+       }
+
        talloc_destroy(mem_ctx);
        if (!torture_close_connection(cli)) {
                correct = False;