[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-300-g5c63388

Jeremy Allison jra at samba.org
Thu Mar 12 17:58:14 GMT 2009


The branch, master has been updated
       via  5c63388f63028af9bac2acb2ef0a38736278823b (commit)
      from  4b57f6dd34d1ddbdc7b011de1ea7041ec8215dec (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 5c63388f63028af9bac2acb2ef0a38736278823b
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 12 10:57:31 2009 -0700

    Fix bug #6186 - map readonly does not work
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source3/nmbd/nmbd_nameregister.c |    8 ++++++++
 source3/smbd/open.c              |   28 +++++++++++++++++++++++++---
 2 files changed, 33 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/nmbd/nmbd_nameregister.c b/source3/nmbd/nmbd_nameregister.c
index 98f129a..d4359aa 100644
--- a/source3/nmbd/nmbd_nameregister.c
+++ b/source3/nmbd/nmbd_nameregister.c
@@ -104,6 +104,14 @@ static void register_name_response(struct subnet_record *subrec,
 			 subrec->subnet_name, nmb->header.rcode, inet_ntoa(p->ip)));
 		success = False;
 	} else {
+		if (!ip_equal_v4(rrec->packet->ip, p->ip)) {
+			DEBUG(5,("register_name_response: Ignoring WINS server response "
+				"from IP %s, for name %s. We sent to IP %s\n",
+				inet_ntoa(p->ip),
+				nmb_namestr(answer_name),
+				inet_ntoa(rrec->packet->ip)));
+			return;
+		}
 		/* Unicast - check to see if the response allows us to have the name. */
 		if (nmb->header.opcode == NMB_WACK_OPCODE) {
 			/* WINS server is telling us to wait. Pretend we didn't get
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index c8cc2e6..d529b00 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -454,8 +454,26 @@ static NTSTATUS open_file(files_struct *fsp,
 					&access_granted);
 			if (!NT_STATUS_IS_OK(status)) {
 				if (NT_STATUS_EQUAL(status, NT_STATUS_ACCESS_DENIED)) {
+					/*
+					 * On NT_STATUS_ACCESS_DENIED, access_granted
+					 * contains the denied bits.
+					 */
+
+					if ((access_mask & FILE_WRITE_ATTRIBUTES) &&
+							(access_granted & FILE_WRITE_ATTRIBUTES) &&
+							(lp_map_readonly(SNUM(conn)) ||
+							 lp_map_archive(SNUM(conn)) ||
+							 lp_map_hidden(SNUM(conn)) ||
+							 lp_map_system(SNUM(conn)))) {
+						access_granted &= ~FILE_WRITE_ATTRIBUTES;
+
+						DEBUG(10,("open_file: overrode FILE_WRITE_ATTRIBUTES "
+							"on file %s\n",
+							path ));
+					}
+
 					if ((access_mask & DELETE_ACCESS) &&
-							(access_granted == DELETE_ACCESS) &&
+							(access_granted & DELETE_ACCESS) &&
 							can_delete_file_in_directory(conn, path)) {
 						/* Were we trying to do a stat open
 						 * for delete and didn't get DELETE
@@ -465,10 +483,14 @@ static NTSTATUS open_file(files_struct *fsp,
 						 * http://blogs.msdn.com/oldnewthing/archive/2004/06/04/148426.aspx
 						 * for details. */
 
-						DEBUG(10,("open_file: overrode ACCESS_DENIED "
+						access_granted &= ~DELETE_ACCESS;
+
+						DEBUG(10,("open_file: overrode DELETE_ACCESS "
 							"on file %s\n",
 							path ));
-					} else {
+					}
+
+					if (access_granted != 0) {
 						DEBUG(10, ("open_file: Access denied on "
 							"file %s\n",
 							path));


-- 
Samba Shared Repository


More information about the samba-cvs mailing list