[cups.general] getting IP of clients for archiving
Jerome Alet
alet at librelogiciel.com
Fri Dec 3 12:32:36 PST 2004
On Fri, Dec 03, 2004 at 03:02:38PM -0500, Michael Sweet wrote:
> mutombo wrote:
> >
> >i would like to use cups as a document archiver.
> >for my own backend i need the IP of the client that sends the
> >printjob, but it seems like only these parameters are given:
> >$job,$user,$title,$copies,$options,$filename
> >is it possible to patch cups to add a $IP parameter there?
> >if this is not possible, perhaps someone has an idea how this could be
> >done?
> >i thought about parsing the logs, but in accesslog is no filename and
> >the pagelog has no IP. only the username is in both logs, but this
> >aint really a uniq comparefactor.
>
> Send a Get-Job-Attributes request to the local server for the job
> ID provided on the command-line and look for the
> job-originating-host-name attribute.
As an alternative, if you don't want to link to the CUPS library
and don't mind having some code which may not work in the future,
you can :
$ wget http://cortex.unice.fr/~jerome/ipp.py
then :
$ python ipp.py /var/spool/cups/c00005
to parse job 5's control file and return the client hostname
all job attributes are available as part of a Python mapping
(dictionnary), but for now only strings are decoded, and probably
NOT correctly, but the attribute you (and I) need is correctly
decoded :-)
NB : it's GPLed.
comments are welcome.
hth
Jerome Alet
More information about the cups
mailing list