diff options
author | Jeremy Allison <jra@samba.org> | 2001-02-22 01:30:39 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2001-02-22 01:30:39 +0000 |
commit | 01ca93e6d731dae90d2797eb8c63f8ab650d9ed8 (patch) | |
tree | 5f9320ebfc346735c3f4fce596b330b396b05ba2 /source/smbd/trans2.c | |
parent | a77e31f7d8794f83c16d880fd22c3a9d6efb89c8 (diff) | |
download | samba-01ca93e6d731dae90d2797eb8c63f8ab650d9ed8.tar.gz |
Fixed file descriptor leak in error conditions on print close.
NT sends "delete on close" to cancel a print job copied from the command line.
Cope with this.
Jeremy.
Diffstat (limited to 'source/smbd/trans2.c')
-rw-r--r-- | source/smbd/trans2.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/source/smbd/trans2.c b/source/smbd/trans2.c index 15bdc8b671c..6cc65d1b21b 100644 --- a/source/smbd/trans2.c +++ b/source/smbd/trans2.c @@ -1592,9 +1592,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); @@ -1616,6 +1613,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. @@ -1658,6 +1669,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)); |