cups icon indicating copy to clipboard operation
cups copied to clipboard

libcups.so.2::cupsCreateJob failed on remote CUPS server ( client-error-not-found for Get-Printer-Attributes )

Open chri50 opened this issue 3 years ago • 0 comments

Hi, I am working on printing services using CUPS as printing backend and run into a problem and may ask for suggestions.

Short: using libcups.so:2::cupsPrintFile to hand over print requests - this works fine on localhost. Doing the same using identical remote CUPS server instead failed with client-error-not-found . I am uncertain if i am doing something terribly wrong. From my point of view I would like to point out what went wrong and kindly ask for support.

host_ = any-non-local-ip port_ = 1631 # using CUPS server compiled with --with-ipp-port=1631 cancel_ = FALSE msec_to = 3000

All starts with cupsPrintFile using http_t* httpConnect2(host_.data(),port_,NULL,AF_UNSPEC,HTTP_ENCRYPTION_IF_REQUESTED,TRUE,msec_to_,&cancel_); will come down to cupsCreateJob. cupsCreateJob will send three IPP requests to the remote CUPS server:

  1. dest = cupsGetNamedDest(http, name, NULL)

Response OK, as shared printer exists.

  1. info = cupsCopyDestInfo(http, dest)

based on dest second request failed with Returning IPP client-error-not-found for Get-Printer-Attributes (lpd://printer-ip/LPT1) due do sending the request to the remote CUPS server but using CUPS_DEST_FLAGS_DEVICE and using the device-uri instead of printer-uri.

Log:

[Client ] 2.0 Get-Printer-Attributes 24 cupsdProcessIPPRequest(0x5588b1f3d510[3]): operation_id=000b(Get-Printer-Attributes) cupsdProcessIPPRequest: operation-attributes-tag cupsdProcessIPPRequest: attributes-charset charset 'utf-8' cupsdProcessIPPRequest: attributes-natural-language naturalLanguage 'en-us' cupsdProcessIPPRequest: printer-uri uri 'lpd://printer-ip/LPT1' cupsdProcessIPPRequest: requesting-user-name nameWithoutLanguage 'root' cupsdProcessIPPRequest: requested-attributes 1setOf keyword 'job-template,media-col-database,printer-description' Get-Printer-Attributes lpd://printer-ip/LPT1 get_printer_attrs(0x5588b1f3d510[3], lpd://printer-ip/LPT1) Get-Printer-Attributes client-error-not-found: The printer or class does not exist. [Client ] Returning IPP client-error-not-found for Get-Printer-Attributes (lpd://printer-ip/LPT1) from...

In my case i would like to talk to the CUPS server.

Question: Is there any change to force or configure to do the second IPP request right? Many thanks for any suggestions!

https://github.com/apple/cups/blob/0ad6ac55da2686c6fa24b05bde5e9036fd4db5d1/cups/dest-options.c#L615-L631

  1. status = cupsCreateDestJob(http, dest, info, &job_id, title, num_options, options)

up to here, only on locally used CUPS server as i guess AF_LOCAL will take affect.

chri50 avatar Jan 10 '23 15:01 chri50