Some questions about the LPD printing protocol

I am studying the functioning of the LPD printing protocol, as defined in RFC 1179. I am experiencing things in python with this protocol and a Canon TS3350 printer on my local network, but I never succeeded to print any document nor to put any print job on a queue (the “send queue state” command doesn’t return anything but an acknowledgement byte). I have some questions:

  • Is a document printed as soon as a control file and a data file have been sent to the printer through “receive a printer job” (02) subcommands or is it just put in a queue ?

  • What information are necessary in the control file ? What is a minimal example, yet valid for printing, of a control file ?

  • Is the “user identification” (P) line even checked ? What is its purpose ?

  • The RFC states that:

If a data file length has been specified, the next “Operand 1” octets over the same TCP connection are the intended contents of the data file.

Yet, PRET’s tool seems to discard the command code and all the rest, just sending data followed by a null byte (file lpd/ line 228): s.send(bytes(data + "\000", 'utf-8'))

  • What are good resources on the LPD protocol and its vulnerabilities ?