Pass job-originating-host-name value in LPD job #2053

Closed
michaelrsweet opened this Issue Oct 24, 2006 · 4 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Oct 24, 2006

Version: 1.6-feature
CUPS.org User: fedfan

Specifically if a printer is browsed on a client and that client
sends a print job the lpd backend should be sent the client real
hostname, i.e., the job-originating-host-name value. The lpr
control file that gets sent should then have that hostname
put in rather than the server's, or, at the very least, the lpd
backend should have a configuration file that would allow
one to customize it's behaviour, in particular, the hostname
issue I just described.

Collaborator

michaelrsweet commented Aug 24, 2007

CUPS.org User: mike

Holding for CUPS 1.5...

Collaborator

michaelrsweet commented Jan 27, 2012

CUPS.org User: mike

Will apply this for CUPS 1.6 - treating as a feature enhancement.

Collaborator

michaelrsweet commented Feb 16, 2012

CUPS.org User: mike

Fixed in Subversion repository.

Collaborator

michaelrsweet commented Feb 16, 2012

"str2053.patch":

Index: backend/lpd.c

--- backend/lpd.c (revision 10288)
+++ backend/lpd.c (working copy)
@@ -92,7 +92,7 @@
int mode, const char *user, const char *title,
int copies, int banner, int format, int order,
int reserve, int manual_copies, int timeout,

  •         int contimeout);
    
  •         int contimeout, const char _orighost);
    
    static int lpd_write(int lpd_fd, char *buffer, int length);
    #ifndef HAVE_RRESVPORT_AF
    static int rresvport_af(int *port, int family);
    @@ -144,6 +144,8 @@
    #if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
    struct sigaction action; /_ Actions for POSIX signals /
    #endif /
    HAVE_SIGACTION && !HAVE_SIGSET */
  • int num_jobopts; /* Number of job options */
  • cups_option_t jobopts = NULL; / Job options */

/*
@@ -191,6 +193,8 @@
return (CUPS_BACKEND_FAILED);
}

  • num_jobopts = cupsParseOptions(argv[5], 0, &jobopts);

/*

  • Extract the hostname and printer name from the URI...
    */
    @@ -525,7 +529,9 @@

    status = lpd_queue(hostname, addrlist, resource + 1, fd, snmp_fd, mode,
    username, title, copies, banner, format, order, reserve,

  •          manual_copies, timeout, contimeout);
    
  •          manual_copies, timeout, contimeout,
    
  •          cupsGetOption("job-originating-host-name", num_jobopts,
    
  •                        jobopts));
    

    if (!status)
    fprintf(stderr, "PAGE: 1 %d\n", atoi(argv[4]));
    @@ -533,7 +539,9 @@
    else
    status = lpd_queue(hostname, addrlist, resource + 1, fd, snmp_fd, mode,
    username, title, 1, banner, format, order, reserve, 1,

  •          timeout, contimeout);
    
  •          timeout, contimeout,
    
  •          cupsGetOption("job-originating-host-name", num_jobopts,
    
  •                        jobopts));
    

    /*

    • Remove the temporary file if necessary...
      @@ -638,7 +646,8 @@
      int reserve, /* I - Reserve ports? /
      int manual_copies,/
      I - Do copies by hand... /
      int timeout, /
      I - Timeout... */
  • int             contimeout)   /\* I - Connection timeout */
    
  • int             contimeout,   /\* I - Connection timeout */
    
  • const char      *orighost)    /* I - job-originating-host-name */
    

    {
    char localhost[255]; /* Local host name /
    int error; /
    Error number */
    @@ -927,7 +936,10 @@
    return (CUPS_BACKEND_FAILED);
    }

  • httpGetHostname(NULL, localhost, sizeof(localhost));

  • if (orighost)

  •  strlcpy(localhost, orighost, sizeof(localhost));
    
  • else

  •  httpGetHostname(NULL, localhost, sizeof(localhost));
    

    snprintf(control, sizeof(control),
    "H%.31s\n" /* RFC 1179, Section 7.2 - host name <= 31 chars */

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment