patch from Matthias Hilbig for bug 467; use the dns name (or IP) as the originating...
authorGerald Carter <jerry@samba.org>
Mon, 24 Nov 2003 18:38:15 +0000 (18:38 +0000)
committerGerald Carter <jerry@samba.org>
Mon, 24 Nov 2003 18:38:15 +0000 (18:38 +0000)
(This used to be commit eae48cda0f7f1346cd66d5a581c1273880f214d4)

source3/printing/print_cups.c

index 7cf21c966e48bdd62f4ce92b49a7939036d52caa..291028b70cf10ca2d84ebb05f43d9a985d61cc50 100644 (file)
@@ -680,7 +680,7 @@ cups_job_submit(int snum, struct printjob *pjob)
                        *response;      /* IPP Response */
        cups_lang_t     *language;      /* Default language */
        char            uri[HTTP_MAX_URI]; /* printer-uri attribute */
-
+       char            *clientname;    /* hostname of client for job-originating-host attribute */
 
        DEBUG(5,("cups_job_submit(%d, %p (%d))\n", snum, pjob, pjob->sysjob));
 
@@ -734,9 +734,14 @@ cups_job_submit(int snum, struct printjob *pjob)
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "requesting-user-name",
                     NULL, pjob->user);
 
+       clientname = client_name();
+       if (strcmp(clientname, "UNKNOWN") == 0) {
+               clientname = client_addr();
+       }
+
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME,
                     "job-originating-host-name", NULL,
-                    get_remote_machine_name());
+                     clientname);
 
        ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_NAME, "job-name", NULL,
                     pjob->jobname);