summaryrefslogtreecommitdiff
path: root/source3/smbd/nttrans.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-01-18 06:19:24 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:17:16 -0500
commitfd37f98158161406229b728a7c767121a30e254f (patch)
treebcc2ecea864702f61d56ccb1e2b10f7fa3672cc6 /source3/smbd/nttrans.c
parenta99840e59ee4bd27fd4f2cf8b465dd0f215ea067 (diff)
downloadsamba-fd37f98158161406229b728a7c767121a30e254f.tar.gz
samba-fd37f98158161406229b728a7c767121a30e254f.tar.bz2
samba-fd37f98158161406229b728a7c767121a30e254f.zip
r20873: Some correctness fixes w.r.t. Samba4 torture BASE-DELETE.
Allow us to correctly refuse to set delete on close on a non-empty directory. There are still some delete-on-close wrinkles to be fixed, but I understand how to do that better now. I'll fix this tomorrow. Jeremy. (This used to be commit 029635885825a5562e7974a6f5675cce3bf1b5dc)
Diffstat (limited to 'source3/smbd/nttrans.c')
-rw-r--r--source3/smbd/nttrans.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/source3/smbd/nttrans.c b/source3/smbd/nttrans.c
index ac7beabb53..51a4093f29 100644
--- a/source3/smbd/nttrans.c
+++ b/source3/smbd/nttrans.c
@@ -652,11 +652,13 @@ int reply_ntcreate_and_X(connection_struct *conn,
if (lp_acl_check_permissions(SNUM(conn))
&& (create_disposition != FILE_CREATE)
&& (share_access & FILE_SHARE_DELETE)
- && (access_mask & DELETE_ACCESS)
- && !can_delete_file_in_directory(conn, fname)) {
- restore_case_semantics(conn, file_attributes);
- END_PROFILE(SMBntcreateX);
- return ERROR_NT(NT_STATUS_ACCESS_DENIED);
+ && (access_mask & DELETE_ACCESS)) {
+ if ((dos_mode(conn, fname, &sbuf) & FILE_ATTRIBUTE_READONLY) ||
+ !can_delete_file_in_directory(conn, fname)) {
+ restore_case_semantics(conn, file_attributes);
+ END_PROFILE(SMBntcreateX);
+ return ERROR_NT(NT_STATUS_ACCESS_DENIED);
+ }
}
/*
@@ -1277,10 +1279,13 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
if (lp_acl_check_permissions(SNUM(conn))
&& (create_disposition != FILE_CREATE)
&& (share_access & FILE_SHARE_DELETE)
- && (access_mask & DELETE_ACCESS)
- && !can_delete_file_in_directory(conn, fname)) {
- restore_case_semantics(conn, file_attributes);
- return ERROR_NT(NT_STATUS_ACCESS_DENIED);
+ && (access_mask & DELETE_ACCESS)) {
+ if ((dos_mode(conn, fname, &sbuf) & FILE_ATTRIBUTE_READONLY) ||
+ !can_delete_file_in_directory(conn, fname)) {
+ restore_case_semantics(conn, file_attributes);
+ END_PROFILE(SMBntcreateX);
+ return ERROR_NT(NT_STATUS_ACCESS_DENIED);
+ }
}
if (ea_len) {