Merge branch 'master' of ssh://git.samba.org/data/git/samba
authorAndrew Tridgell <tridge@samba.org>
Tue, 23 Sep 2008 18:15:46 +0000 (11:15 -0700)
committerAndrew Tridgell <tridge@samba.org>
Tue, 23 Sep 2008 18:15:46 +0000 (11:15 -0700)
source4/libcli/clideltree.c
source4/libcli/raw/interfaces.h
source4/libcli/raw/rawsetfileinfo.c
source4/libcli/smb2/util.c
source4/ntvfs/ntvfs_generic.c
source4/ntvfs/posix/pvfs_open.c
source4/ntvfs/posix/pvfs_xattr.c
source4/torture/gentest.c

index 2c306e501e23f8cba90f071f5cd6e57236066dcd..d59a03f194c8e05d2fed5c70005e7e7dd2dac988 100644 (file)
@@ -84,6 +84,7 @@ int smbcli_deltree(struct smbcli_tree *tree, const char *dname)
 {
        char *mask;
        struct delete_state dstate;
+       NTSTATUS status;
 
        dstate.tree = tree;
        dstate.total_deleted = 0;
@@ -98,6 +99,13 @@ int smbcli_deltree(struct smbcli_tree *tree, const char *dname)
            NT_STATUS_EQUAL(smbcli_nt_error(tree), NT_STATUS_NO_SUCH_FILE)) {
                return 0;
        }
+       if (NT_STATUS_EQUAL(status, NT_STATUS_CANNOT_DELETE)) {
+               /* it could be read-only */
+               status = smbcli_setatr(tree, dname, FILE_ATTRIBUTE_NORMAL, 0);
+               if (NT_STATUS_IS_OK(smbcli_unlink(tree, dname))) {
+                       return 1;
+               }
+       }
 
        asprintf(&mask, "%s\\*", dname);
        smbcli_unlink(dstate.tree, mask);
@@ -105,7 +113,14 @@ int smbcli_deltree(struct smbcli_tree *tree, const char *dname)
                 FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_SYSTEM, 
                 delete_fn, &dstate);
        free(mask);
-       if (NT_STATUS_IS_ERR(smbcli_rmdir(dstate.tree, dname))) {
+
+       status = smbcli_rmdir(dstate.tree, dname);
+       if (NT_STATUS_EQUAL(status, NT_STATUS_CANNOT_DELETE)) {
+               /* it could be read-only */
+               status = smbcli_setatr(dstate.tree, dname, FILE_ATTRIBUTE_NORMAL, 0);
+               status = smbcli_rmdir(dstate.tree, dname);
+       }
+       if (NT_STATUS_IS_ERR(status)) {
                DEBUG(2,("Failed to delete %s - %s\n", 
                         dname, smbcli_errstr(dstate.tree)));
                return -1;
index 537041c13762833287f946748fe08ea8e0386247..20ed4414350487a0c7a009a36de55de3a8ece8d6 100644 (file)
@@ -1112,6 +1112,15 @@ union smb_setfileinfo {
                        struct security_descriptor *sd;
                } in;
        } set_secdesc;
+
+       /* RAW_SFILEINFO_FULL_EA_INFORMATION */
+       struct {
+               enum smb_setfileinfo_level level;
+               struct {
+                       union smb_handle_or_path file;
+                       struct smb_ea_list eas;
+               } in;
+       } full_ea_information;
 };
 
 
index 5a4706778a4a0e2b586a634cda87c231f54d0504..f7dfb933f190760f27ee3fe445c77ffc2cc75aaf 100644 (file)
@@ -37,7 +37,7 @@ bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
 
 #define NEED_BLOB(n) do { \
          *blob = data_blob_talloc(mem_ctx, NULL, n); \
-         if (blob->data == NULL) return false; \
+         if (blob->data == NULL && n != 0) return false; \
         } while (0)
 
        switch (level) {
@@ -109,6 +109,16 @@ bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx,
                return true;
        }
 
+       case RAW_SFILEINFO_FULL_EA_INFORMATION:
+               printf("num_eas=%d\n", parms->full_ea_information.in.eas.num_eas);
+               NEED_BLOB(ea_list_size_chained(
+                                 parms->full_ea_information.in.eas.num_eas,
+                                 parms->full_ea_information.in.eas.eas, 4));
+               ea_put_list_chained(blob->data, 
+                                   parms->full_ea_information.in.eas.num_eas,
+                                   parms->full_ea_information.in.eas.eas, 4);
+               return true;
+
                /* Unhandled levels */
        case RAW_SFILEINFO_PIPE_INFORMATION:
        case RAW_SFILEINFO_VALID_DATA_INFORMATION:
index 311cea94a085a1494e49c8b7dd67d6bedf032de8..b149b3d6cec3a19a5a65ac228352ea95da1307d8 100644 (file)
@@ -197,6 +197,12 @@ int smb2_deltree(struct smb2_tree *tree, const char *dname)
        smb2_util_close(tree, create_parm.out.file.handle);
 
        status = smb2_util_rmdir(tree, dname);
+       if (NT_STATUS_EQUAL(status, NT_STATUS_CANNOT_DELETE)) {
+               /* it could be read-only */
+               status = smb2_util_setatr(tree, dname, FILE_ATTRIBUTE_NORMAL);
+               status = smb2_util_rmdir(tree, dname);
+       }
+
        if (NT_STATUS_IS_ERR(status)) {
                DEBUG(2,("Failed to delete %s - %s\n", 
                         dname, nt_errstr(status)));
index c34bb7125e6834dd8cc1f00c3fd6b3207fa4cc56..554d5c5aef001573a50ccb13580a7c8984d8f700 100644 (file)
@@ -533,6 +533,8 @@ NTSTATUS ntvfs_map_open(struct ntvfs_module_context *ntvfs,
 
                /* we need to check these bits before we check the private mask */
                if (io2->generic.in.create_options & SMB2_CREATE_OPTIONS_NOT_SUPPORTED_MASK) {
+                       DEBUG(2,(__location__ " create_options 0x%x not supported\n",
+                                io2->generic.in.create_options));
                        status = NT_STATUS_NOT_SUPPORTED;
                        break;
                }
index c127885a68f3cae149cb6321d19cdf0076c4206c..8dbc6742419602c00044629dd74c10461679da33 100644 (file)
@@ -1216,6 +1216,8 @@ NTSTATUS pvfs_open(struct ntvfs_module_context *ntvfs,
        create_options &= ~create_options_must_ignore_mask;
 
        if (create_options & NTCREATEX_OPTIONS_NOT_SUPPORTED_MASK) {
+               DEBUG(2,(__location__ " create_options 0x%x not supported\n", 
+                        create_options));
                return NT_STATUS_NOT_SUPPORTED;
        }
 
index 3cbbcbe92f638a721c5c112f6ea23bf7183fb14c..7a2945cd05499e8343fc2bf8e0d5d7f2fbf81557 100644 (file)
@@ -50,7 +50,7 @@ static NTSTATUS pull_xattr_blob(struct pvfs_state *pvfs,
        if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)||
            NT_STATUS_EQUAL(status, NT_STATUS_NOT_IMPLEMENTED)||
            NT_STATUS_EQUAL(status, NT_STATUS_INVALID_SYSTEM_SERVICE)) {
-               DEBUG(5,("pvfs_xattr: xattr not supported in filesystem: %s\n", nt_errstr(status)));
+               DEBUG(2,("pvfs_xattr: xattr not supported in filesystem: %s\n", nt_errstr(status)));
                pvfs->flags &= ~PVFS_FLAG_XATTR_ENABLE;
                status = NT_STATUS_NOT_FOUND;
        }
index af5a95e7517f8f8d0416f5ebce8b4deaf2a9555a..176fc035e7674510447c2ef2a38cecb2a537af37 100644 (file)
@@ -2166,6 +2166,9 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info)
        case RAW_SFILEINFO_MODE_INFORMATION:
                info->mode_information.in.mode = gen_bits_mask(0xFFFFFFFF);
                break;
+       case RAW_SFILEINFO_FULL_EA_INFORMATION:
+               info->full_ea_information.in.eas = gen_ea_list();
+               break;
        case RAW_SFILEINFO_GENERIC:
        case RAW_SFILEINFO_SEC_DESC:
        case RAW_SFILEINFO_UNIX_BASIC:
@@ -2222,7 +2225,8 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info)
        do {
                i = gen_int_range(0, num_levels-1);
        } while (ignore_pattern(levels[i].name));
-       
+
+       ZERO_STRUCTP(info);
        info->generic.level = levels[i].level;
 
        switch (info->generic.level) {
@@ -2279,6 +2283,9 @@ static void gen_setfileinfo(int instance, union smb_setfileinfo *info)
        case RAW_SFILEINFO_MODE_INFORMATION:
                info->mode_information.in.mode = gen_bits_mask(0xFFFFFFFF);
                break;
+       case RAW_SFILEINFO_FULL_EA_INFORMATION:
+               info->full_ea_information.in.eas = gen_ea_list();
+               break;
 
        case RAW_SFILEINFO_GENERIC:
        case RAW_SFILEINFO_SEC_DESC:
@@ -2907,12 +2914,11 @@ static int run_test(struct event_context *ev, struct loadparm_context *lp_ctx)
                current_op.opnum = op;
                current_op.name = gen_ops[which_op].name;
                current_op.status = NT_STATUS_OK;
+               talloc_free(current_op.mem_ctx);
                current_op.mem_ctx = talloc_named(NULL, 0, "%s", current_op.name);
 
                ret = gen_ops[which_op].handler(instance);
 
-               talloc_free(current_op.mem_ctx);
-
                gen_ops[which_op].count++;
                if (NT_STATUS_IS_OK(current_op.status)) {
                        gen_ops[which_op].success_count++;