113-cups-remote-printing.diff [plain text]
--- samba/source/printing/print_cups.c.orig Thu Dec 18 14:01:21 2003
+++ samba/source/printing/print_cups.c Fri Dec 19 08:31:21 2003
@@ -82,11 +82,13 @@ void cups_printer_fn(void (*fn)(char *,
char *name, /* printer-name attribute */
*make_model, /* printer-make-and-model attribute */
*info; /* printer-info attribute */
+ int remote; /* filter out remote printers and classes */
static const char *requested[] =/* Requested attributes */
{
"printer-name",
"printer-make-and-model",
- "printer-info"
+ "printer-info",
+ "printer-type"
};
@@ -167,6 +169,7 @@ void cups_printer_fn(void (*fn)(char *,
name = NULL;
make_model = NULL;
info = NULL;
+ remote = 0;
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
{
@@ -182,6 +185,10 @@ void cups_printer_fn(void (*fn)(char *,
attr->value_tag == IPP_TAG_TEXT)
info = attr->values[0].string.text;
+ if (strcmp(attr->name, "printer-type") == 0 &&
+ attr->value_tag == IPP_TAG_ENUM)
+ remote = attr->values[0].integer & CUPS_PRINTER_REMOTE;
+
attr = attr->next;
}
@@ -190,7 +197,10 @@ void cups_printer_fn(void (*fn)(char *,
*/
if (name == NULL)
- break;
+ continue;
+
+ if (remote != 0)
+ continue;
if (info == NULL || !info[0])
(*fn)(name, make_model);
@@ -261,6 +271,8 @@ void cups_printer_fn(void (*fn)(char *,
name = NULL;
make_model = NULL;
info = NULL;
+ remote = 0;
+
while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
{
@@ -276,6 +288,10 @@ void cups_printer_fn(void (*fn)(char *,
attr->value_tag == IPP_TAG_TEXT)
info = attr->values[0].string.text;
+ if (strcmp(attr->name, "printer-type") == 0 &&
+ attr->value_tag == IPP_TAG_ENUM)
+ remote = attr->values[0].integer & CUPS_PRINTER_REMOTE;
+
attr = attr->next;
}
@@ -284,7 +300,10 @@ void cups_printer_fn(void (*fn)(char *,
*/
if (name == NULL)
- break;
+ continue;
+
+ if (remote != 0)
+ continue;
if (info == NULL || !info[0])
(*fn)(name, make_model);