svn commit: samba r24474 - in branches: SAMBA_3_0_25/source/smbd
SAMBA_3_2/source/smbd SAMBA_3_2_0/source/smbd
jra at samba.org
jra at samba.org
Wed Aug 15 23:56:10 GMT 2007
Author: jra
Date: 2007-08-15 23:56:08 +0000 (Wed, 15 Aug 2007)
New Revision: 24474
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24474
Log:
Map error value NT_STATUS_OBJECT_NAME_COLLISION
to ERRDOS, ERRfilexists for NTCreateX and NTTransCreate.
Jeremy.
Modified:
branches/SAMBA_3_0_25/source/smbd/nttrans.c
branches/SAMBA_3_2/source/smbd/nttrans.c
branches/SAMBA_3_2_0/source/smbd/nttrans.c
Changeset:
Modified: branches/SAMBA_3_0_25/source/smbd/nttrans.c
===================================================================
--- branches/SAMBA_3_0_25/source/smbd/nttrans.c 2007-08-15 23:30:12 UTC (rev 24473)
+++ branches/SAMBA_3_0_25/source/smbd/nttrans.c 2007-08-15 23:56:08 UTC (rev 24474)
@@ -716,18 +716,6 @@
create_options,
new_file_attributes,
&info, &fsp);
-
- restore_case_semantics(conn, file_attributes);
-
- if(!NT_STATUS_IS_OK(status)) {
- if (!use_nt_status() && NT_STATUS_EQUAL(
- status, NT_STATUS_OBJECT_NAME_COLLISION)) {
- status = NT_STATUS_DOS(ERRDOS, ERRfilexists);
- }
- END_PROFILE(SMBntcreateX);
- return ERROR_NT(status);
- }
-
} else {
/*
@@ -756,7 +744,7 @@
oplock_request,
&info, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NT_STATUS_IS_OK(status)) {
/* We cheat here. There are two cases we
* care about. One is a directory rename,
* where the NT client will attempt to
@@ -788,7 +776,7 @@
END_PROFILE(SMBntcreateX);
return ERROR_FORCE_NT(NT_STATUS_FILE_IS_A_DIRECTORY);
}
-
+
oplock_request = 0;
status = open_directory(conn, fname, &sbuf,
access_mask,
@@ -798,29 +786,34 @@
new_file_attributes,
&info, &fsp);
- if(!NT_STATUS_IS_OK(status)) {
- restore_case_semantics(conn, file_attributes);
- if (!use_nt_status() && NT_STATUS_EQUAL(
- status, NT_STATUS_OBJECT_NAME_COLLISION)) {
- status = NT_STATUS_DOS(ERRDOS, ERRfilexists);
- }
- END_PROFILE(SMBntcreateX);
- return ERROR_NT(status);
- }
- } else {
- restore_case_semantics(conn, file_attributes);
- END_PROFILE(SMBntcreateX);
- if (open_was_deferred(SVAL(inbuf,smb_mid))) {
- /* We have re-scheduled this call. */
- return -1;
- }
- return ERROR_NT(status);
}
- }
+ }
}
-
+
restore_case_semantics(conn, file_attributes);
+ if(!NT_STATUS_IS_OK(status)) {
+ END_PROFILE(SMBntcreateX);
+
+ if (open_was_deferred(SVAL(inbuf,smb_mid))) {
+ /* We have re-scheduled this call. */
+ return -1;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+ /*
+ * We hit an existing file, and if we're returning DOS
+ * error codes OBJECT_NAME_COLLISION would map to
+ * ERRDOS/183, we need to return ERRDOS/80, see bug
+ * 4852.
+ */
+ return ERROR_BOTH(NT_STATUS_OBJECT_NAME_COLLISION,
+ ERRDOS, ERRfilexists);
+
+ }
+ return ERROR_NT(status);
+ }
+
file_len = sbuf.st_size;
fattr = dos_mode(conn,fname,&sbuf);
if(fattr == 0) {
@@ -1416,11 +1409,6 @@
create_options,
new_file_attributes,
&info, &fsp);
- if(!NT_STATUS_IS_OK(status)) {
- restore_case_semantics(conn, file_attributes);
- return ERROR_NT(status);
- }
-
} else {
/*
@@ -1436,7 +1424,7 @@
oplock_request,
&info, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,
NT_STATUS_FILE_IS_A_DIRECTORY)) {
@@ -1448,7 +1436,7 @@
restore_case_semantics(conn, file_attributes);
return ERROR_FORCE_NT(NT_STATUS_FILE_IS_A_DIRECTORY);
}
-
+
oplock_request = 0;
status = open_directory(conn, fname, &sbuf,
access_mask,
@@ -1457,26 +1445,37 @@
create_options,
new_file_attributes,
&info, &fsp);
- if(!NT_STATUS_IS_OK(status)) {
- restore_case_semantics(conn, file_attributes);
- return ERROR_NT(status);
- }
- } else {
- restore_case_semantics(conn, file_attributes);
- if (open_was_deferred(SVAL(inbuf,smb_mid))) {
- /* We have re-scheduled this call. */
- return -1;
- }
- return ERROR_NT(status);
}
- }
+ }
}
+ restore_case_semantics(conn, file_attributes);
+ if(!NT_STATUS_IS_OK(status)) {
+
+ if (open_was_deferred(SVAL(inbuf,smb_mid))) {
+ /* We have re-scheduled this call. */
+ return -1;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+ /*
+ * We hit an existing file, and if we're returning DOS
+ * error codes OBJECT_NAME_COLLISION would map to
+ * ERRDOS/183, we need to return ERRDOS/80, see bug
+ * 4852.
+ */
+ return ERROR_BOTH(NT_STATUS_OBJECT_NAME_COLLISION,
+ ERRDOS, ERRfilexists);
+
+ }
+ return ERROR_NT(status);
+ }
+
/*
* According to the MS documentation, the only time the security
* descriptor is applied to the opened file is iff we *created* the
* file; an existing file stays the same.
- *
+ *
* Also, it seems (from observation) that you can open the file with
* any access mask but you can still write the sd. We need to override
* the granted access before we call set_sd
Modified: branches/SAMBA_3_2/source/smbd/nttrans.c
===================================================================
--- branches/SAMBA_3_2/source/smbd/nttrans.c 2007-08-15 23:30:12 UTC (rev 24473)
+++ branches/SAMBA_3_2/source/smbd/nttrans.c 2007-08-15 23:56:08 UTC (rev 24474)
@@ -788,18 +788,6 @@
file_attributes,
&info, &fsp);
- TALLOC_FREE(case_state);
-
- if(!NT_STATUS_IS_OK(status)) {
- if (!use_nt_status() && NT_STATUS_EQUAL(
- status, NT_STATUS_OBJECT_NAME_COLLISION)) {
- status = NT_STATUS_DOS(ERRDOS, ERRfilexists);
- }
- reply_nterror(req, status);
- END_PROFILE(SMBntcreateX);
- return;
- }
-
} else {
/*
@@ -861,7 +849,7 @@
END_PROFILE(SMBntcreateX);
return;
}
-
+
oplock_request = 0;
status = open_directory(conn, req, fname,
&sbuf,
@@ -872,31 +860,33 @@
file_attributes,
&info, &fsp);
- if(!NT_STATUS_IS_OK(status)) {
- TALLOC_FREE(case_state);
- if (!use_nt_status() && NT_STATUS_EQUAL(
- status, NT_STATUS_OBJECT_NAME_COLLISION)) {
- status = NT_STATUS_DOS(ERRDOS, ERRfilexists);
- }
- reply_nterror(req, status);
- END_PROFILE(SMBntcreateX);
- return;
- }
- } else {
- TALLOC_FREE(case_state);
- END_PROFILE(SMBntcreateX);
- if (open_was_deferred(req->mid)) {
- /* We have re-scheduled this call. */
- return;
- }
- reply_nterror(req, status);
- return;
}
- }
+ }
}
-
+
TALLOC_FREE(case_state);
+ if (!NT_STATUS_IS_OK(status)) {
+ END_PROFILE(SMBntcreateX);
+ if (open_was_deferred(req->mid)) {
+ /* We have re-scheduled this call. */
+ return;
+ }
+ if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+ /*
+ * We hit an existing file, and if we're returning DOS
+ * error codes OBJECT_NAME_COLLISION would map to
+ * ERRDOS/183, we need to return ERRDOS/80, see bug
+ * 4852.
+ */
+ reply_botherror(req, NT_STATUS_OBJECT_NAME_COLLISION,
+ ERRDOS, ERRfilexists);
+ return;
+ }
+ reply_nterror(req, status);
+ return;
+ }
+
file_len = sbuf.st_size;
fattr = dos_mode(conn,fname,&sbuf);
if(fattr == 0) {
Modified: branches/SAMBA_3_2_0/source/smbd/nttrans.c
===================================================================
--- branches/SAMBA_3_2_0/source/smbd/nttrans.c 2007-08-15 23:30:12 UTC (rev 24473)
+++ branches/SAMBA_3_2_0/source/smbd/nttrans.c 2007-08-15 23:56:08 UTC (rev 24474)
@@ -743,16 +743,6 @@
&info, &fsp);
TALLOC_FREE(case_state);
-
- if(!NT_STATUS_IS_OK(status)) {
- if (!use_nt_status() && NT_STATUS_EQUAL(
- status, NT_STATUS_OBJECT_NAME_COLLISION)) {
- status = NT_STATUS_DOS(ERRDOS, ERRfilexists);
- }
- END_PROFILE(SMBntcreateX);
- return ERROR_NT(status);
- }
-
} else {
/*
@@ -781,7 +771,7 @@
oplock_request,
&info, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NT_STATUS_IS_OK(status)) {
/* We cheat here. There are two cases we
* care about. One is a directory rename,
* where the NT client will attempt to
@@ -813,7 +803,7 @@
END_PROFILE(SMBntcreateX);
return ERROR_FORCE_NT(NT_STATUS_FILE_IS_A_DIRECTORY);
}
-
+
oplock_request = 0;
status = open_directory(conn, &req, fname,
&sbuf,
@@ -823,30 +813,33 @@
create_options,
file_attributes,
&info, &fsp);
-
- if(!NT_STATUS_IS_OK(status)) {
- TALLOC_FREE(case_state);
- if (!use_nt_status() && NT_STATUS_EQUAL(
- status, NT_STATUS_OBJECT_NAME_COLLISION)) {
- status = NT_STATUS_DOS(ERRDOS, ERRfilexists);
- }
- END_PROFILE(SMBntcreateX);
- return ERROR_NT(status);
- }
- } else {
- TALLOC_FREE(case_state);
- END_PROFILE(SMBntcreateX);
- if (open_was_deferred(SVAL(inbuf,smb_mid))) {
- /* We have re-scheduled this call. */
- return -1;
- }
- return ERROR_NT(status);
}
- }
+ }
}
-
+
TALLOC_FREE(case_state);
+ if(!NT_STATUS_IS_OK(status)) {
+ END_PROFILE(SMBntcreateX);
+
+ if (open_was_deferred(SVAL(inbuf,smb_mid))) {
+ /* We have re-scheduled this call. */
+ return -1;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+ /*
+ * We hit an existing file, and if we're returning DOS
+ * error codes OBJECT_NAME_COLLISION would map to
+ * ERRDOS/183, we need to return ERRDOS/80, see bug
+ * 4852.
+ */
+ return ERROR_BOTH(NT_STATUS_OBJECT_NAME_COLLISION,
+ ERRDOS, ERRfilexists);
+ }
+ return ERROR_NT(status);
+ }
+
file_len = sbuf.st_size;
fattr = dos_mode(conn,fname,&sbuf);
if(fattr == 0) {
@@ -1463,11 +1456,6 @@
create_options,
file_attributes,
&info, &fsp);
- if(!NT_STATUS_IS_OK(status)) {
- TALLOC_FREE(case_state);
- return ERROR_NT(status);
- }
-
} else {
/*
@@ -1483,7 +1471,7 @@
oplock_request,
&info, &fsp);
- if (!NT_STATUS_IS_OK(status)) {
+ if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,
NT_STATUS_FILE_IS_A_DIRECTORY)) {
@@ -1495,7 +1483,7 @@
TALLOC_FREE(case_state);
return ERROR_FORCE_NT(NT_STATUS_FILE_IS_A_DIRECTORY);
}
-
+
oplock_request = 0;
status = open_directory(conn, &req, fname,
&sbuf,
@@ -1509,17 +1497,32 @@
TALLOC_FREE(case_state);
return ERROR_NT(status);
}
- } else {
- TALLOC_FREE(case_state);
- if (open_was_deferred(SVAL(inbuf,smb_mid))) {
- /* We have re-scheduled this call. */
- return -1;
- }
- return ERROR_NT(status);
}
- }
+ }
}
+ TALLOC_FREE(case_state);
+
+ if(!NT_STATUS_IS_OK(status)) {
+
+ if (open_was_deferred(SVAL(inbuf,smb_mid))) {
+ /* We have re-scheduled this call. */
+ return -1;
+ }
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_COLLISION)) {
+ /*
+ * We hit an existing file, and if we're returning DOS
+ * error codes OBJECT_NAME_COLLISION would map to
+ * ERRDOS/183, we need to return ERRDOS/80, see bug
+ * 4852.
+ */
+ return ERROR_BOTH(NT_STATUS_OBJECT_NAME_COLLISION,
+ ERRDOS, ERRfilexists);
+ }
+ return ERROR_NT(status);
+ }
+
/*
* According to the MS documentation, the only time the security
* descriptor is applied to the opened file is iff we *created* the
More information about the samba-cvs
mailing list