summaryrefslogtreecommitdiffstats
path: root/source3/printing
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-08-16 13:53:10 +0200
committerAndreas Schneider <asn@samba.org>2010-08-16 14:02:19 +0200
commitd418f9f11abb5b5ed038acbaf5dbb2a656d39d87 (patch)
tree9db83e16fbcfa1fd64c5270252751f06bc13b976 /source3/printing
parentdc2313d1e87b68a5d85be8443e377491f979ecbc (diff)
downloadsamba-d418f9f11abb5b5ed038acbaf5dbb2a656d39d87.tar.gz
samba-d418f9f11abb5b5ed038acbaf5dbb2a656d39d87.tar.xz
samba-d418f9f11abb5b5ed038acbaf5dbb2a656d39d87.zip
s3-printing: Lift the use of smbd_server_fd from job_submit.
Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/print_cups.c9
-rw-r--r--source3/printing/print_iprint.c9
-rw-r--r--source3/printing/printing.c14
3 files changed, 14 insertions, 18 deletions
diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c
index 2441cfc275f..a85fba89974 100644
--- a/source3/printing/print_cups.c
+++ b/source3/printing/print_cups.c
@@ -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);
diff --git a/source3/printing/print_iprint.c b/source3/printing/print_iprint.c
index 75324960ef0..ea375da3b70 100644
--- a/source3/printing/print_iprint.c
+++ b/source3/printing/print_iprint.c
@@ -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);
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 69191ef9a84..31b802d3fbd 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -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) {