Rev 668: fixed missing close in acls code - patch from Michael Adam in http://samba.org/~tridge/3_0-ctdb

tridge at samba.org tridge at samba.org
Sun Nov 18 20:36:23 GMT 2007


------------------------------------------------------------
revno: 668
revision-id:tridge at samba.org-20071118203620-68pvwcs8yme7bxoz
parent: tridge at samba.org-20071118043206-6syotz7rrkg81roo
committer: Andrew Tridgell <tridge at samba.org>
branch nick: s3-ctdb-tridge
timestamp: Mon 2007-11-19 07:36:20 +1100
message:
  fixed missing close in acls code - patch from Michael Adam
modified:
  source/smbd/posix_acls.c       posix_acls.c-20070210173807-1wjifrbwaz6xnmgl-1031
=== modified file 'source/smbd/posix_acls.c'
--- a/source/smbd/posix_acls.c	2007-11-01 00:33:36 +0000
+++ b/source/smbd/posix_acls.c	2007-11-18 20:36:20 +0000
@@ -3943,9 +3943,7 @@
 
 	/* fake a files_struct ptr: */
 
-	status = open_file_stat(conn, fname, psbuf, &fsp);
-	/* Perhaps it is a directory */
-	if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY)) {
+	if (S_ISDIR(psbuf->st_mode)) {
 		status = open_directory(conn, fname, psbuf,
 					READ_CONTROL_ACCESS,
 					FILE_SHARE_READ|FILE_SHARE_WRITE,
@@ -3953,7 +3951,10 @@
 					0,
 					FILE_ATTRIBUTE_DIRECTORY,
 					NULL, &fsp);
+	} else {
+		status = open_file_stat(conn, fname, psbuf, &fsp);
 	}
+
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(3, ("Unable to open file %s: %s\n", fname,
 			nt_errstr(status)));
@@ -3967,12 +3968,16 @@
 					  &secdesc);
 	if (secdesc_size == 0) {
 		DEBUG(5, ("Unable to get NT ACL for file %s\n", fname));
-		return NT_STATUS_ACCESS_DENIED;
+		status = NT_STATUS_ACCESS_DENIED;
+		goto done;
 	}
 
 	*psd = talloc_move(mem_ctx, &secdesc);
+	status = NT_STATUS_OK;
+
+done:
 	close_file(fsp, NORMAL_CLOSE);
-	return NT_STATUS_OK;
+	return status;
 }
 
 static BOOL can_access_file_acl(struct connection_struct *conn,



More information about the samba-cvs mailing list