From 986145ba52de0859f8dc89ea681b3945eac89a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Tue, 10 May 2011 15:48:25 +0200 Subject: [PATCH 1/4] s3-printing: very obvious fix for cups_pull_comment_location(). This has been in there since 2008... Guenther (cherry picked from commit 3ba3f68e03510e3bb5b7627c200af0395e853bc2) --- source3/printing/print_cups.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index 4c24e44..f06a797 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -1688,7 +1688,7 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer) } else { server = talloc_strdup(frame,cupsServer()); } - if (server) { + if (!server) { goto out; } if (!push_utf8_talloc(frame, &sharename, printer->sharename, &size)) { -- 1.7.4.4 From fb6cc34afdac4d4efcbc1e1cb85ce686102aa02d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Tue, 10 May 2011 15:49:05 +0200 Subject: [PATCH 2/4] s3-printing: Fix double free of cups request. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We never free the request in our cups api usage except for here. The reason is probably htis (from the cupsDoConnect API docs): "This function sends the IPP request to the specified server, retrying and authenticating as necessary. The request is freed with ippDelete() after receiving a valid IPP response." Revert "Fix a memory leak in cups_pull_comment_location" This reverts commit fee2664dad37536b05ce8bdae3e74d45b257f632. Autobuild-User: Günther Deschner Autobuild-Date: Tue May 10 17:32:58 CEST 2011 on sn-devel-104 (cherry picked from commit 019f11dd5b3240d05c1abe30dec3d793d6919313) --- source3/printing/print_cups.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-) diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index f06a797..b41cd34 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -1796,10 +1796,6 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer) if (response) ippDelete(response); - if (request) { - ippDelete(request); - } - if (language) cupsLangFree(language); -- 1.7.4.4 From 2d56efff2e82450e6c626dc270a06d5d4c15f402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Deschner?= Date: Wed, 11 May 2011 10:30:42 +0200 Subject: [PATCH 3/4] s3-printing: make cups_pull_comment_location() work again. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit we deal with lp_cups_server in cups_connect() already, inside the URI all our other cups functions we use ipp://localhost, do the same here. Guenther Autobuild-User: Günther Deschner Autobuild-Date: Wed May 11 11:36:07 CEST 2011 on sn-devel-104 --- source3/printing/print_cups.c | 15 ++------------- 1 files changed, 2 insertions(+), 13 deletions(-) diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index b41cd34..6e8cc12 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -1640,7 +1640,6 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer) ipp_attribute_t *attr; /* Current attribute */ cups_lang_t *language = NULL; /* Default language */ char uri[HTTP_MAX_URI]; - char *server = NULL; char *sharename = NULL; char *name = NULL; static const char *requested[] =/* Requested attributes */ @@ -1681,21 +1680,11 @@ bool cups_pull_comment_location(NT_PRINTER_INFO_LEVEL_2 *printer) ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_LANGUAGE, "attributes-natural-language", NULL, language->language); - if (lp_cups_server() != NULL && strlen(lp_cups_server()) > 0) { - if (!push_utf8_talloc(frame, &server, lp_cups_server(), &size)) { - goto out; - } - } else { - server = talloc_strdup(frame,cupsServer()); - } - if (!server) { - goto out; - } if (!push_utf8_talloc(frame, &sharename, printer->sharename, &size)) { goto out; } - slprintf(uri, sizeof(uri) - 1, "ipp://%s/printers/%s", - server, sharename); + slprintf(uri, sizeof(uri) - 1, "ipp://localhost/printers/%s", + sharename); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri); -- 1.7.4.4