Array handling fixes for DNSSDPrinters.
This commit is contained in:
parent
3f9aa63f17
commit
6a13918bff
@ -1,8 +1,7 @@
|
|||||||
diff --git a/cgi-bin/admin.c b/cgi-bin/admin.c
|
diff -up cups-1.5.0/cgi-bin/admin.c.avahi-5-services cups-1.5.0/cgi-bin/admin.c
|
||||||
index 99b8e7b..2688eff 100644
|
--- cups-1.5.0/cgi-bin/admin.c.avahi-5-services 2011-05-20 04:49:49.000000000 +0100
|
||||||
--- a/cgi-bin/admin.c
|
+++ cups-1.5.0/cgi-bin/admin.c 2011-10-11 11:36:13.571498447 +0100
|
||||||
+++ b/cgi-bin/admin.c
|
@@ -1643,7 +1643,7 @@ do_config_server(http_t *http) /* I - H
|
||||||
@@ -1643,7 +1643,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
|
||||||
else
|
else
|
||||||
local_protocols[0] = '\0';
|
local_protocols[0] = '\0';
|
||||||
|
|
||||||
@ -11,7 +10,7 @@ index 99b8e7b..2688eff 100644
|
|||||||
if (cgiGetVariable("BROWSE_LOCAL_DNSSD"))
|
if (cgiGetVariable("BROWSE_LOCAL_DNSSD"))
|
||||||
{
|
{
|
||||||
if (local_protocols[0])
|
if (local_protocols[0])
|
||||||
@@ -1651,7 +1651,7 @@ do_config_server(http_t *http) /* I - HTTP connection */
|
@@ -1651,7 +1651,7 @@ do_config_server(http_t *http) /* I - H
|
||||||
else
|
else
|
||||||
strcat(local_protocols, "dnssd");
|
strcat(local_protocols, "dnssd");
|
||||||
}
|
}
|
||||||
@ -20,7 +19,7 @@ index 99b8e7b..2688eff 100644
|
|||||||
|
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
if (cgiGetVariable("BROWSE_LOCAL_LDAP"))
|
if (cgiGetVariable("BROWSE_LOCAL_LDAP"))
|
||||||
@@ -2718,9 +2718,9 @@ do_menu(http_t *http) /* I - HTTP connection */
|
@@ -2718,9 +2718,9 @@ do_menu(http_t *http) /* I - HTTP conn
|
||||||
#endif /* HAVE_GSSAPI */
|
#endif /* HAVE_GSSAPI */
|
||||||
cgiSetVariable("KERBEROS", "");
|
cgiSetVariable("KERBEROS", "");
|
||||||
|
|
||||||
@ -32,11 +31,10 @@ index 99b8e7b..2688eff 100644
|
|||||||
|
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
cgiSetVariable("HAVE_LDAP", "1");
|
cgiSetVariable("HAVE_LDAP", "1");
|
||||||
diff --git a/scheduler/client.c b/scheduler/client.c
|
diff -up cups-1.5.0/scheduler/client.c.avahi-5-services cups-1.5.0/scheduler/client.c
|
||||||
index e4c9b01..984dcc5 100644
|
--- cups-1.5.0/scheduler/client.c.avahi-5-services 2011-06-10 22:16:18.000000000 +0100
|
||||||
--- a/scheduler/client.c
|
+++ cups-1.5.0/scheduler/client.c 2011-10-11 11:36:13.575498374 +0100
|
||||||
+++ b/scheduler/client.c
|
@@ -4987,7 +4987,7 @@ valid_host(cupsd_client_t *con) /* I -
|
||||||
@@ -4987,7 +4987,7 @@ valid_host(cupsd_client_t *con) /* I - Client connection */
|
|
||||||
!strncmp(host, "[::1]:", 6));
|
!strncmp(host, "[::1]:", 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +43,7 @@ index e4c9b01..984dcc5 100644
|
|||||||
/*
|
/*
|
||||||
* Check if the hostname is something.local (Bonjour); if so, allow it.
|
* Check if the hostname is something.local (Bonjour); if so, allow it.
|
||||||
*/
|
*/
|
||||||
@@ -4996,7 +4996,7 @@ valid_host(cupsd_client_t *con) /* I - Client connection */
|
@@ -4996,7 +4996,7 @@ valid_host(cupsd_client_t *con) /* I -
|
||||||
(!_cups_strcasecmp(end, ".local") || !_cups_strncasecmp(end, ".local:", 7) ||
|
(!_cups_strcasecmp(end, ".local") || !_cups_strncasecmp(end, ".local:", 7) ||
|
||||||
!_cups_strcasecmp(end, ".local.") || !_cups_strncasecmp(end, ".local.:", 8)))
|
!_cups_strcasecmp(end, ".local.") || !_cups_strncasecmp(end, ".local.:", 8)))
|
||||||
return (1);
|
return (1);
|
||||||
@ -54,11 +52,10 @@ index e4c9b01..984dcc5 100644
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the hostname is an IP address...
|
* Check if the hostname is an IP address...
|
||||||
diff --git a/scheduler/conf.c b/scheduler/conf.c
|
diff -up cups-1.5.0/scheduler/conf.c.avahi-5-services cups-1.5.0/scheduler/conf.c
|
||||||
index badc630..c1edd39 100644
|
--- cups-1.5.0/scheduler/conf.c.avahi-5-services 2011-10-11 11:36:11.893529370 +0100
|
||||||
--- a/scheduler/conf.c
|
+++ cups-1.5.0/scheduler/conf.c 2011-10-11 11:36:13.580498282 +0100
|
||||||
+++ b/scheduler/conf.c
|
@@ -651,7 +651,7 @@ cupsdReadConfiguration(void)
|
||||||
@@ -648,7 +648,7 @@ cupsdReadConfiguration(void)
|
|
||||||
Browsing = CUPS_DEFAULT_BROWSING;
|
Browsing = CUPS_DEFAULT_BROWSING;
|
||||||
DefaultShared = CUPS_DEFAULT_DEFAULT_SHARED;
|
DefaultShared = CUPS_DEFAULT_DEFAULT_SHARED;
|
||||||
|
|
||||||
@ -67,10 +64,9 @@ index badc630..c1edd39 100644
|
|||||||
cupsdSetString(&DNSSDRegType, "_ipp._tcp,_cups");
|
cupsdSetString(&DNSSDRegType, "_ipp._tcp,_cups");
|
||||||
#endif /* HAVE_DNSSD */
|
#endif /* HAVE_DNSSD */
|
||||||
|
|
||||||
diff --git a/scheduler/dirsvc.c b/scheduler/dirsvc.c
|
diff -up cups-1.5.0/scheduler/dirsvc.c.avahi-5-services cups-1.5.0/scheduler/dirsvc.c
|
||||||
index eb3c862..48dcef9 100644
|
--- cups-1.5.0/scheduler/dirsvc.c.avahi-5-services 2011-10-11 11:36:12.084525850 +0100
|
||||||
--- a/scheduler/dirsvc.c
|
+++ cups-1.5.0/scheduler/dirsvc.c 2011-10-11 11:36:13.585498189 +0100
|
||||||
+++ b/scheduler/dirsvc.c
|
|
||||||
@@ -27,6 +27,7 @@
|
@@ -27,6 +27,7 @@
|
||||||
* ldap_connect() - Start new LDAP connection
|
* ldap_connect() - Start new LDAP connection
|
||||||
* ldap_reconnect() - Reconnect to LDAP Server
|
* ldap_reconnect() - Reconnect to LDAP Server
|
||||||
@ -79,7 +75,12 @@ index eb3c862..48dcef9 100644
|
|||||||
* cupsdStartBrowsing() - Start sending and receiving broadcast
|
* cupsdStartBrowsing() - Start sending and receiving broadcast
|
||||||
* information.
|
* information.
|
||||||
* cupsdStartPolling() - Start polling servers as needed.
|
* cupsdStartPolling() - Start polling servers as needed.
|
||||||
@@ -45,6 +46,8 @@
|
@@ -40,11 +41,12 @@
|
||||||
|
* dequote() - Remote quotes from a string.
|
||||||
|
* dnssdAddAlias() - Add a DNS-SD alias name.
|
||||||
|
* dnssdBuildTxtRecord() - Build a TXT record from printer info.
|
||||||
|
- * dnssdComparePrinters() - Compare the registered names of two printers.
|
||||||
|
* dnssdDeregisterPrinter() - Stop sending broadcast information for a
|
||||||
* printer.
|
* printer.
|
||||||
* dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT
|
* dnssdPackTxtRecord() - Pack an array of key/value pairs into the TXT
|
||||||
* record format.
|
* record format.
|
||||||
@ -88,7 +89,7 @@ index eb3c862..48dcef9 100644
|
|||||||
* dnssdRegisterCallback() - DNSServiceRegister callback.
|
* dnssdRegisterCallback() - DNSServiceRegister callback.
|
||||||
* dnssdRegisterPrinter() - Start sending broadcast information for a
|
* dnssdRegisterPrinter() - Start sending broadcast information for a
|
||||||
* printer or update the broadcast contents.
|
* printer or update the broadcast contents.
|
||||||
@@ -83,6 +86,7 @@
|
@@ -83,6 +85,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "cupsd.h"
|
#include "cupsd.h"
|
||||||
@ -96,7 +97,7 @@ index eb3c862..48dcef9 100644
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
|
|
||||||
#ifdef HAVE_DNSSD
|
#ifdef HAVE_DNSSD
|
||||||
@@ -97,6 +101,17 @@
|
@@ -97,6 +100,17 @@
|
||||||
# endif /* HAVE_SYSTEMCONFIGURATION */
|
# endif /* HAVE_SYSTEMCONFIGURATION */
|
||||||
# endif /* __APPLE__ */
|
# endif /* __APPLE__ */
|
||||||
#endif /* HAVE_DNSSD */
|
#endif /* HAVE_DNSSD */
|
||||||
@ -114,14 +115,13 @@ index eb3c862..48dcef9 100644
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -159,27 +174,39 @@ static void update_polling(void);
|
@@ -159,27 +173,38 @@ static void update_polling(void);
|
||||||
static void update_smb(int onoff);
|
static void update_smb(int onoff);
|
||||||
|
|
||||||
|
|
||||||
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
|
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
|
||||||
+static cupsd_txt_record_t dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p,
|
+static cupsd_txt_record_t dnssdBuildTxtRecord(int *txt_len, cupsd_printer_t *p,
|
||||||
+ int for_lpd);
|
+ int for_lpd);
|
||||||
+static int dnssdComparePrinters(cupsd_printer_t *a, cupsd_printer_t *b);
|
|
||||||
+static void dnssdDeregisterPrinter(cupsd_printer_t *p);
|
+static void dnssdDeregisterPrinter(cupsd_printer_t *p);
|
||||||
+static void dnssdRegisterPrinter(cupsd_printer_t *p);
|
+static void dnssdRegisterPrinter(cupsd_printer_t *p);
|
||||||
+static void dnssdStop(void);
|
+static void dnssdStop(void);
|
||||||
@ -162,7 +162,7 @@ index eb3c862..48dcef9 100644
|
|||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
static const char * const ldap_attrs[] =/* CUPS LDAP attributes */
|
static const char * const ldap_attrs[] =/* CUPS LDAP attributes */
|
||||||
{
|
{
|
||||||
@@ -283,10 +310,10 @@ cupsdDeregisterPrinter(
|
@@ -283,10 +308,10 @@ cupsdDeregisterPrinter(
|
||||||
ldap_dereg_printer(p);
|
ldap_dereg_printer(p);
|
||||||
#endif /* HAVE_LDAP */
|
#endif /* HAVE_LDAP */
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ index eb3c862..48dcef9 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -702,10 +729,10 @@ cupsdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
|
@@ -702,10 +727,10 @@ cupsdRegisterPrinter(cupsd_printer_t *p)
|
||||||
slpRegisterPrinter(p); */
|
slpRegisterPrinter(p); */
|
||||||
#endif /* HAVE_LIBSLP */
|
#endif /* HAVE_LIBSLP */
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ index eb3c862..48dcef9 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1419,6 +1446,27 @@ ldap_disconnect(LDAP *ld) /* I - LDAP handle */
|
@@ -1419,6 +1444,27 @@ ldap_disconnect(LDAP *ld) /* I - LDAP h
|
||||||
#endif /* HAVE_LDAP */
|
#endif /* HAVE_LDAP */
|
||||||
|
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ index eb3c862..48dcef9 100644
|
|||||||
/*
|
/*
|
||||||
* 'cupsdStartBrowsing()' - Start sending and receiving broadcast information.
|
* 'cupsdStartBrowsing()' - Start sending and receiving broadcast information.
|
||||||
*/
|
*/
|
||||||
@@ -1542,13 +1590,16 @@ cupsdStartBrowsing(void)
|
@@ -1542,13 +1588,16 @@ cupsdStartBrowsing(void)
|
||||||
else
|
else
|
||||||
BrowseSocket = -1;
|
BrowseSocket = -1;
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ index eb3c862..48dcef9 100644
|
|||||||
/*
|
/*
|
||||||
* First create a "master" connection for all registrations...
|
* First create a "master" connection for all registrations...
|
||||||
*/
|
*/
|
||||||
@@ -1573,6 +1624,7 @@ cupsdStartBrowsing(void)
|
@@ -1573,6 +1622,7 @@ cupsdStartBrowsing(void)
|
||||||
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
|
fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC);
|
||||||
|
|
||||||
cupsdAddSelect(fd, (cupsd_selfunc_t)dnssdUpdate, NULL, NULL);
|
cupsdAddSelect(fd, (cupsd_selfunc_t)dnssdUpdate, NULL, NULL);
|
||||||
@ -244,7 +244,16 @@ index eb3c862..48dcef9 100644
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Then get the port we use for registrations. If we are not listening
|
* Then get the port we use for registrations. If we are not listening
|
||||||
@@ -1606,9 +1658,16 @@ cupsdStartBrowsing(void)
|
@@ -1598,17 +1648,23 @@ cupsdStartBrowsing(void)
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (BrowseRemoteProtocols & BROWSE_DNSSD)
|
||||||
|
- DNSSDPrinters = cupsArrayNew((cups_array_func_t)dnssdComparePrinters,
|
||||||
|
- NULL);
|
||||||
|
+ DNSSDPrinters = cupsArrayNew(NULL, NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the computer name and register the web interface...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cupsdUpdateDNSSDName();
|
cupsdUpdateDNSSDName();
|
||||||
@ -262,7 +271,7 @@ index eb3c862..48dcef9 100644
|
|||||||
|
|
||||||
#ifdef HAVE_LIBSLP
|
#ifdef HAVE_LIBSLP
|
||||||
if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
|
if ((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP)
|
||||||
@@ -1834,10 +1893,10 @@ cupsdStopBrowsing(void)
|
@@ -1834,10 +1890,10 @@ cupsdStopBrowsing(void)
|
||||||
BrowseSocket = -1;
|
BrowseSocket = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,7 +285,7 @@ index eb3c862..48dcef9 100644
|
|||||||
|
|
||||||
#ifdef HAVE_LIBSLP
|
#ifdef HAVE_LIBSLP
|
||||||
if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) &&
|
if (((BrowseLocalProtocols | BrowseRemoteProtocols) & BROWSE_SLP) &&
|
||||||
@@ -1902,7 +1961,7 @@ cupsdStopPolling(void)
|
@@ -1902,7 +1958,7 @@ cupsdStopPolling(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -285,7 +294,7 @@ index eb3c862..48dcef9 100644
|
|||||||
/*
|
/*
|
||||||
* 'cupsdUpdateDNSSDName()' - Update the computer name we use for browsing...
|
* 'cupsdUpdateDNSSDName()' - Update the computer name we use for browsing...
|
||||||
*/
|
*/
|
||||||
@@ -1910,8 +1969,14 @@ cupsdStopPolling(void)
|
@@ -1910,8 +1966,14 @@ cupsdStopPolling(void)
|
||||||
void
|
void
|
||||||
cupsdUpdateDNSSDName(void)
|
cupsdUpdateDNSSDName(void)
|
||||||
{
|
{
|
||||||
@ -300,7 +309,7 @@ index eb3c862..48dcef9 100644
|
|||||||
# ifdef HAVE_SYSTEMCONFIGURATION
|
# ifdef HAVE_SYSTEMCONFIGURATION
|
||||||
SCDynamicStoreRef sc; /* Context for dynamic store */
|
SCDynamicStoreRef sc; /* Context for dynamic store */
|
||||||
CFDictionaryRef btmm; /* Back-to-My-Mac domains */
|
CFDictionaryRef btmm; /* Back-to-My-Mac domains */
|
||||||
@@ -2042,6 +2107,7 @@ cupsdUpdateDNSSDName(void)
|
@@ -2042,6 +2104,7 @@ cupsdUpdateDNSSDName(void)
|
||||||
else
|
else
|
||||||
strlcpy(webif, "CUPS Web Interface", sizeof(webif));
|
strlcpy(webif, "CUPS Web Interface", sizeof(webif));
|
||||||
|
|
||||||
@ -308,7 +317,7 @@ index eb3c862..48dcef9 100644
|
|||||||
if (WebIFRef)
|
if (WebIFRef)
|
||||||
DNSServiceRefDeallocate(WebIFRef);
|
DNSServiceRefDeallocate(WebIFRef);
|
||||||
|
|
||||||
@@ -2054,9 +2120,45 @@ cupsdUpdateDNSSDName(void)
|
@@ -2054,9 +2117,45 @@ cupsdUpdateDNSSDName(void)
|
||||||
NULL)) != kDNSServiceErr_NoError)
|
NULL)) != kDNSServiceErr_NoError)
|
||||||
cupsdLogMessage(CUPSD_LOG_ERROR,
|
cupsdLogMessage(CUPSD_LOG_ERROR,
|
||||||
"DNS-SD web interface registration failed: %d", error);
|
"DNS-SD web interface registration failed: %d", error);
|
||||||
@ -355,7 +364,7 @@ index eb3c862..48dcef9 100644
|
|||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
@@ -2334,13 +2436,15 @@ dnssdAddAlias(const void *key, /* I - Key */
|
@@ -2334,13 +2433,15 @@ dnssdAddAlias(const void *key, /* I - K
|
||||||
"Bad Back to My Mac domain in dynamic store!");
|
"Bad Back to My Mac domain in dynamic store!");
|
||||||
}
|
}
|
||||||
# endif /* HAVE_COREFOUNDATION */
|
# endif /* HAVE_COREFOUNDATION */
|
||||||
@ -372,7 +381,7 @@ index eb3c862..48dcef9 100644
|
|||||||
dnssdBuildTxtRecord(
|
dnssdBuildTxtRecord(
|
||||||
int *txt_len, /* O - TXT record length */
|
int *txt_len, /* O - TXT record length */
|
||||||
cupsd_printer_t *p, /* I - Printer information */
|
cupsd_printer_t *p, /* I - Printer information */
|
||||||
@@ -2379,7 +2483,12 @@ dnssdBuildTxtRecord(
|
@@ -2379,7 +2480,12 @@ dnssdBuildTxtRecord(
|
||||||
keyvalue[i ][0] = "ty";
|
keyvalue[i ][0] = "ty";
|
||||||
keyvalue[i++][1] = p->make_model ? p->make_model : "Unknown";
|
keyvalue[i++][1] = p->make_model ? p->make_model : "Unknown";
|
||||||
|
|
||||||
@ -386,12 +395,24 @@ index eb3c862..48dcef9 100644
|
|||||||
httpAssembleURIf(HTTP_URI_CODING_ALL, adminurl_str, sizeof(adminurl_str),
|
httpAssembleURIf(HTTP_URI_CODING_ALL, adminurl_str, sizeof(adminurl_str),
|
||||||
"http", NULL, admin_hostname, DNSSDPort, "/%s/%s",
|
"http", NULL, admin_hostname, DNSSDPort, "/%s/%s",
|
||||||
(p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers",
|
(p->type & CUPS_PRINTER_CLASS) ? "classes" : "printers",
|
||||||
@@ -2462,7 +2571,12 @@ dnssdBuildTxtRecord(
|
@@ -2462,19 +2568,12 @@ dnssdBuildTxtRecord(
|
||||||
* Then pack them into a proper txt record...
|
* Then pack them into a proper txt record...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
+#ifdef HAVE_DNSSD
|
+#ifdef HAVE_DNSSD
|
||||||
return (dnssdPackTxtRecord(txt_len, keyvalue, i));
|
return (dnssdPackTxtRecord(txt_len, keyvalue, i));
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-/*
|
||||||
|
- * 'dnssdComparePrinters()' - Compare the registered names of two printers.
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
-static int /* O - Result of comparison */
|
||||||
|
-dnssdComparePrinters(cupsd_printer_t *a,/* I - First printer */
|
||||||
|
- cupsd_printer_t *b)/* I - Second printer */
|
||||||
|
-{
|
||||||
|
- return (_cups_strcasecmp(a->reg_name, b->reg_name));
|
||||||
+#endif /* HAVE_DNSSD */
|
+#endif /* HAVE_DNSSD */
|
||||||
+#ifdef HAVE_AVAHI
|
+#ifdef HAVE_AVAHI
|
||||||
+ return (avahiPackTxtRecord(keyvalue, i));
|
+ return (avahiPackTxtRecord(keyvalue, i));
|
||||||
@ -399,25 +420,7 @@ index eb3c862..48dcef9 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2474,7 +2588,16 @@ static int /* O - Result of comparison */
|
@@ -2489,6 +2588,10 @@ dnssdDeregisterPrinter(
|
||||||
dnssdComparePrinters(cupsd_printer_t *a,/* I - First printer */
|
|
||||||
cupsd_printer_t *b)/* I - Second printer */
|
|
||||||
{
|
|
||||||
- return (_cups_strcasecmp(a->reg_name, b->reg_name));
|
|
||||||
+ if (!a->reg_name)
|
|
||||||
+ if (!b->reg_name)
|
|
||||||
+ return 0;
|
|
||||||
+ else
|
|
||||||
+ return -1;
|
|
||||||
+ else
|
|
||||||
+ if (!b->reg_name)
|
|
||||||
+ return 1;
|
|
||||||
+ else
|
|
||||||
+ return (_cups_strcasecmp(a->reg_name, b->reg_name));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -2489,6 +2612,10 @@ dnssdDeregisterPrinter(
|
|
||||||
{
|
{
|
||||||
cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdDeregisterPrinter(%s)", p->name);
|
cupsdLogMessage(CUPSD_LOG_DEBUG2, "dnssdDeregisterPrinter(%s)", p->name);
|
||||||
|
|
||||||
@ -428,7 +431,7 @@ index eb3c862..48dcef9 100644
|
|||||||
/*
|
/*
|
||||||
* Closing the socket deregisters the service
|
* Closing the socket deregisters the service
|
||||||
*/
|
*/
|
||||||
@@ -2524,6 +2651,24 @@ dnssdDeregisterPrinter(
|
@@ -2524,6 +2627,24 @@ dnssdDeregisterPrinter(
|
||||||
free(p->printer_txt);
|
free(p->printer_txt);
|
||||||
p->printer_txt = NULL;
|
p->printer_txt = NULL;
|
||||||
}
|
}
|
||||||
@ -453,7 +456,7 @@ index eb3c862..48dcef9 100644
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove the printer from the array of DNS-SD printers, then clear the
|
* Remove the printer from the array of DNS-SD printers, then clear the
|
||||||
@@ -2533,8 +2678,10 @@ dnssdDeregisterPrinter(
|
@@ -2533,8 +2654,10 @@ dnssdDeregisterPrinter(
|
||||||
cupsArrayRemove(DNSSDPrinters, p);
|
cupsArrayRemove(DNSSDPrinters, p);
|
||||||
cupsdClearString(&p->reg_name);
|
cupsdClearString(&p->reg_name);
|
||||||
}
|
}
|
||||||
@ -464,7 +467,7 @@ index eb3c862..48dcef9 100644
|
|||||||
/*
|
/*
|
||||||
* 'dnssdPackTxtRecord()' - Pack an array of key/value pairs into the
|
* 'dnssdPackTxtRecord()' - Pack an array of key/value pairs into the
|
||||||
* TXT record format.
|
* TXT record format.
|
||||||
@@ -2644,8 +2791,10 @@ dnssdRegisterCallback(
|
@@ -2644,8 +2767,10 @@ dnssdRegisterCallback(
|
||||||
LastEvent |= CUPSD_EVENT_PRINTER_MODIFIED;
|
LastEvent |= CUPSD_EVENT_PRINTER_MODIFIED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -475,7 +478,7 @@ index eb3c862..48dcef9 100644
|
|||||||
/*
|
/*
|
||||||
* 'dnssdRegisterPrinter()' - Start sending broadcast information for a printer
|
* 'dnssdRegisterPrinter()' - Start sending broadcast information for a printer
|
||||||
* or update the broadcast contents.
|
* or update the broadcast contents.
|
||||||
@@ -2654,20 +2803,40 @@ dnssdRegisterCallback(
|
@@ -2654,20 +2779,40 @@ dnssdRegisterCallback(
|
||||||
static void
|
static void
|
||||||
dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
|
dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
|
||||||
{
|
{
|
||||||
@ -519,7 +522,7 @@ index eb3c862..48dcef9 100644
|
|||||||
/*
|
/*
|
||||||
* If per-printer sharing was just disabled make sure we're not
|
* If per-printer sharing was just disabled make sure we're not
|
||||||
* registered before returning.
|
* registered before returning.
|
||||||
@@ -2686,12 +2855,36 @@ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
|
@@ -2686,12 +2831,36 @@ dnssdRegisterPrinter(cupsd_printer_t *p)
|
||||||
if (p->info && strlen(p->info) > 0)
|
if (p->info && strlen(p->info) > 0)
|
||||||
{
|
{
|
||||||
if (DNSSDComputerName)
|
if (DNSSDComputerName)
|
||||||
@ -558,7 +561,7 @@ index eb3c862..48dcef9 100644
|
|||||||
else
|
else
|
||||||
strlcpy(name, p->name, sizeof(name));
|
strlcpy(name, p->name, sizeof(name));
|
||||||
|
|
||||||
@@ -2712,6 +2905,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
|
@@ -2712,6 +2881,7 @@ dnssdRegisterPrinter(cupsd_printer_t *p)
|
||||||
* Register IPP and (optionally) LPD...
|
* Register IPP and (optionally) LPD...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -566,7 +569,7 @@ index eb3c862..48dcef9 100644
|
|||||||
ipp_len = 0; /* anti-compiler-warning-code */
|
ipp_len = 0; /* anti-compiler-warning-code */
|
||||||
ipp_txt = dnssdBuildTxtRecord(&ipp_len, p, 0);
|
ipp_txt = dnssdBuildTxtRecord(&ipp_len, p, 0);
|
||||||
|
|
||||||
@@ -2884,6 +3078,209 @@ dnssdRegisterPrinter(cupsd_printer_t *p)/* I - Printer */
|
@@ -2884,6 +3054,209 @@ dnssdRegisterPrinter(cupsd_printer_t *p)
|
||||||
|
|
||||||
if (printer_txt)
|
if (printer_txt)
|
||||||
free(printer_txt);
|
free(printer_txt);
|
||||||
@ -776,7 +779,7 @@ index eb3c862..48dcef9 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2896,6 +3293,10 @@ dnssdStop(void)
|
@@ -2896,6 +3269,10 @@ dnssdStop(void)
|
||||||
{
|
{
|
||||||
cupsd_printer_t *p; /* Current printer */
|
cupsd_printer_t *p; /* Current printer */
|
||||||
|
|
||||||
@ -787,7 +790,7 @@ index eb3c862..48dcef9 100644
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* De-register the individual printers
|
* De-register the individual printers
|
||||||
@@ -2906,6 +3307,7 @@ dnssdStop(void)
|
@@ -2906,6 +3283,7 @@ dnssdStop(void)
|
||||||
p = (cupsd_printer_t *)cupsArrayNext(Printers))
|
p = (cupsd_printer_t *)cupsArrayNext(Printers))
|
||||||
dnssdDeregisterPrinter(p);
|
dnssdDeregisterPrinter(p);
|
||||||
|
|
||||||
@ -795,7 +798,7 @@ index eb3c862..48dcef9 100644
|
|||||||
/*
|
/*
|
||||||
* Shutdown the rest of the service refs...
|
* Shutdown the rest of the service refs...
|
||||||
*/
|
*/
|
||||||
@@ -2926,14 +3328,17 @@ dnssdStop(void)
|
@@ -2926,14 +3304,17 @@ dnssdStop(void)
|
||||||
|
|
||||||
DNSServiceRefDeallocate(DNSSDRef);
|
DNSServiceRefDeallocate(DNSSDRef);
|
||||||
DNSSDRef = NULL;
|
DNSSDRef = NULL;
|
||||||
@ -813,7 +816,7 @@ index eb3c862..48dcef9 100644
|
|||||||
/*
|
/*
|
||||||
* 'dnssdUpdate()' - Handle DNS-SD queries.
|
* 'dnssdUpdate()' - Handle DNS-SD queries.
|
||||||
*/
|
*/
|
||||||
@@ -2955,6 +3360,147 @@ dnssdUpdate(void)
|
@@ -2955,6 +3336,147 @@ dnssdUpdate(void)
|
||||||
#endif /* HAVE_DNSSD */
|
#endif /* HAVE_DNSSD */
|
||||||
|
|
||||||
|
|
||||||
@ -961,10 +964,9 @@ index eb3c862..48dcef9 100644
|
|||||||
/*
|
/*
|
||||||
* 'get_auth_info_required()' - Get the auth-info-required value to advertise.
|
* 'get_auth_info_required()' - Get the auth-info-required value to advertise.
|
||||||
*/
|
*/
|
||||||
diff --git a/scheduler/dirsvc.h b/scheduler/dirsvc.h
|
diff -up cups-1.5.0/scheduler/dirsvc.h.avahi-5-services cups-1.5.0/scheduler/dirsvc.h
|
||||||
index 99079bd..d53a179 100644
|
--- cups-1.5.0/scheduler/dirsvc.h.avahi-5-services 2011-03-21 02:12:14.000000000 +0000
|
||||||
--- a/scheduler/dirsvc.h
|
+++ cups-1.5.0/scheduler/dirsvc.h 2011-10-11 11:36:13.587498153 +0100
|
||||||
+++ b/scheduler/dirsvc.h
|
|
||||||
@@ -31,6 +31,10 @@
|
@@ -31,6 +31,10 @@
|
||||||
# endif /* HAVE_LDAP_SSL_H */
|
# endif /* HAVE_LDAP_SSL_H */
|
||||||
#endif /* HAVE_LDAP */
|
#endif /* HAVE_LDAP */
|
||||||
@ -1020,7 +1022,7 @@ index 99079bd..d53a179 100644
|
|||||||
#ifdef HAVE_LIBSLP
|
#ifdef HAVE_LIBSLP
|
||||||
VAR SLPHandle BrowseSLPHandle VALUE(NULL);
|
VAR SLPHandle BrowseSLPHandle VALUE(NULL);
|
||||||
/* SLP API handle */
|
/* SLP API handle */
|
||||||
@@ -195,13 +213,14 @@ extern void cupsdRegisterPrinter(cupsd_printer_t *p);
|
@@ -195,13 +213,14 @@ extern void cupsdRegisterPrinter(cupsd_p
|
||||||
extern void cupsdRestartPolling(void);
|
extern void cupsdRestartPolling(void);
|
||||||
extern void cupsdSaveRemoteCache(void);
|
extern void cupsdSaveRemoteCache(void);
|
||||||
extern void cupsdSendBrowseList(void);
|
extern void cupsdSendBrowseList(void);
|
||||||
@ -1037,11 +1039,10 @@ index 99079bd..d53a179 100644
|
|||||||
#ifdef HAVE_LDAP
|
#ifdef HAVE_LDAP
|
||||||
extern void cupsdUpdateLDAPBrowse(void);
|
extern void cupsdUpdateLDAPBrowse(void);
|
||||||
#endif /* HAVE_LDAP */
|
#endif /* HAVE_LDAP */
|
||||||
diff --git a/scheduler/ipp.c b/scheduler/ipp.c
|
diff -up cups-1.5.0/scheduler/ipp.c.avahi-5-services cups-1.5.0/scheduler/ipp.c
|
||||||
index a048baa..9a3ab11 100644
|
--- cups-1.5.0/scheduler/ipp.c.avahi-5-services 2011-10-11 11:36:12.042526624 +0100
|
||||||
--- a/scheduler/ipp.c
|
+++ cups-1.5.0/scheduler/ipp.c 2011-10-11 11:36:13.596497987 +0100
|
||||||
+++ b/scheduler/ipp.c
|
@@ -6096,7 +6096,7 @@ copy_printer_attrs(
|
||||||
@@ -6087,7 +6087,7 @@ copy_printer_attrs(
|
|
||||||
ippAddDate(con->response, IPP_TAG_PRINTER, "printer-current-time",
|
ippAddDate(con->response, IPP_TAG_PRINTER, "printer-current-time",
|
||||||
ippTimeToDate(curtime));
|
ippTimeToDate(curtime));
|
||||||
|
|
||||||
@ -1050,7 +1051,7 @@ index a048baa..9a3ab11 100644
|
|||||||
if (!ra || cupsArrayFind(ra, "printer-dns-sd-name"))
|
if (!ra || cupsArrayFind(ra, "printer-dns-sd-name"))
|
||||||
{
|
{
|
||||||
if (printer->reg_name)
|
if (printer->reg_name)
|
||||||
@@ -6097,7 +6097,7 @@ copy_printer_attrs(
|
@@ -6106,7 +6106,7 @@ copy_printer_attrs(
|
||||||
ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_NOVALUE,
|
ippAddInteger(con->response, IPP_TAG_PRINTER, IPP_TAG_NOVALUE,
|
||||||
"printer-dns-sd-name", 0);
|
"printer-dns-sd-name", 0);
|
||||||
}
|
}
|
||||||
@ -1059,11 +1060,10 @@ index a048baa..9a3ab11 100644
|
|||||||
|
|
||||||
if (!ra || cupsArrayFind(ra, "printer-error-policy"))
|
if (!ra || cupsArrayFind(ra, "printer-error-policy"))
|
||||||
ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_NAME,
|
ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_NAME,
|
||||||
diff --git a/scheduler/main.c b/scheduler/main.c
|
diff -up cups-1.5.0/scheduler/main.c.avahi-5-services cups-1.5.0/scheduler/main.c
|
||||||
index 1e60572..6c210e6 100644
|
--- cups-1.5.0/scheduler/main.c.avahi-5-services 2011-10-11 11:36:12.186523971 +0100
|
||||||
--- a/scheduler/main.c
|
+++ cups-1.5.0/scheduler/main.c 2011-10-11 11:36:13.600497913 +0100
|
||||||
+++ b/scheduler/main.c
|
@@ -120,6 +120,10 @@ main(int argc, /* I - Number of comm
|
||||||
@@ -120,6 +120,10 @@ main(int argc, /* I - Number of command-line args */
|
|
||||||
cupsd_listener_t *lis; /* Current listener */
|
cupsd_listener_t *lis; /* Current listener */
|
||||||
time_t current_time, /* Current time */
|
time_t current_time, /* Current time */
|
||||||
activity, /* Client activity timer */
|
activity, /* Client activity timer */
|
||||||
@ -1074,7 +1074,7 @@ index 1e60572..6c210e6 100644
|
|||||||
browse_time, /* Next browse send time */
|
browse_time, /* Next browse send time */
|
||||||
senddoc_time, /* Send-Document time */
|
senddoc_time, /* Send-Document time */
|
||||||
expire_time, /* Subscription expire time */
|
expire_time, /* Subscription expire time */
|
||||||
@@ -662,6 +666,9 @@ main(int argc, /* I - Number of command-line args */
|
@@ -672,6 +676,9 @@ main(int argc, /* I - Number of comm
|
||||||
*/
|
*/
|
||||||
|
|
||||||
current_time = time(NULL);
|
current_time = time(NULL);
|
||||||
@ -1084,7 +1084,7 @@ index 1e60572..6c210e6 100644
|
|||||||
browse_time = current_time;
|
browse_time = current_time;
|
||||||
event_time = current_time;
|
event_time = current_time;
|
||||||
expire_time = current_time;
|
expire_time = current_time;
|
||||||
@@ -884,6 +891,16 @@ main(int argc, /* I - Number of command-line args */
|
@@ -894,6 +901,16 @@ main(int argc, /* I - Number of comm
|
||||||
tmo = cupsdNextTimeout (&tmo_delay);
|
tmo = cupsdNextTimeout (&tmo_delay);
|
||||||
if (tmo && tmo_delay == 0)
|
if (tmo && tmo_delay == 0)
|
||||||
cupsdRunTimeout (tmo);
|
cupsdRunTimeout (tmo);
|
||||||
@ -1101,10 +1101,9 @@ index 1e60572..6c210e6 100644
|
|||||||
#endif /* HAVE_AVAHI */
|
#endif /* HAVE_AVAHI */
|
||||||
|
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
diff --git a/scheduler/printers.c b/scheduler/printers.c
|
diff -up cups-1.5.0/scheduler/printers.c.avahi-5-services cups-1.5.0/scheduler/printers.c
|
||||||
index 4686c4c..fac7bbc 100644
|
--- cups-1.5.0/scheduler/printers.c.avahi-5-services 2011-10-11 11:36:11.958528172 +0100
|
||||||
--- a/scheduler/printers.c
|
+++ cups-1.5.0/scheduler/printers.c 2011-10-11 11:36:13.606497802 +0100
|
||||||
+++ b/scheduler/printers.c
|
|
||||||
@@ -883,9 +883,9 @@ cupsdDeletePrinter(
|
@@ -883,9 +883,9 @@ cupsdDeletePrinter(
|
||||||
cupsdClearString(&p->alert);
|
cupsdClearString(&p->alert);
|
||||||
cupsdClearString(&p->alert_description);
|
cupsdClearString(&p->alert_description);
|
||||||
@ -1117,7 +1116,7 @@ index 4686c4c..fac7bbc 100644
|
|||||||
|
|
||||||
cupsArrayDelete(p->filetypes);
|
cupsArrayDelete(p->filetypes);
|
||||||
|
|
||||||
@@ -3765,7 +3765,7 @@ add_printer_formats(cupsd_printer_t *p) /* I - Printer */
|
@@ -3787,7 +3787,7 @@ add_printer_formats(cupsd_printer_t *p)
|
||||||
attr->values[i].string.text = _cupsStrAlloc(mimetype);
|
attr->values[i].string.text = _cupsStrAlloc(mimetype);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1126,7 +1125,7 @@ index 4686c4c..fac7bbc 100644
|
|||||||
{
|
{
|
||||||
char pdl[1024]; /* Buffer to build pdl list */
|
char pdl[1024]; /* Buffer to build pdl list */
|
||||||
mime_filter_t *filter; /* MIME filter looping var */
|
mime_filter_t *filter; /* MIME filter looping var */
|
||||||
@@ -3821,7 +3821,7 @@ add_printer_formats(cupsd_printer_t *p) /* I - Printer */
|
@@ -3843,7 +3843,7 @@ add_printer_formats(cupsd_printer_t *p)
|
||||||
|
|
||||||
cupsdSetString(&p->pdl, pdl);
|
cupsdSetString(&p->pdl, pdl);
|
||||||
}
|
}
|
||||||
@ -1135,10 +1134,9 @@ index 4686c4c..fac7bbc 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
diff --git a/scheduler/printers.h b/scheduler/printers.h
|
diff -up cups-1.5.0/scheduler/printers.h.avahi-5-services cups-1.5.0/scheduler/printers.h
|
||||||
index 1751578..fb04651 100644
|
--- cups-1.5.0/scheduler/printers.h.avahi-5-services 2011-03-18 18:42:46.000000000 +0000
|
||||||
--- a/scheduler/printers.h
|
+++ cups-1.5.0/scheduler/printers.h 2011-10-11 11:36:13.609497747 +0100
|
||||||
+++ b/scheduler/printers.h
|
|
||||||
@@ -16,6 +16,9 @@
|
@@ -16,6 +16,9 @@
|
||||||
#ifdef HAVE_DNSSD
|
#ifdef HAVE_DNSSD
|
||||||
# include <dns_sd.h>
|
# include <dns_sd.h>
|
||||||
|
@ -647,6 +647,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Tue Oct 11 2011 Tim Waugh <twaugh@redhat.com> 1:1.5.0-16
|
* Tue Oct 11 2011 Tim Waugh <twaugh@redhat.com> 1:1.5.0-16
|
||||||
|
- Array handling fixes for DNSSDPrinters.
|
||||||
- Array handling fixes for Avahi poll implementation.
|
- Array handling fixes for Avahi poll implementation.
|
||||||
- Increase client blocking timeout from 30s to 70s (bug #744715).
|
- Increase client blocking timeout from 30s to 70s (bug #744715).
|
||||||
- Set BindIPv6Only=ipv6-only in systemd socket unit file as better fix
|
- Set BindIPv6Only=ipv6-only in systemd socket unit file as better fix
|
||||||
|
Loading…
Reference in New Issue
Block a user