summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-02-22 01:31:55 +0000
committerJeremy Allison <jra@samba.org>2001-02-22 01:31:55 +0000
commit201753ddc623a18f4ddd0d9a19391ea0471d4c49 (patch)
treef8e52b7b06464d16b93522a8bf9abbb6c343be17 /source3/smbd
parent5fa7c79c336584b9eb868abaae69f8fb5950c43b (diff)
downloadsamba-201753ddc623a18f4ddd0d9a19391ea0471d4c49.tar.gz
samba-201753ddc623a18f4ddd0d9a19391ea0471d4c49.tar.bz2
samba-201753ddc623a18f4ddd0d9a19391ea0471d4c49.zip
Fixed file descriptor leak in error processing of print jobs.
NT sends "delete on close" to cancel a print job copied from the command line. Deal with this. Merged JohnR's fixes for print job errors. Jeremy. (This used to be commit 2060d74e48d62c99a1689ee02ac435b71918ddf0)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/trans2.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 4e44d71369..d94a775846 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1594,9 +1594,6 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
BOOL bad_path = False;
files_struct *fsp = NULL;
- if (!CAN_WRITE(conn))
- return(ERROR(ERRSRV,ERRaccess));
-
if (tran_call == TRANSACT2_SETFILEINFO) {
fsp = file_fsp(params,0);
info_level = SVAL(params,2);
@@ -1618,6 +1615,20 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
}
return(UNIXERROR(ERRDOS,ERRbadpath));
}
+ } else if (fsp->print_file) {
+ /*
+ * Doing a DELETE_ON_CLOSE should cancel a print job.
+ */
+ if ((info_level == SMB_SET_FILE_DISPOSITION_INFO) && CVAL(pdata,0)) {
+ fsp->share_mode = FILE_DELETE_ON_CLOSE;
+
+ DEBUG(3,("call_trans2setfilepathinfo: Cancelling print job (%s)\n",
+ fsp->fsp_name ));
+
+ SSVAL(params,0,0);
+ send_trans2_replies(outbuf, bufsize, params, 2, *ppdata, 0);
+ return(-1);
+ }
} else {
/*
* Original code - this is an open file.
@@ -1660,6 +1671,9 @@ static int call_trans2setfilepathinfo(connection_struct *conn,
}
}
+ if (!CAN_WRITE(conn))
+ return(ERROR(ERRSRV,ERRaccess));
+
DEBUG(3,("call_trans2setfilepathinfo(%d) %s info_level=%d totdata=%d\n",
tran_call,fname,info_level,total_data));