Setting EA's to zero length deletes them.
authorJeremy Allison <jra@samba.org>
Mon, 29 Mar 2004 23:39:13 +0000 (23:39 +0000)
committerJeremy Allison <jra@samba.org>
Mon, 29 Mar 2004 23:39:13 +0000 (23:39 +0000)
Jeremy.

source/smbd/trans2.c
source/torture/torture.c

index 2f164dafa284e145920c68a6516ebdb8c40ab85d..9f5ef09454ad8dbfd324940b4c68498e20c96544 100644 (file)
@@ -49,6 +49,16 @@ SMB_BIG_UINT get_allocation_size(files_struct *fsp, SMB_STRUCT_STAT *sbuf)
        return ret;
 }
 
+/****************************************************************************
+ Utility functions for dealing with extended attributes.
+****************************************************************************/
+
+struct ea_list {
+       struct ea_list *next, *prev;
+       struct ea_struct ea;
+};
+
+static 
 /****************************************************************************
   Send the required number of replies back.
   We assume all fields other than the data fields are
index 97bca82d9bb06def369a7abf01a9582b087a3605..ead9d69cf159480edd9f432bfe02f77c8cb7c9c6 100644 (file)
@@ -4360,7 +4360,6 @@ static BOOL run_eatest(int dummy)
                }
        }
        
-                                                                                              
        if (!cli_get_ea_list_path(cli, fname, mem_ctx, &num_eas, &ea_list)) {
                printf("ea_get list failed - %s\n", cli_errstr(cli));
                correct = False;
@@ -4372,6 +4371,34 @@ static BOOL run_eatest(int dummy)
                dump_data(0, ea_list[i].value.data, ea_list[i].value.length);
        }
 
+       /* Setting EA's to zero length deletes them. Test this */
+       printf("Now deleting all EA's....\n");
+
+       for (i = 0; i < 20; i++) {
+               fstring ea_name;
+               slprintf(ea_name, sizeof(ea_name), "EA_%d", i);
+               if (!cli_set_ea_path(cli, fname, ea_name, "", 0)) {
+                       printf("ea_set of name %s failed - %s\n", ea_name, cli_errstr(cli));
+                       return False;
+               }
+       }
+       
+       if (!cli_get_ea_list_path(cli, fname, mem_ctx, &num_eas, &ea_list)) {
+               printf("ea_get list failed - %s\n", cli_errstr(cli));
+               correct = False;
+       }
+
+       printf("num_eas = %d\n", num_eas);
+       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);
+       }
+
+       if (num_eas != 0) {
+               printf("deleting EA's failed.\n");
+               correct = False;
+       }
+
        talloc_destroy(mem_ctx);
        if (!torture_close_connection(cli)) {
                correct = False;