CUPS 1.6.1 crashes on startup when DNS-SD host name cannot get determined via Avahi #4183

Closed
michaelrsweet opened this Issue Sep 7, 2012 · 2 comments

Comments

Projects
None yet
1 participant
Collaborator

michaelrsweet commented Sep 7, 2012

Version: 1.6.1
CUPS.org User: till.kamppeter

Original bug report at Ubuntu:

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1046982

According to the stack trace attached there

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1046982/+attachment/3296622/+files/Stacktrace.txt

cupsd crashes when registering printers at Avahi because DNSSDHostName is NULL, probably a failure on setting up the Avahi connectioon.

System and CUPS is as in STR #4180: CUPS 1.6.1 on Ubuntu Quantal (12.10), sharing printers via Avahi-based DNS-SD. Using the patches of STR #4155, STR #4156, STR #4157, STR #4158, and STR #4159.

Collaborator

michaelrsweet commented Oct 1, 2012

CUPS.org User: mike

Till, can you check the attached patch. I haven't see this crashing issue on my systems, but this should make sure we revert to the regular hostname if Avahi isn't functioning properly.

Collaborator

michaelrsweet commented Oct 10, 2012

"str4183.patch":

Index: scheduler/dirsvc.c

--- scheduler/dirsvc.c (revision 10619)
+++ scheduler/dirsvc.c (working copy)
@@ -457,14 +457,26 @@

endif /* APPLE */

ifdef HAVE_AVAHI

{

  • cupsdSetString(&DNSSDComputerName, avahi_client_get_host_name(DNSSDClient));
  • cupsdSetString(&DNSSDHostName,
  •               avahi_client_get_host_name_fqdn(DNSSDClient));
    
  • const char *host_name = avahi_client_get_host_name(DNSSDClient);
  • const char *host_fqdn = avahi_client_get_host_name_fqdn(DNSSDClient);
  • cupsdSetString(&DNSSDComputerName, host_name ? host_name : ServerName);
  • if (host_fqdn)
  •  cupsdSetString(&DNSSDHostName, host_fqdn);
    
  • else if (strchr(ServerName, '.'))
  •  cupsdSetString(&DNSSDHostName, ServerName);
    
  • else
  •  cupsdSetStringf(&DNSSDHostName, "%s.local", ServerName);
    
    }

    else /* HAVE_DNSSD */

    {
    cupsdSetString(&DNSSDComputerName, ServerName);
  • cupsdSetString(&DNSSDHostName, ServerName);
  • if (strchr(ServerName, '.'))
  •  cupsdSetString(&DNSSDHostName, ServerName);
    
  • else
  •  cupsdSetStringf(&DNSSDHostName, "%s.local", ServerName);
    
    }

    endif /* HAVE_AVAHI */

michaelrsweet added this to the Stable milestone Mar 17, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment