summaryrefslogtreecommitdiffstats
path: root/source/smbd/nttrans.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-04-05 01:20:32 +0000
committerJeremy Allison <jra@samba.org>2005-04-05 01:20:32 +0000
commit13ab739b00b90fae1712311a14791ee20aac4e28 (patch)
tree2a6e01bb67d21165ba599abe9892cd7bc0ae7b0e /source/smbd/nttrans.c
parent4027d45ebdaf229b4846fdc81048825f81429704 (diff)
downloadsamba-13ab739b00b90fae1712311a14791ee20aac4e28.tar.gz
samba-13ab739b00b90fae1712311a14791ee20aac4e28.tar.xz
samba-13ab739b00b90fae1712311a14791ee20aac4e28.zip
r6203: Fix attribute return on creating a directory with nttrans_create.
Fix strange allocation semantics of openX. Jeremy.
Diffstat (limited to 'source/smbd/nttrans.c')
-rw-r--r--source/smbd/nttrans.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/source/smbd/nttrans.c b/source/smbd/nttrans.c
index 6abea78239f..6421a14b28f 100644
--- a/source/smbd/nttrans.c
+++ b/source/smbd/nttrans.c
@@ -918,8 +918,9 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib
file_len = sbuf.st_size;
fmode = dos_mode(conn,fname,&sbuf);
- if(fmode == 0)
+ if(fmode == 0) {
fmode = FILE_ATTRIBUTE_NORMAL;
+ }
if (!fsp->is_directory && (fmode & aDIR)) {
close_file(fsp,False);
END_PROFILE(SMBntcreateX);
@@ -956,11 +957,13 @@ create_options = 0x%x root_dir_fid = 0x%x\n", flags, desired_access, file_attrib
* correct bit for extended oplock reply.
*/
- if (oplock_request && lp_fake_oplocks(SNUM(conn)))
+ if (oplock_request && lp_fake_oplocks(SNUM(conn))) {
extended_oplock_granted = True;
+ }
- if(oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type))
+ if(oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
extended_oplock_granted = True;
+ }
#if 0
/* W2K sends back 42 words here ! If we do the same it breaks offline sync. Go figure... ? JRA. */
@@ -1481,7 +1484,6 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
oplock_request,&rmode,&smb_action);
if (!fsp) {
-
if(errno == EISDIR) {
/*
@@ -1511,32 +1513,6 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
return set_bad_path_error(errno, bad_path, outbuf, ERRDOS,ERRnoaccess);
}
}
-
- file_len = sbuf.st_size;
- fmode = dos_mode(conn,fname,&sbuf);
- if(fmode == 0)
- fmode = FILE_ATTRIBUTE_NORMAL;
-
- if (fmode & aDIR) {
- talloc_destroy(ctx);
- close_file(fsp,False);
- restore_case_semantics(conn, file_attributes);
- return ERROR_NT(NT_STATUS_ACCESS_DENIED);
- }
-
- /*
- * If the caller set the extended oplock request bit
- * and we granted one (by whatever means) - set the
- * correct bit for extended oplock reply.
- */
-
- if (oplock_request && lp_fake_oplocks(SNUM(conn))) {
- extended_oplock_granted = True;
- }
-
- if(oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
- extended_oplock_granted = True;
- }
}
/*
@@ -1578,7 +1554,18 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
}
restore_case_semantics(conn, file_attributes);
+ talloc_destroy(ctx);
+ file_len = sbuf.st_size;
+ fmode = dos_mode(conn,fname,&sbuf);
+ if(fmode == 0) {
+ fmode = FILE_ATTRIBUTE_NORMAL;
+ }
+ if (!fsp->is_directory && (fmode & aDIR)) {
+ close_file(fsp,False);
+ return ERROR_DOS(ERRDOS,ERRnoaccess);
+ }
+
/* Save the requested allocation size. */
if ((smb_action == FILE_WAS_CREATED) || (smb_action == FILE_WAS_OVERWRITTEN)) {
SMB_BIG_UINT allocation_size = (SMB_BIG_UINT)IVAL(params,12);
@@ -1589,7 +1576,6 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
fsp->initial_allocation_size = smb_roundup(fsp->conn, allocation_size);
if (fsp->is_directory) {
close_file(fsp,False);
- END_PROFILE(SMBntcreateX);
/* Can't set allocation size on a directory. */
return ERROR_NT(NT_STATUS_ACCESS_DENIED);
}
@@ -1602,6 +1588,20 @@ static int call_nt_transact_create(connection_struct *conn, char *inbuf, char *o
}
}
+ /*
+ * If the caller set the extended oplock request bit
+ * and we granted one (by whatever means) - set the
+ * correct bit for extended oplock reply.
+ */
+
+ if (oplock_request && lp_fake_oplocks(SNUM(conn))) {
+ extended_oplock_granted = True;
+ }
+
+ if(oplock_request && EXCLUSIVE_OPLOCK_TYPE(fsp->oplock_type)) {
+ extended_oplock_granted = True;
+ }
+
/* Realloc the size of parameters and data we will return */
params = nttrans_realloc(ppparams, 69);
if(params == NULL)