#1 Accounting to UNIX domain socket

open
nobody
None
5
2012-03-14
2012-03-14
Dirk Krause
No

Hello,

I applied some changes to LPRng and ifhp related to accounting.
For both programs we can specify a UNIX domain socket as :af entry now.
Print accounting/quota software can now listen on a UNIX domain
socket for incoming connection requests. lpd and ifhp use the stat()
function before opening a file. If the file is a socket, the
socket() and connect() functions are used instead of open() to obtain
a file descriptor.
I want to ask you to insert the changes into the standard LPRng and ifhp
distributions. My example uses a default timeout of 15 seconds for the
connection, may be you want to make it configurable.

I have some other remarks:
- In ifhp a HAVE_SIGPROCMASK is used, there was no test to set it
in configure.ac, so it never gets defined. I changed configure.ac.
- If the accounting file is a pipe (i.e. :af=|/usr/local/bin/myprog)
the ifhp filter does not write accouting information to the pipe.
As far as I found out the Accountfile variable is NULL when
Do_accounting() is run.

Hope this is a useful contribution to LPRng.
Thanks for creating it and making it freely available.
Regards,

Dirk

Discussion

  • Dirk Krause
    Dirk Krause
    2012-03-14

     
    Attachments