summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-05-20 13:37:51 +1000
committerAndrew Tridgell <tridge@samba.org>2008-05-20 13:37:51 +1000
commit2214e6d9bfdc52db0558e831691b4500405ab9ae (patch)
tree1fa1a843ab3769fcfa83a1334509258518f1016e /source4
parent430f4ef66635acbf7b2b8f6a90aed597d03f3aca (diff)
downloadsamba-2214e6d9bfdc52db0558e831691b4500405ab9ae.tar.gz
samba-2214e6d9bfdc52db0558e831691b4500405ab9ae.tar.bz2
samba-2214e6d9bfdc52db0558e831691b4500405ab9ae.zip
added smb2_util_setatr
(This used to be commit d4f41db964ce82c8889017d0f932d60100b3cd32)
Diffstat (limited to 'source4')
-rw-r--r--source4/libcli/smb2/util.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/libcli/smb2/util.c b/source4/libcli/smb2/util.c
index 0fc03b48c5..9eb344e83f 100644
--- a/source4/libcli/smb2/util.c
+++ b/source4/libcli/smb2/util.c
@@ -82,6 +82,22 @@ NTSTATUS smb2_util_mkdir(struct smb2_tree *tree, const char *dname)
}
+/*
+ set file attribute with SMB2
+*/
+NTSTATUS smb2_util_setatr(struct smb2_tree *tree, const char *name, uint32_t attrib)
+{
+ union smb_setfileinfo io;
+
+ ZERO_STRUCT(io);
+ io.basic_info.level = RAW_SFILEINFO_BASIC_INFORMATION;
+ io.basic_info.in.file.path = name;
+ io.basic_info.in.attrib = attrib;
+
+ return smb2_composite_setpathinfo(tree, &io);
+}
+
+
/*
@@ -151,6 +167,12 @@ int smb2_deltree(struct smb2_tree *tree, const char *dname)
}
name = talloc_asprintf(tmp_ctx, "%s\\%s", dname, list[i].name_info.name.s);
status = smb2_util_unlink(tree, name);
+ if (NT_STATUS_EQUAL(status, NT_STATUS_CANNOT_DELETE)) {
+ /* it could be read-only */
+ status = smb2_util_setatr(tree, name, FILE_ATTRIBUTE_NORMAL);
+ status = smb2_util_unlink(tree, name);
+ }
+
if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY)) {
int ret;
ret = smb2_deltree(tree, name);