Need to get IP address of computer sending job

Kurt Pfeifle k1pfeifle at gmx.net
Sat Oct 20 14:21:32 PDT 2007


Gary Carroll wrote:

> OS = Mac OS 10.4

disclaimer: I don't know how Mac's default CUPS settings deviate from what
I know about Linux.

> I have set up a shared print queue that writes incoming jobs to a folder 
> as PDF. 

How did you do that? Are you using a custom CUPS backend, that writes the
PDFs to this folder?

> I would like record about each job with information concerning 
> the username,

IPP job attribute "job-originating-user-name

> time sent 

IPP job attribute "time-at-creation"

> (not always the same as time processed into 
> PDF!),

IPP job attribute "time-at-processing"
IPP job attribute "time-at-completed"


> IP/MAC address of the system sending the data,


IPP job attribute "job-originating-host-name"   # can be starting point to
                                                # derive IP/MAC address from

> and formatting 
> requests from the original PostScript such as staple, duplex/simplex, 
> etc. 

5th commandline parameter seen by each CUPS filter and backend; argv[5]

also, in addition:

IPP job attribute "document-format"
IPP job attribute "job-name"
IPP job attribute "job-priority"
maybe some more.

The IPP job attributes are stored by CUPS in the spool directory, in
the cNNNNN files (where NNNNN is the local spooler's job ID for the
job).

These control files can be examined with the "testipp" utility, that
builds (inside the "test" subdirectory) if you compile CUPS from sources.

However, mere mortals are not allowed to read the cNNNNN files, because
they usually are owned by users "lp" and/or "root" and located in a
directory owned by lp/root.

If you're achieving your PDF magic by a custom backend, you can make it
run as root by assigning 0700 permissions to it, and let it be owned by
root.

> I believe can get the formatting requests by examining the incoming 
> PostScript with a CUPS prefilter before it is converted to PDF. 
> Since all users will be on the LAN I should in theory be able to get 
> their MAC address by issuing an ³arp IP-address² shell command. However, 
> I would need to know their IP address to do so. I don't know if this is 
> visible to CUPS.
> 
> Do I have to sniff packets to get this data? 

You're not afraid of anything, are you?   :-)

> If so, does it seem 
> reasonable to have a tshark 

You're not afraid of anything, are you?   :-)

> process started with a filter that writes 
> only the relevant portions of incoming print jobs to a file which can be 
> read via the prefilter to get the needed data?
> 
> Does someone have a better suggestion?


-- 
Kurt Pfeifle
System & Network Printing Consultant ---- Linux/Unix/Windows/Samba/CUPS
Infotec Deutschland GmbH  .....................  Hedelfinger Strasse 58
A RICOH Company  ...........................  D-70327 Stuttgart/Germany




More information about the cups mailing list