#include "includes.h"
#include "printing.h"
+#include "rpc_client/rpc_client.h"
#include "../librpc/gen_ndr/ndr_spoolss_c.h"
#include "rpc_server/rpc_ncacn_np.h"
-#include "smbd/smbd.h"
#include "smbd/globals.h"
#include "../libcli/security/security.h"
+struct print_file_data {
+ char *svcname;
+ char *docname;
+ char *filename;
+ struct policy_handle handle;
+ uint32_t jobid;
+ uint16 rap_jobid;
+};
+
+uint16_t print_spool_rap_jobid(struct print_file_data *print_file)
+{
+ if (print_file == NULL) {
+ return 0;
+ }
+
+ return print_file->rap_jobid;
+}
+
void print_spool_terminate(struct connection_struct *conn,
struct print_file_data *print_file);
NTSTATUS print_spool_open(files_struct *fsp,
const char *fname,
- uint16_t current_vuid)
+ uint64_t current_vuid)
{
NTSTATUS status;
TALLOC_CTX *tmp_ctx;
}
}
- /* Ok, now we have to open an actual file.
+ /*
+ * Ok, now we have to open an actual file.
* Here is the reason:
* We want to write the spool job to this file in
* smbd for scalability reason (and also because
* to spoolss in output_file so it can monitor and
* take over once we call EndDocPrinter().
* Of course we will not start writing until
- * StartDocPrinter() actually gives the ok. */
+ * StartDocPrinter() actually gives the ok.
+ * smbd spooler files do not include a print jobid
+ * path component, as the jobid is only known after
+ * calling StartDocPrinter().
+ */
- pf->filename = talloc_asprintf(pf, "%s/%s.XXXXXX",
+ pf->filename = talloc_asprintf(pf, "%s/%sXXXXXX",
lp_pathname(SNUM(fsp->conn)),
PRINT_SPOOL_PREFIX);
if (!pf->filename) {
status = rpc_pipe_open_interface(fsp->conn,
&ndr_table_spoolss.syntax_id,
fsp->conn->session_info,
- &fsp->conn->sconn->client_id,
+ fsp->conn->sconn->remote_address,
fsp->conn->sconn->msg_ctx,
&fsp->conn->spoolss_pipe);
if (!NT_STATUS_IS_OK(status)) {
}
fsp->file_id = vfs_file_id_from_sbuf(fsp->conn, &fsp->fsp_name->st);
- fsp->mode = fsp->fsp_name->st.st_ex_mode;
fsp->fh->fd = fd;
fsp->vuid = current_vuid;
int print_spool_write(files_struct *fsp,
const char *data, uint32_t size,
- SMB_OFF_T offset, uint32_t *written)
+ off_t offset, uint32_t *written)
{
SMB_STRUCT_STAT st;
ssize_t n;
status = rpc_pipe_open_interface(conn,
&ndr_table_spoolss.syntax_id,
conn->session_info,
- &conn->sconn->client_id,
+ conn->sconn->remote_address,
conn->sconn->msg_ctx,
&conn->spoolss_pipe);
if (!NT_STATUS_IS_OK(status)) {