[cups] Getting remote/client username and remote hostname

Helge Blischke helgeblischke at web.de
Tue May 17 07:21:23 PDT 2016


> Am 17.05.2016 um 11:37 schrieb Christoph Litauer <litauer at uni-koblenz.de>:
> 
> Dear cups users,
> 
> perhaps you can help me with a little problem I am not able to find a solution for.
> 
> My cups server runs cups 1.5.4 (printhost). I have several kiosk stations running a local cupsd (1.5.2). All kiosks have a ipp-printer configured pointing to the cups server: 
> 
> bib01:~# lpstat -v
> device for bib-kopierer: ipp://printhost/printers/test
> 
> The printer test on the cups server uses the attached ppd-file. As you can see there is a feature "JobType" using this definition:
> 
> *JobType HoldPrint/Hold Print: "%% FoomaticRIPOptionSetting: JobType=HoldPrint"
> *FoomaticRIPOptionSetting JobType=HoldPrint: "mark\n&&
> /usrcode where{pop}{/usrcode()def}ifelse\n&&
> (&user;) usrcode (20`date +%y%m%d%R | sed 's/://'`) {setuserinfo} stopped\n&&
> cleartomark\n&&
> mark {\n&&
>        << /JobType 3\n&&
>        /JobInfo\n&&
>        <<\n&&
>                /UserID (&user;)\n&&
>                /Time(20`date +%y%m%d%R | sed 's/://'`)\n&&
>                /JobID ()\n&&
>                isGenuine not isEnhancedFeatures or {\n&&
>                /HostLoginName (&user;)\n&&
>                /HostName (&host;)\n&&
>                }if\n&&
>>> \n&&
>        /JobAttr << /Save 0 >>\n&&
>>> /RDeviceProcSet /ProcSet findresource /SetJobType get exec\n&&
> }stopped cleartomark\n"
> *End
> 
> 
> When the client prints to bib-kopierer, the following code is generated:
> mark
> /usrcode where{pop}{/usrcode()def}ifelse
> (remroot) usrcode (201605171114) {setuserinfo} stopped
> cleartomark
> mark {
>        << /JobType 3
>        /JobInfo
>        <<
>                /UserID (remroot)
>                /Time(201605171114)
>                /JobID ()
>                isGenuine not isEnhancedFeatures or {
>                /HostLoginName (remroot)
>                /HostName (printhost)
>                }if
>>> 
>        /JobAttr << /Save 0 >>
>>> /RDeviceProcSet /ProcSet findresource /SetJobType get exec
> }stopped cleartomark
> 
> 
> As you can see "&user;" has been substituted by remroot (which is correct) and "&host;" has been substituted by "printhost" (which is wrong).
> I think "&host;" should be substituted by the client name originating the printjob.
> 
> Is it possible to achieve that? Are there any other variables usable in foomatic printers ppd configs?
> 
> --
> Kind regards
> Christoph
> _________________________________________

"remroot“ as username indicates that the filter(s) – foomatic-rip in this case – has been executed on the printhost. In this case it is 
correct that "printhost“ is set as the host name (retrieved by calling the function gethostname by the filter).

Helge





More information about the cups mailing list