[Pkg-cups-devel] Bug#521311: cups: Cups server partially ignores ServerName parameter

Florian Lohoff flo at rfc822.org
Thu Mar 26 17:45:19 UTC 2009


Hi,
it seems the problem is that regardless of your config cups trys to do a
reverse lookup on the ip address of the local part of the client
connection and does hand out this in the printer/class uri.

So in client.c it resolves the local end and puts the result into
con->servername and later hands out con->servername in the 
uri for the printers.

The interesting point in client.c is that it first trys to find
the listen socket addr and the resulting hostname set from
the user - and later drops that on the floor in favour of
resolving the sockets local part - DNS must be more correct
than user config.


scheduler/client.c
 383   {
 384 #ifdef AF_INET6
 385     if (temp.addr.sa_family == AF_INET6)
 386     {
 387       httpAddrLookup(&temp, con->servername, sizeof(con->servername));
 388       con->serverport = ntohs(lis->address.ipv6.sin6_port);
 389     }
 390     else
 391 #endif /* AF_INET6 */
 392     if (temp.addr.sa_family == AF_INET)
 393     {
 394       httpAddrLookup(&temp, con->servername, sizeof(con->servername));
 395       con->serverport = ntohs(lis->address.ipv4.sin_port);
 396     }
 397     else
 398     {
 399       strcpy(con->servername, "localhost");
 400       con->serverport = LocalPort;
 401     }
 402   }

scheduler/ipp.c
 4792     {
 4793       for (i = 0; i < printer->num_printers; i ++)
 4794       {
 4795         p2 = printer->printers[i];
 4796 
 4797         if ((p2_uri = ippFindAttribute(p2->attrs, "printer-uri-supported",
 4798                                        IPP_TAG_URI)) != NULL)
 4799           member_uris->values[i].string.text =
 4800               _cupsStrAlloc(p2_uri->values[0].string.text);
 4801         else
 4802         {
 4803           httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri,
 4804                            sizeof(printer_uri), "ipp", NULL, con->servername,
 4805                            con->serverport,
 4806                            (p2->type & CUPS_PRINTER_CLASS) ?
 4807                                "/classes/%s" : "/printers/%s", p2->name);
 4808           member_uris->values[i].string.text = _cupsStrAlloc(printer_uri);
 4809         }
 4810       }
[...]
 4908     httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri, sizeof(printer_uri),
 4909                      "ipp", NULL, con->servername, con->serverport,
 4910                      (printer->type & CUPS_PRINTER_CLASS) ?
 4911                          "/classes/%s" : "/printers/%s", printer->name);
 4912     ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_URI,
 4913                  "printer-uri-supported", NULL, printer_uri);


My config looks like this:

	ServerAdmin flo at domain
	ServerName cups.homezone.domain
	Listen cups.homezone.domain:631

And the machines real name is lnxc-348.srv.domain which is not
resolvable and only available locally. Although i set
an explicit name for the Listen and a Servername i still
get passed the hostname in a CUPS-Get-Classes request.

There is no need to be clever - i told cups what to do *grrr*

Flo
-- 
Florian Lohoff                  flo at rfc822.org             +49-171-2280134
	Those who would give up a little freedom to get a little 
          security shall soon have neither - Benjamin Franklin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.alioth.debian.org/pipermail/pkg-cups-devel/attachments/20090326/f9fb47f4/attachment.pgp 


More information about the Pkg-cups-devel mailing list