svn commit: samba r15722 - in trunk/source: printing smbd

vlendec at samba.org vlendec at samba.org
Fri May 19 20:40:45 GMT 2006


Author: vlendec
Date: 2006-05-19 20:40:44 +0000 (Fri, 19 May 2006)
New Revision: 15722

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=15722

Log:
Lift set_saved_ntstatus from print_fsp_open.

Volker

Modified:
   trunk/source/printing/printfsp.c
   trunk/source/smbd/open.c
   trunk/source/smbd/reply.c


Changeset:
Modified: trunk/source/printing/printfsp.c
===================================================================
--- trunk/source/printing/printfsp.c	2006-05-19 19:54:39 UTC (rev 15721)
+++ trunk/source/printing/printfsp.c	2006-05-19 20:40:44 UTC (rev 15722)
@@ -28,7 +28,8 @@
 print_job_start().
 ***************************************************************************/
 
-files_struct *print_fsp_open(connection_struct *conn, const char *fname)
+NTSTATUS print_fsp_open(connection_struct *conn, const char *fname,
+			files_struct **result)
 {
 	int jobid;
 	SMB_STRUCT_STAT sbuf;
@@ -38,8 +39,7 @@
 
 	status = file_new(conn, &fsp);
 	if(!NT_STATUS_IS_OK(status)) {
-		set_saved_ntstatus(status);
-		return NULL;
+		return status;
 	}
 
 	fstrcpy( name, "Remote Downlevel Document");
@@ -54,8 +54,9 @@
 
 	jobid = print_job_start(&current_user, SNUM(conn), name, NULL);
 	if (jobid == -1) {
+		status = map_nt_error_from_unix(errno);
 		file_free(fsp);
-		return NULL;
+		return status;
 	}
 
 	/* Convert to RAP id. */
@@ -64,7 +65,7 @@
 		/* We need to delete the entry in the tdb. */
 		pjob_delete(lp_const_servicename(SNUM(conn)), jobid);
 		file_free(fsp);
-		return NULL;
+		return NT_STATUS_ACCESS_DENIED;	/* No errno around here */
 	}
 
 	/* setup a full fsp */
@@ -91,7 +92,8 @@
 
 	conn->num_files_open++;
 
-	return fsp;
+	*result = fsp;
+	return NT_STATUS_OK;
 }
 
 /****************************************************************************

Modified: trunk/source/smbd/open.c
===================================================================
--- trunk/source/smbd/open.c	2006-05-19 19:54:39 UTC (rev 15721)
+++ trunk/source/smbd/open.c	2006-05-19 20:40:44 UTC (rev 15722)
@@ -1115,7 +1115,11 @@
 
 		DEBUG(10, ("open_file_ntcreate: printer open fname=%s\n", fname));
 
-		return print_fsp_open(conn, fname);
+		status = print_fsp_open(conn, fname, &fsp);
+		if (!NT_STATUS_IS_OK(status)) {
+			set_saved_ntstatus(status);
+		}
+		return fsp;
 	}
 
 	/* We add aARCH to this as this mode is only used if the file is

Modified: trunk/source/smbd/reply.c
===================================================================
--- trunk/source/smbd/reply.c	2006-05-19 19:54:39 UTC (rev 15721)
+++ trunk/source/smbd/reply.c	2006-05-19 20:40:44 UTC (rev 15722)
@@ -3591,6 +3591,8 @@
 {
 	int outsize = 0;
 	files_struct *fsp;
+	NTSTATUS status;
+	
 	START_PROFILE(SMBsplopen);
 	
 	if (!CAN_PRINT(conn)) {
@@ -3599,11 +3601,11 @@
 	}
 
 	/* Open for exclusive use, write only. */
-	fsp = print_fsp_open(conn, NULL);
+	status = print_fsp_open(conn, NULL, &fsp);
 
-	if (!fsp) {
+	if (!NT_STATUS_IS_OK(status)) {
 		END_PROFILE(SMBsplopen);
-		return(UNIXERROR(ERRDOS,ERRnoaccess));
+		return(ERROR_NT(status));
 	}
 
 	outsize = set_message(outbuf,1,0,True);



More information about the samba-cvs mailing list