mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
s3-printing: Lift the use of smbd_server_fd from job_submit.
Signed-off-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
dc2313d1e8
commit
d418f9f11a
@ -39,6 +39,7 @@ struct printjob {
|
||||
fstring filename; /* the filename used to spool the file */
|
||||
fstring jobname; /* the job name given to us by the client */
|
||||
fstring user; /* the user who started the job */
|
||||
fstring clientmachine; /* The client machine which started this job */
|
||||
fstring queuename; /* service number of printer for this job */
|
||||
struct spoolss_DeviceMode *devmode;
|
||||
};
|
||||
@ -82,7 +83,7 @@ extern struct printif iprint_printif;
|
||||
#ifndef PRINT_SPOOL_PREFIX
|
||||
#define PRINT_SPOOL_PREFIX "smbprn."
|
||||
#endif
|
||||
#define PRINT_DATABASE_VERSION 5
|
||||
#define PRINT_DATABASE_VERSION 6
|
||||
|
||||
/* There can be this many printing tdb's open, plus any locked ones. */
|
||||
#define MAX_PRINT_DBS_OPEN 1
|
||||
|
@ -912,7 +912,6 @@ static int cups_job_submit(int snum, struct printjob *pjob)
|
||||
ipp_attribute_t *attr_job_id = NULL; /* IPP Attribute "job-id" */
|
||||
cups_lang_t *language = NULL; /* Default language */
|
||||
char uri[HTTP_MAX_URI]; /* printer-uri attribute */
|
||||
const char *clientname = NULL; /* hostname of client for job-originating-host attribute */
|
||||
char *new_jobname = NULL;
|
||||
int num_options = 0;
|
||||
cups_option_t *options = NULL;
|
||||
@ -923,7 +922,6 @@ static int cups_job_submit(int snum, struct printjob *pjob)
|
||||
char *filename = NULL;
|
||||
size_t size;
|
||||
uint32_t jobid = (uint32_t)-1;
|
||||
char addr[INET6_ADDRSTRLEN];
|
||||
|
||||
DEBUG(5,("cups_job_submit(%d, %p)\n", snum, pjob));
|
||||
|
||||
@ -981,14 +979,9 @@ static int cups_job_submit(int snum, struct printjob *pjob)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, user);
|
||||
|
||||
clientname = client_name(smbd_server_fd());
|
||||
if (strcmp(clientname, "UNKNOWN") == 0) {
|
||||
clientname = client_addr(smbd_server_fd(),addr,sizeof(addr));
|
||||
}
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"job-originating-host-name", NULL,
|
||||
clientname);
|
||||
pjob->clientmachine);
|
||||
|
||||
/* Get the jobid from the filename. */
|
||||
jobid = print_parse_jobid(pjob->filename);
|
||||
|
@ -731,8 +731,6 @@ static int iprint_job_submit(int snum, struct printjob *pjob)
|
||||
ipp_attribute_t *attr; /* Current attribute */
|
||||
cups_lang_t *language = NULL; /* Default language */
|
||||
char uri[HTTP_MAX_URI]; /* printer-uri attribute */
|
||||
const char *clientname = NULL; /* hostname of client for job-originating-host attribute */
|
||||
char addr[INET6_ADDRSTRLEN];
|
||||
|
||||
DEBUG(5,("iprint_job_submit(%d, %p (%d))\n", snum, pjob, pjob->sysjob));
|
||||
|
||||
@ -785,14 +783,9 @@ static int iprint_job_submit(int snum, struct printjob *pjob)
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
|
||||
NULL, pjob->user);
|
||||
|
||||
clientname = client_name(smbd_server_fd());
|
||||
if (strcmp(clientname, "UNKNOWN") == 0) {
|
||||
clientname = client_addr(smbd_server_fd(),addr,sizeof(addr));
|
||||
}
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
|
||||
"job-originating-host-name", NULL,
|
||||
clientname);
|
||||
pjob->clientmachine);
|
||||
|
||||
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
|
||||
pjob->jobname);
|
||||
|
@ -375,7 +375,7 @@ int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob )
|
||||
if ( !buf || !pjob )
|
||||
return -1;
|
||||
|
||||
len += tdb_unpack(buf+len, buflen-len, "dddddddddffff",
|
||||
len += tdb_unpack(buf+len, buflen-len, "dddddddddfffff",
|
||||
&pjpid,
|
||||
&pjsysjob,
|
||||
&pjfd,
|
||||
@ -388,6 +388,7 @@ int unpack_pjob( uint8 *buf, int buflen, struct printjob *pjob )
|
||||
pjob->filename,
|
||||
pjob->jobname,
|
||||
pjob->user,
|
||||
pjob->clientmachine,
|
||||
pjob->queuename);
|
||||
|
||||
if ( len == -1 )
|
||||
@ -641,7 +642,7 @@ static bool pjob_store(struct tevent_context *ev,
|
||||
do {
|
||||
len = 0;
|
||||
buflen = newlen;
|
||||
len += tdb_pack(buf+len, buflen-len, "dddddddddffff",
|
||||
len += tdb_pack(buf+len, buflen-len, "dddddddddfffff",
|
||||
(uint32)pjob->pid,
|
||||
(uint32)pjob->sysjob,
|
||||
(uint32)pjob->fd,
|
||||
@ -654,6 +655,7 @@ static bool pjob_store(struct tevent_context *ev,
|
||||
pjob->filename,
|
||||
pjob->jobname,
|
||||
pjob->user,
|
||||
pjob->clientmachine,
|
||||
pjob->queuename);
|
||||
|
||||
len += pack_devicemode(pjob->devmode, buf+len, buflen-len);
|
||||
@ -2810,6 +2812,8 @@ NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum,
|
||||
SMB_STRUCT_STAT sbuf;
|
||||
struct printif *current_printif = get_printer_fns( snum );
|
||||
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
|
||||
const char *clientname;
|
||||
char addr[INET6_ADDRSTRLEN];
|
||||
|
||||
pjob = print_job_find(sharename, jobid);
|
||||
|
||||
@ -2872,6 +2876,12 @@ NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum,
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
clientname = client_name(smbd_server_fd());
|
||||
if (strcmp(clientname, "UNKNOWN") == 0) {
|
||||
clientname = client_addr(smbd_server_fd(),addr,sizeof(addr));
|
||||
}
|
||||
fstrcpy(pjob->clientmachine, clientname);
|
||||
|
||||
ret = (*(current_printif->job_submit))(snum, pjob);
|
||||
|
||||
if (ret) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user