[cups.bugs] [MOD] STR #3737: cannot get cups to send IP address in printer URIs

Jon Peatfield jp107 at cam.ac.uk
Thu Dec 2 15:00:43 PST 2010


DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR New]

Hmm, I always thought that HostNameLookups only affected lookups from
client IP addresses (which is what the manual seems to imply), but in
cups-1.3.7 I see in network.c cupsdNetIFUpdate() a test which seems to
imply what you expected would work:

....
  for (addr = addrs; addr != NULL; addr = addr->ifa_next)
  {
....
    if (HostNameLookups)
      httpAddrLookup((http_addr_t *)(addr->ifa_addr), hostname,
                     sizeof(hostname));
    else
    {
     /*
      * Map the default server address and localhost to the server name
      * and localhost, respectively; for all other addresses, use the
      * dotted notation...
      */

      if (httpAddrLocalhost((http_addr_t *)(addr->ifa_addr)))
        strcpy(hostname, "localhost");
      else
      {
        for (saddr = ServerAddrs; saddr; saddr = saddr->next)
	  if (httpAddrEqual((http_addr_t *)(addr->ifa_addr), &(saddr->addr)))
	    break;

	if (saddr)
          strlcpy(hostname, ServerName, sizeof(hostname));
	else
          httpAddrString((http_addr_t *)(addr->ifa_addr), hostname,
	        	 sizeof(hostname));
      }
    }
....

but in cups-1.4.5 that test for HostNameLookups has changed to:

....
   /*
    * Try looking up the hostname for the address as needed...
    */

#ifdef __APPLE__
    if (HostNameLookups)
#else
    if (HostNameLookups || RemotePort)
#endif /* __APPLE__ */
      httpAddrLookup((http_addr_t *)(addr->ifa_addr), hostname,
                     sizeof(hostname));
....

where RemotePort starts off as zero but gets set to the last port
specified in a (non-local) listen (or port) directive (see conf.c).

You could change the source to do what you want (and probably used to
work) but currently there doesn't seem to be a way to configure the old
behaviour.

I note that several tests for HostNameLookups have now changed into
(HostNameLookups || RemotePort) so this probably affects other things too.

Sorry I missed that ...->hostname might not be the DNS name earlier.

Link: http://www.cups.org/str.php?L3737
Version: 1.4.4





More information about the cups mailing list