[SCM] Samba Shared Repository - branch v3-2-test updated - initial-v3-2-unstable-988-g2213857

Volker Lendecke vl at samba.org
Wed Jan 2 12:52:13 GMT 2008


The branch, v3-2-test has been updated
       via  22138572bd2b9ae379b01098566e38e132653968 (commit)
       via  1b1cea9ef04a85a2fdd3c8574f7c4db559b7d9b6 (commit)
       via  fa09b9ab26657af9bd6dcf3fcc7311d5983a591d (commit)
       via  209c696ab8490564ec9e30f6f07b9c72af3ed2e1 (commit)
      from  5f5051911c25772c7fb4ff41fca0aafae371ae4f (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 22138572bd2b9ae379b01098566e38e132653968
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 12:29:09 2007 +0100

    Convert call_trans2open to create_file()

commit 1b1cea9ef04a85a2fdd3c8574f7c4db559b7d9b6
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Dec 8 12:05:41 2007 +0100

    Convert reply_mknew to create_file

commit fa09b9ab26657af9bd6dcf3fcc7311d5983a591d
Author: Volker Lendecke <vl at sernet.de>
Date:   Fri Dec 7 14:23:10 2007 +0100

    Convert reply_open_and_X to create_file

commit 209c696ab8490564ec9e30f6f07b9c72af3ed2e1
Author: Volker Lendecke <vl at sernet.de>
Date:   Fri Dec 7 14:19:07 2007 +0100

    Convert reply_open to create_file

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

Summary of changes:
 source/smbd/reply.c  |  174 ++++++++++++++++----------------------------------
 source/smbd/trans2.c |   73 +++++----------------
 2 files changed, 70 insertions(+), 177 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/smbd/reply.c b/source/smbd/reply.c
index 2707aee..c859efd 100644
--- a/source/smbd/reply.c
+++ b/source/smbd/reply.c
@@ -1597,51 +1597,30 @@ void reply_open(connection_struct *conn, struct smb_request *req)
 		return;
 	}
 
-	status = resolve_dfspath(ctx, conn,
-				req->flags2 & FLAGS2_DFS_PATHNAMES,
-				fname,
-				&fname);
-	if (!NT_STATUS_IS_OK(status)) {
-		if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
-			reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
-					ERRSRV, ERRbadpath);
-			END_PROFILE(SMBopen);
-			return;
-		}
-		reply_nterror(req, status);
-		END_PROFILE(SMBopen);
-		return;
-	}
-
-	status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf);
-	if (!NT_STATUS_IS_OK(status)) {
-		reply_nterror(req, status);
-		END_PROFILE(SMBopen);
-		return;
-	}
-
-	status = check_name(conn, fname);
-	if (!NT_STATUS_IS_OK(status)) {
-		reply_nterror(req, status);
-		END_PROFILE(SMBopen);
-		return;
-	}
-
-	if (!map_open_params_to_ntcreate(fname, deny_mode, OPENX_FILE_EXISTS_OPEN,
-			&access_mask, &share_mode, &create_disposition, &create_options)) {
+	if (!map_open_params_to_ntcreate(
+		    fname, deny_mode, OPENX_FILE_EXISTS_OPEN, &access_mask,
+		    &share_mode, &create_disposition, &create_options)) {
 		reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
 		END_PROFILE(SMBopen);
 		return;
 	}
 
-	status = open_file_ntcreate(conn, req, fname, &sbuf,
-			access_mask,
-			share_mode,
-			create_disposition,
-			create_options,
-			dos_attr,
-			oplock_request,
-			&info, &fsp);
+	status = create_file(conn,			/* conn */
+			     req,			/* req */
+			     0,				/* root_dir_fid */
+			     fname,			/* fname */
+			     access_mask,		/* access_mask */
+			     share_mode,		/* share_access */
+			     create_disposition,	/* create_disposition*/
+			     create_options,		/* create_options */
+			     dos_attr,			/* file_attributes */
+			     oplock_request,		/* oplock_request */
+			     0,				/* allocation_size */
+			     NULL,			/* sd */
+			     NULL,			/* ea_list */
+			     &fsp,			/* result */
+			     &info,			/* pinfo */
+			     &sbuf);			/* psbuf */
 
 	if (!NT_STATUS_IS_OK(status)) {
 		if (open_was_deferred(req->mid)) {
@@ -1762,53 +1741,30 @@ void reply_open_and_X(connection_struct *conn, struct smb_request *req)
 		return;
 	}
 
-	status = resolve_dfspath(ctx, conn,
-				req->flags2 & FLAGS2_DFS_PATHNAMES,
-				fname,
-				&fname);
-	if (!NT_STATUS_IS_OK(status)) {
-		END_PROFILE(SMBopenX);
-		if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
-			reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
-					ERRSRV, ERRbadpath);
-			return;
-		}
-		reply_nterror(req, status);
-		return;
-	}
-
-	status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf);
-	if (!NT_STATUS_IS_OK(status)) {
-		reply_nterror(req, status);
-		END_PROFILE(SMBopenX);
-		return;
-	}
-
-	status = check_name(conn, fname);
-	if (!NT_STATUS_IS_OK(status)) {
-		reply_nterror(req, status);
-		END_PROFILE(SMBopenX);
-		return;
-	}
-
-	if (!map_open_params_to_ntcreate(fname, deny_mode, smb_ofun,
-				&access_mask,
-				&share_mode,
-				&create_disposition,
-				&create_options)) {
+	if (!map_open_params_to_ntcreate(
+		    fname, deny_mode, smb_ofun, &access_mask,
+		    &share_mode, &create_disposition, &create_options)) {
 		reply_nterror(req, NT_STATUS_DOS(ERRDOS, ERRbadaccess));
 		END_PROFILE(SMBopenX);
 		return;
 	}
 
-	status = open_file_ntcreate(conn, req, fname, &sbuf,
-			access_mask,
-			share_mode,
-			create_disposition,
-			create_options,
-			smb_attr,
-			oplock_request,
-			&smb_action, &fsp);
+	status = create_file(conn,			/* conn */
+			     req,			/* req */
+			     0,				/* root_dir_fid */
+			     fname,			/* fname */
+			     access_mask,		/* access_mask */
+			     share_mode,		/* share_access */
+			     create_disposition,	/* create_disposition*/
+			     create_options,		/* create_options */
+			     smb_attr,			/* file_attributes */
+			     oplock_request,		/* oplock_request */
+			     0,				/* allocation_size */
+			     NULL,			/* sd */
+			     NULL,			/* ea_list */
+			     &fsp,			/* result */
+			     &smb_action,		/* pinfo */
+			     &sbuf);			/* psbuf */
 
 	if (!NT_STATUS_IS_OK(status)) {
 		END_PROFILE(SMBopenX);
@@ -1982,35 +1938,6 @@ void reply_mknew(connection_struct *conn, struct smb_request *req)
 		return;
 	}
 
-	status = resolve_dfspath(ctx, conn,
-			req->flags2 & FLAGS2_DFS_PATHNAMES,
-			fname,
-			&fname);
-	if (!NT_STATUS_IS_OK(status)) {
-		END_PROFILE(SMBcreate);
-		if (NT_STATUS_EQUAL(status,NT_STATUS_PATH_NOT_COVERED)) {
-			reply_botherror(req, NT_STATUS_PATH_NOT_COVERED,
-					ERRSRV, ERRbadpath);
-			return;
-		}
-		reply_nterror(req, status);
-		return;
-	}
-
-	status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf);
-	if (!NT_STATUS_IS_OK(status)) {
-		reply_nterror(req, status);
-		END_PROFILE(SMBcreate);
-		return;
-	}
-
-	status = check_name(conn, fname);
-	if (!NT_STATUS_IS_OK(status)) {
-		reply_nterror(req, status);
-		END_PROFILE(SMBcreate);
-		return;
-	}
-
 	if (fattr & aVOLID) {
 		DEBUG(0,("Attempt to create file (%s) with volid set - "
 			"please report this\n", fname));
@@ -2024,15 +1951,22 @@ void reply_mknew(connection_struct *conn, struct smb_request *req)
 		create_disposition = FILE_OVERWRITE_IF;
 	}
 
-	/* Open file using ntcreate. */
-	status = open_file_ntcreate(conn, req, fname, &sbuf,
-				access_mask,
-				share_mode,
-				create_disposition,
-				create_options,
-				fattr,
-				oplock_request,
-				NULL, &fsp);
+	status = create_file(conn,			/* conn */
+			     req,			/* req */
+			     0,				/* root_dir_fid */
+			     fname,			/* fname */
+			     access_mask,		/* access_mask */
+			     share_mode,		/* share_access */
+			     create_disposition,	/* create_disposition*/
+			     create_options,		/* create_options */
+			     fattr,			/* file_attributes */
+			     oplock_request,		/* oplock_request */
+			     0,				/* allocation_size */
+			     NULL,			/* sd */
+			     NULL,			/* ea_list */
+			     &fsp,			/* result */
+			     NULL,			/* pinfo */
+			     &sbuf);			/* psbuf */
 
 	if (!NT_STATUS_IS_OK(status)) {
 		END_PROFILE(SMBcreate);
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c
index 6569255..eba8cb5 100644
--- a/source/smbd/trans2.c
+++ b/source/smbd/trans2.c
@@ -841,20 +841,6 @@ static void call_trans2open(connection_struct *conn,
 		fname, (unsigned int)deny_mode, (unsigned int)open_attr,
 		(unsigned int)open_ofun, open_size));
 
-	/* XXXX we need to handle passed times, sattr and flags */
-
-	status = unix_convert(ctx, conn, fname, False, &fname, NULL, &sbuf);
-	if (!NT_STATUS_IS_OK(status)) {
-		reply_nterror(req, status);
-		return;
-	}
-
-	status = check_name(conn, fname);
-	if (!NT_STATUS_IS_OK(status)) {
-		reply_nterror(req, status);
-		return;
-	}
-
 	if (open_ofun == 0) {
 		reply_nterror(req, NT_STATUS_OBJECT_NAME_COLLISION);
 		return;
@@ -899,14 +885,22 @@ static void call_trans2open(connection_struct *conn,
 		return;
 	}
 
-	status = open_file_ntcreate(conn, req, fname, &sbuf,
-		access_mask,
-		share_mode,
-		create_disposition,
-		create_options,
-		open_attr,
-		oplock_request,
-		&smb_action, &fsp);
+	status = create_file(conn,			/* conn */
+			     req,			/* req */
+			     0,				/* root_dir_fid */
+			     fname,			/* fname */
+			     access_mask,		/* access_mask */
+			     share_mode,		/* share_access */
+			     create_disposition,	/* create_disposition*/
+			     create_options,		/* create_options */
+			     open_attr,			/* file_attributes */
+			     oplock_request,		/* oplock_request */
+			     open_size,			/* allocation_size */
+			     NULL,			/* sd */
+			     ea_list,			/* ea_list */
+			     &fsp,			/* result */
+			     &smb_action,		/* pinfo */
+			     &sbuf);			/* psbuf */
 
 	if (!NT_STATUS_IS_OK(status)) {
 		if (open_was_deferred(req->mid)) {
@@ -927,41 +921,6 @@ static void call_trans2open(connection_struct *conn,
 		return;
 	}
 
-	/* Save the requested allocation size. */
-	/* Allocate space for the file if a size hint is supplied */
-	if ((smb_action == FILE_WAS_CREATED) || (smb_action == FILE_WAS_OVERWRITTEN)) {
-		SMB_BIG_UINT allocation_size = (SMB_BIG_UINT)open_size;
-		if (allocation_size && (allocation_size > (SMB_BIG_UINT)size)) {
-                        fsp->initial_allocation_size = smb_roundup(fsp->conn, allocation_size);
-                        if (fsp->is_directory) {
-                                close_file(fsp,ERROR_CLOSE);
-                                /* Can't set allocation size on a directory. */
-				reply_nterror(req, NT_STATUS_ACCESS_DENIED);
-				return;
-                        }
-                        if (vfs_allocate_file_space(fsp, fsp->initial_allocation_size) == -1) {
-                                close_file(fsp,ERROR_CLOSE);
-				reply_nterror(req, NT_STATUS_DISK_FULL);
-				return;
-                        }
-
-			/* Adjust size here to return the right size in the reply.
-			   Windows does it this way. */
-			size = fsp->initial_allocation_size;
-                } else {
-                        fsp->initial_allocation_size = smb_roundup(fsp->conn,(SMB_BIG_UINT)size);
-                }
-	}
-
-	if (ea_list && smb_action == FILE_WAS_CREATED) {
-		status = set_ea(conn, fsp, fname, ea_list);
-		if (!NT_STATUS_IS_OK(status)) {
-			close_file(fsp,ERROR_CLOSE);
-			reply_nterror(req, status);
-			return;
-		}
-	}
-
 	/* Realloc the size of parameters and data we will return */
 	*pparams = (char *)SMB_REALLOC(*pparams, 30);
 	if(*pparams == NULL ) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list