On 2012/08/30 10:19, Brad Smith wrote: > On Tue, Aug 14, 2012 at 01:32:04PM +1000, Ian McWilliam wrote: > > Take 2 - forgot to cvs add. Doh! > > > > An update for samba to version 3.6.7 for current. > > > > As usual lots of bug fixes. > > > > http://www.samba.org/samba/history/samba-3.6.7.html > > > > Major enhancements in Samba 3.6.7 include: > > > > Fix resolving our own "Domain Local" groups (bug #9052). > > Fix migrating printers while upgrading from 3.5.x (bug #9026). > > > > Make sure you apply the diff with > > > > patch -E > > > > 2 patches removed, 1 added. > > > > Ian McWilliam > > The issue with the build and which MD5 implementation to use has been > resolved. Please take a look at bug report 9037.. > https://bugzilla.samba.org/show_bug.cgi?id=9037 > and take the two diffs mentioned there and apply them to the port instead > of the header hack there now.
ports diff looks like this (hasn't finished building yet) Index: Makefile =================================================================== RCS file: /cvs/ports/net/samba/Makefile,v retrieving revision 1.169 diff -u -p -r1.169 Makefile --- Makefile 25 Aug 2012 10:14:37 -0000 1.169 +++ Makefile 30 Aug 2012 14:53:39 -0000 @@ -5,9 +5,8 @@ SHARED_ONLY= Yes COMMENT-main= SMB and CIFS client and server for UNIX COMMENT-docs= additional documentation and examples for Samba -DISTNAME= samba-3.6.6 +DISTNAME= samba-3.6.7 PKGNAME-main= ${DISTNAME} -REVISION-main= 3 FULLPKGNAME-docs= ${DISTNAME:S/-/-docs-/} FULLPKGPATH-docs= net/samba,-docs Index: distinfo =================================================================== RCS file: /cvs/ports/net/samba/distinfo,v retrieving revision 1.32 diff -u -p -r1.32 distinfo --- distinfo 27 Jun 2012 07:29:17 -0000 1.32 +++ distinfo 30 Aug 2012 14:53:39 -0000 @@ -1,5 +1,2 @@ -MD5 (samba-3.6.6.tar.gz) = C+pShC0XIjHAwOI+5XDXrw== -RMD160 (samba-3.6.6.tar.gz) = cKUgASocAghfDWIJwqyshFEtn4s= -SHA1 (samba-3.6.6.tar.gz) = 8VFs4zL+EcaKBShV7ddFNorE2Ok= -SHA256 (samba-3.6.6.tar.gz) = Z2hfK633RRywatYFNHhAcpR8OoReTQr+xat4F/LukxA= -SIZE (samba-3.6.6.tar.gz) = 34061741 +SHA256 (samba-3.6.7.tar.gz) = uFig8BG6f+VUiBucfmyxyct/rOIu2Ghg9WD8rsxO1Mo= +SIZE (samba-3.6.7.tar.gz) = 34067900 Index: patches/patch-source3_configure_in =================================================================== RCS file: /cvs/ports/net/samba/patches/patch-source3_configure_in,v retrieving revision 1.3 diff -u -p -r1.3 patch-source3_configure_in --- patches/patch-source3_configure_in 27 Jun 2012 07:29:17 -0000 1.3 +++ patches/patch-source3_configure_in 30 Aug 2012 14:53:39 -0000 @@ -1,7 +1,55 @@ $OpenBSD: patch-source3_configure_in,v 1.3 2012/06/27 07:29:17 sthen Exp $ ---- source3/configure.in.orig Mon Jun 25 03:21:16 2012 -+++ source3/configure.in Tue Jun 26 12:01:27 2012 -@@ -834,9 +834,15 @@ if test x$enable_cups != xno; then +--- source3/configure.in.orig Thu Aug 30 15:48:05 2012 ++++ source3/configure.in Thu Aug 30 15:48:02 2012 +@@ -753,23 +753,38 @@ AC_CHECK_HEADERS(linux/falloc.h) + + dnl check for OS implementation of md5 conformant to rfc1321 + AC_CHECK_HEADERS(md5.h) ++ ++samba_cv_md5lib=none ++ + if test x"$ac_cv_header_md5_h" = x"yes"; then + AC_DEFINE(HAVE_MD5_H, 1, + [Whether md5.h is available.]) +- AC_CHECK_LIB(md5, MD5Update, +- [ +- LIBS="${LIBS} -lmd5" +- CRYPTO_MD5_OBJ= +- AC_DEFINE(HAVE_LIBMD5, 1, +- [Whether libmd5 conformant to rfc1321 is available.])], +- [ +- CRYPTO_MD5_OBJ="../lib/crypto/md5.o"]) ++ AC_CHECK_LIB(md5, MD5Update, [samba_cv_md5lib=md5]) ++fi ++ ++if test x"$ac_cv_header_md5_h" = x"yes" -a \ ++ x"$samba_cv_md5lib" = x"none" ; then ++ AC_CHECK_LIB(md, MD5Update, [samba_cv_md5lib=md]) ++fi ++ ++if test x"$ac_cv_header_md5_h" = x"yes" -a \ ++ x"$samba_cv_md5lib" = x"none" ; then ++ AC_CHECK_LIB(c, MD5Update, [samba_cv_md5lib=""]) ++fi ++ ++if test x"$samba_cv_md5lib" != x"none" ; then ++ if test x"$samba_cv_md5lib" != x ; then ++ LIBS="${LIBS} -l${samba_cv_md5lib}" ++ fi ++ CRYPTO_MD5_OBJ= ++ AC_DEFINE(HAVE_LIBMD5, 1, ++ [Whether libmd5 conformant to rfc1321 is available.]) + else + CRYPTO_MD5_OBJ="../lib/crypto/md5.o" + fi ++ + AC_SUBST(CRYPTO_MD5_OBJ) + +- + AC_CHECK_HEADERS(rpcsvc/yp_prot.h,,,[[ + #if HAVE_RPC_RPC_H + #include <rpc/rpc.h> +@@ -853,9 +868,15 @@ if test x$enable_cups != xno; then if test "x$CUPS_CONFIG" != x; then @@ -17,7 +65,7 @@ $OpenBSD: patch-source3_configure_in,v 1 if test x"$ac_cv_header_cups_cups_h" = xyes -a \ x"$ac_cv_header_cups_language_h" = xyes; then -@@ -844,18 +850,19 @@ if test x$enable_cups != xno; then +@@ -863,18 +884,19 @@ if test x$enable_cups != xno; then # underlinked. With cups-config --libs we pull in unwanted and unneeded # dendencies including thread libraries - use cups-config only if really # required. @@ -41,7 +89,7 @@ $OpenBSD: patch-source3_configure_in,v 1 PRINT_LIBS=$ac_save_PRINT_LIBS fi -@@ -1640,8 +1647,7 @@ DSO_EXPORTS="" +@@ -1659,8 +1681,7 @@ DSO_EXPORTS="" ;; *openbsd*) BLDSHARED="true" LDSHFLAGS="-shared" @@ -51,7 +99,7 @@ $OpenBSD: patch-source3_configure_in,v 1 PICFLAG="-fPIC" AC_DEFINE(STAT_ST_BLOCKSIZE,512,[The size of a block]) AC_DEFINE(BROKEN_GETGRNAM,1,[Does getgrnam work correctly]) -@@ -6750,13 +6756,43 @@ fi +@@ -6769,13 +6790,43 @@ fi CFLAGS=$CFLAGS_SAVE Index: patches/patch-source3_printing_print_cups_c =================================================================== RCS file: patches/patch-source3_printing_print_cups_c diff -N patches/patch-source3_printing_print_cups_c --- patches/patch-source3_printing_print_cups_c 4 Aug 2012 14:45:34 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,433 +0,0 @@ -$OpenBSD: patch-source3_printing_print_cups_c,v 1.1 2012/08/04 14:45:34 ajacoutot Exp $ - -https://bugzilla.samba.org/show_bug.cgi?id=9055 - ---- source3/printing/print_cups.c.orig Sun Jun 24 19:21:16 2012 -+++ source3/printing/print_cups.c Sat Jul 28 11:11:22 2012 -@@ -31,6 +31,47 @@ - #include <cups/cups.h> - #include <cups/language.h> - -+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) -+#define HAVE_CUPS_1_6 1 -+#endif -+ -+#ifndef HAVE_CUPS_1_6 -+#define ippGetGroupTag(attr) attr->group_tag -+#define ippGetName(attr) attr->name -+#define ippGetValueTag(attr) attr->value_tag -+#define ippGetStatusCode(ipp) ipp->request.status.status_code -+#define ippGetInteger(attr, element) attr->values[element].integer -+#define ippGetString(attr, element, language) attr->values[element].string.text -+ -+static ipp_attribute_t * -+ippFirstAttribute(ipp_t *ipp) -+{ -+ if (!ipp) -+ return (NULL); -+ return (ipp->current = ipp->attrs); -+} -+ -+static ipp_attribute_t * -+ippNextAttribute(ipp_t *ipp) -+{ -+ if (!ipp || !ipp->current) -+ return (NULL); -+ return (ipp->current = ipp->current->next); -+} -+ -+static int ippSetOperation(ipp_t *ipp, ipp_op_t op) -+{ -+ ipp->request.op.operation_id = op; -+ return (1); -+} -+ -+static int ippSetRequestId(ipp_t *ipp, int request_id) -+{ -+ ipp->request.any.request_id = request_id; -+ return (1); -+} -+#endif -+ - static SIG_ATOMIC_T gotalarm; - - /*************************************************************** -@@ -167,13 +208,13 @@ static bool process_cups_printers_response(TALLOC_CTX - struct pcap_printer *printer; - bool ret_ok = false; - -- for (attr = response->attrs; attr != NULL;) { -+ for (attr = ippFirstAttribute(response); attr != NULL;) { - /* - * Skip leading attributes until we hit a printer... - */ - -- while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER) -- attr = attr->next; -+ while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_PRINTER) -+ attr = ippNextAttribute(response); - - if (attr == NULL) - break; -@@ -185,39 +226,39 @@ static bool process_cups_printers_response(TALLOC_CTX - name = NULL; - info = NULL; - -- while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) { -+ while (attr != NULL && ippGetGroupTag(attr) == IPP_TAG_PRINTER) { - size_t size; -- if (strcmp(attr->name, "printer-name") == 0 && -- attr->value_tag == IPP_TAG_NAME) { -+ if (strcmp(ippGetName(attr), "printer-name") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_NAME) { - if (!pull_utf8_talloc(mem_ctx, - &name, -- attr->values[0].string.text, -+ ippGetString(attr, 0, NULL), - &size)) { - goto err_out; - } - } - -- if (strcmp(attr->name, "printer-info") == 0 && -- attr->value_tag == IPP_TAG_TEXT) { -+ if (strcmp(ippGetName(attr), "printer-info") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_TEXT) { - if (!pull_utf8_talloc(mem_ctx, - &info, -- attr->values[0].string.text, -+ ippGetString(attr, 0, NULL), - &size)) { - goto err_out; - } - } - -- if (strcmp(attr->name, "printer-location") == 0 && -- attr->value_tag == IPP_TAG_TEXT) { -+ if (strcmp(ippGetName(attr), "printer-location") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_TEXT) { - if (!pull_utf8_talloc(mem_ctx, - &location, -- attr->values[0].string.text, -+ ippGetString(attr, 0, NULL), - &size)) { - goto err_out; - } - } - -- attr = attr->next; -+ attr = ippNextAttribute(response); - } - - /* -@@ -297,8 +338,8 @@ static bool cups_cache_reload_async(int fd) - - request = ippNew(); - -- request->request.op.operation_id = CUPS_GET_PRINTERS; -- request->request.op.request_id = 1; -+ ippSetOperation(request, CUPS_GET_PRINTERS); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -339,8 +380,8 @@ static bool cups_cache_reload_async(int fd) - - request = ippNew(); - -- request->request.op.operation_id = CUPS_GET_CLASSES; -- request->request.op.request_id = 1; -+ ippSetOperation(request, CUPS_GET_CLASSES); -+ ippSetRequestId(request, 1); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, "utf-8"); -@@ -603,8 +644,8 @@ static int cups_job_delete(const char *sharename, cons - - request = ippNew(); - -- request->request.op.operation_id = IPP_CANCEL_JOB; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_CANCEL_JOB); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -630,7 +671,7 @@ static int cups_job_delete(const char *sharename, cons - */ - - if ((response = cupsDoRequest(http, request, "/jobs")) != NULL) { -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to cancel job %d - %s\n", pjob->sysjob, - ippErrorString(cupsLastError()))); - } else { -@@ -700,8 +741,8 @@ static int cups_job_pause(int snum, struct printjob *p - - request = ippNew(); - -- request->request.op.operation_id = IPP_HOLD_JOB; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_HOLD_JOB); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -726,7 +767,7 @@ static int cups_job_pause(int snum, struct printjob *p - */ - - if ((response = cupsDoRequest(http, request, "/jobs")) != NULL) { -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to hold job %d - %s\n", pjob->sysjob, - ippErrorString(cupsLastError()))); - } else { -@@ -796,8 +837,8 @@ static int cups_job_resume(int snum, struct printjob * - - request = ippNew(); - -- request->request.op.operation_id = IPP_RELEASE_JOB; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_RELEASE_JOB); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -822,7 +863,7 @@ static int cups_job_resume(int snum, struct printjob * - */ - - if ((response = cupsDoRequest(http, request, "/jobs")) != NULL) { -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to release job %d - %s\n", pjob->sysjob, - ippErrorString(cupsLastError()))); - } else { -@@ -902,8 +943,8 @@ static int cups_job_submit(int snum, struct printjob * - - request = ippNew(); - -- request->request.op.operation_id = IPP_PRINT_JOB; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_PRINT_JOB); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -979,7 +1020,7 @@ static int cups_job_submit(int snum, struct printjob * - goto out; - } - if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) { -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to print file to %s - %s\n", - lp_printername(snum), - ippErrorString(cupsLastError()))); -@@ -987,7 +1028,7 @@ static int cups_job_submit(int snum, struct printjob * - ret = 0; - attr_job_id = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER); - if(attr_job_id) { -- pjob->sysjob = attr_job_id->values[0].integer; -+ pjob->sysjob = ippGetInteger(attr_job_id, 0); - DEBUG(5,("cups_job_submit: job-id %d\n", pjob->sysjob)); - } else { - DEBUG(0,("Missing job-id attribute in IPP response")); -@@ -1109,8 +1150,8 @@ static int cups_queue_get(const char *sharename, - - request = ippNew(); - -- request->request.op.operation_id = IPP_GET_JOBS; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_GET_JOBS); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -1138,9 +1179,9 @@ static int cups_queue_get(const char *sharename, - goto out; - } - -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to get jobs for %s - %s\n", uri, -- ippErrorString(response->request.status.status_code))); -+ ippErrorString(ippGetStatusCode(response)))); - goto out; - } - -@@ -1152,13 +1193,13 @@ static int cups_queue_get(const char *sharename, - qalloc = 0; - queue = NULL; - -- for (attr = response->attrs; attr != NULL; attr = attr->next) { -+ for (attr = ippFirstAttribute(response); attr != NULL; attr = ippNextAttribute(response)) { - /* - * Skip leading attributes until we hit a job... - */ - -- while (attr != NULL && attr->group_tag != IPP_TAG_JOB) -- attr = attr->next; -+ while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_JOB) -+ attr = ippNextAttribute(response); - - if (attr == NULL) - break; -@@ -1193,53 +1234,53 @@ static int cups_queue_get(const char *sharename, - user_name = NULL; - job_name = NULL; - -- while (attr != NULL && attr->group_tag == IPP_TAG_JOB) { -- if (attr->name == NULL) { -- attr = attr->next; -+ while (attr != NULL && ippGetGroupTag(attr) == IPP_TAG_JOB) { -+ if (ippGetName(attr) == NULL) { -+ attr = ippNextAttribute(response); - break; - } - -- if (strcmp(attr->name, "job-id") == 0 && -- attr->value_tag == IPP_TAG_INTEGER) -- job_id = attr->values[0].integer; -+ if (strcmp(ippGetName(attr), "job-id") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_INTEGER) -+ job_id = ippGetInteger(attr, 0); - -- if (strcmp(attr->name, "job-k-octets") == 0 && -- attr->value_tag == IPP_TAG_INTEGER) -- job_k_octets = attr->values[0].integer; -+ if (strcmp(ippGetName(attr), "job-k-octets") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_INTEGER) -+ job_k_octets = ippGetInteger(attr, 0); - -- if (strcmp(attr->name, "job-priority") == 0 && -- attr->value_tag == IPP_TAG_INTEGER) -- job_priority = attr->values[0].integer; -+ if (strcmp(ippGetName(attr), "job-priority") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_INTEGER) -+ job_priority = ippGetInteger(attr, 0); - -- if (strcmp(attr->name, "job-state") == 0 && -- attr->value_tag == IPP_TAG_ENUM) -- job_status = (ipp_jstate_t)(attr->values[0].integer); -+ if (strcmp(ippGetName(attr), "job-state") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_ENUM) -+ job_status = (ipp_jstate_t)ippGetInteger(attr, 0); - -- if (strcmp(attr->name, "time-at-creation") == 0 && -- attr->value_tag == IPP_TAG_INTEGER) -- job_time = attr->values[0].integer; -+ if (strcmp(ippGetName(attr), "time-at-creation") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_INTEGER) -+ job_time = ippGetInteger(attr, 0); - -- if (strcmp(attr->name, "job-name") == 0 && -- attr->value_tag == IPP_TAG_NAME) { -+ if (strcmp(ippGetName(attr), "job-name") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_NAME) { - if (!pull_utf8_talloc(frame, - &job_name, -- attr->values[0].string.text, -+ ippGetString(attr, 0, NULL), - &size)) { - goto out; - } - } - -- if (strcmp(attr->name, "job-originating-user-name") == 0 && -- attr->value_tag == IPP_TAG_NAME) { -+ if (strcmp(ippGetName(attr), "job-originating-user-name") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_NAME) { - if (!pull_utf8_talloc(frame, - &user_name, -- attr->values[0].string.text, -+ ippGetString(attr, 0, NULL), - &size)) { - goto out; - } - } - -- attr = attr->next; -+ attr = ippNextAttribute(response); - } - - /* -@@ -1285,8 +1326,8 @@ static int cups_queue_get(const char *sharename, - - request = ippNew(); - -- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES); -+ ippSetRequestId(request, 1); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, "utf-8"); -@@ -1312,9 +1353,9 @@ static int cups_queue_get(const char *sharename, - goto out; - } - -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to get printer status for %s - %s\n", printername, -- ippErrorString(response->request.status.status_code))); -+ ippErrorString(ippGetStatusCode(response)))); - goto out; - } - -@@ -1323,7 +1364,7 @@ static int cups_queue_get(const char *sharename, - */ - - if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL) { -- if (attr->values[0].integer == IPP_PRINTER_STOPPED) -+ if (ippGetInteger(attr, 0) == IPP_PRINTER_STOPPED) - status->status = LPSTAT_STOPPED; - else - status->status = LPSTAT_OK; -@@ -1333,7 +1374,7 @@ static int cups_queue_get(const char *sharename, - IPP_TAG_TEXT)) != NULL) { - char *msg = NULL; - if (!pull_utf8_talloc(frame, &msg, -- attr->values[0].string.text, -+ ippGetString(attr, 0, NULL), - &size)) { - SAFE_FREE(queue); - qcount = 0; -@@ -1409,8 +1450,8 @@ static int cups_queue_pause(int snum) - - request = ippNew(); - -- request->request.op.operation_id = IPP_PAUSE_PRINTER; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_PAUSE_PRINTER); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -1440,7 +1481,7 @@ static int cups_queue_pause(int snum) - */ - - if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) { -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to pause printer %s - %s\n", - lp_printername(snum), - ippErrorString(cupsLastError()))); -@@ -1513,8 +1554,8 @@ static int cups_queue_resume(int snum) - - request = ippNew(); - -- request->request.op.operation_id = IPP_RESUME_PRINTER; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_RESUME_PRINTER); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -1544,7 +1585,7 @@ static int cups_queue_resume(int snum) - */ - - if ((response = cupsDoRequest(http, request, "/admin/")) != NULL) { -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to resume printer %s - %s\n", - lp_printername(snum), - ippErrorString(cupsLastError()))); Index: patches/patch-source3_printing_print_iprint_c =================================================================== RCS file: patches/patch-source3_printing_print_iprint_c diff -N patches/patch-source3_printing_print_iprint_c --- patches/patch-source3_printing_print_iprint_c 4 Aug 2012 14:45:34 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,517 +0,0 @@ -$OpenBSD: patch-source3_printing_print_iprint_c,v 1.1 2012/08/04 14:45:34 ajacoutot Exp $ - -https://bugzilla.samba.org/show_bug.cgi?id=9055 - ---- source3/printing/print_iprint.c.orig Sun Jun 24 19:21:16 2012 -+++ source3/printing/print_iprint.c Sat Jul 28 11:11:22 2012 -@@ -34,6 +34,49 @@ - #define NOVELL_SERVER_VERSION_STRING "iprintserverversion=" - #define NOVELL_SERVER_VERSION_OES_SP1 33554432 - -+#if (CUPS_VERSION_MAJOR > 1) || (CUPS_VERSION_MINOR > 5) -+#define HAVE_CUPS_1_6 1 -+#endif -+ -+#ifndef HAVE_CUPS_1_6 -+#define ippGetCount(attr) attr->num_values -+#define ippGetGroupTag(attr) attr->group_tag -+#define ippGetName(attr) attr->name -+#define ippGetValueTag(attr) attr->value_tag -+#define ippGetStatusCode(ipp) ipp->request.status.status_code -+#define ippGetBoolean(attr, element) attr->values[element].boolean -+#define ippGetInteger(attr, element) attr->values[element].integer -+#define ippGetString(attr, element, language) attr->values[element].string.text -+ -+static ipp_attribute_t * -+ippFirstAttribute(ipp_t *ipp) -+{ -+ if (!ipp) -+ return (NULL); -+ return (ipp->current = ipp->attrs); -+} -+ -+static ipp_attribute_t * -+ippNextAttribute(ipp_t *ipp) -+{ -+ if (!ipp || !ipp->current) -+ return (NULL); -+ return (ipp->current = ipp->current->next); -+} -+ -+static int ippSetOperation(ipp_t *ipp, ipp_op_t op) -+{ -+ ipp->request.op.operation_id = op; -+ return (1); -+} -+ -+static int ippSetRequestId(ipp_t *ipp, int request_id) -+{ -+ ipp->request.any.request_id = request_id; -+ return (1); -+} -+#endif -+ - /* - * 'iprint_passwd_cb()' - The iPrint password callback... - */ -@@ -92,8 +135,8 @@ static int iprint_get_server_version(http_t *http, cha - - request = ippNew(); - -- request->request.op.operation_id = (ipp_op_t)OPERATION_NOVELL_MGMT; -- request->request.op.request_id = 1; -+ ippSetOperation(request, (ipp_op_t)OPERATION_NOVELL_MGMT); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -114,12 +157,12 @@ static int iprint_get_server_version(http_t *http, cha - */ - - if (((response = cupsDoRequest(http, request, "/ipp/")) == NULL) || -- (response->request.status.status_code >= IPP_OK_CONFLICT)) -+ (ippGetStatusCode(response) >= IPP_OK_CONFLICT)) - goto out; - - if (((attr = ippFindAttribute(response, "server-version", - IPP_TAG_STRING)) != NULL)) { -- if ((ver = strstr(attr->values[0].string.text, -+ if ((ver = strstr(ippGetString(attr, 0, NULL), - NOVELL_SERVER_VERSION_STRING)) != NULL) { - ver += strlen(NOVELL_SERVER_VERSION_STRING); - /* -@@ -135,7 +178,7 @@ static int iprint_get_server_version(http_t *http, cha - serverVersion = 0; - } - -- if ((os = strstr(attr->values[0].string.text, -+ if ((os = strstr(ippGetString(attr, 0, NULL), - NOVELL_SERVER_SYSNAME)) != NULL) { - os += strlen(NOVELL_SERVER_SYSNAME); - if ((temp = strchr(os,'<')) != NULL) -@@ -184,8 +227,8 @@ static int iprint_cache_add_printer(http_t *http, - - request = ippNew(); - -- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; -- request->request.op.request_id = reqId; -+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES); -+ ippSetRequestId(request, reqId); - - language = cupsLangDefault(); - -@@ -230,13 +273,13 @@ static int iprint_cache_add_printer(http_t *http, - goto out; - } - -- for (attr = response->attrs; attr != NULL;) { -+ for (attr = ippFirstAttribute(response); attr != NULL;) { - /* - * Skip leading attributes until we hit a printer... - */ - -- while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER) -- attr = attr->next; -+ while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_PRINTER) -+ attr = ippNextAttribute(response); - - if (attr == NULL) - break; -@@ -250,15 +293,15 @@ static int iprint_cache_add_printer(http_t *http, - smb_enabled= 1; - secure = 0; - -- while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) { -- if (strcmp(attr->name, "printer-name") == 0 && -- attr->value_tag == IPP_TAG_NAME) -- name = attr->values[0].string.text; -+ while (attr != NULL && ippGetGroupTag(attr) == IPP_TAG_PRINTER) { -+ if (strcmp(ippGetName(attr), "printer-name") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_NAME) -+ name = ippGetString(attr, 0, NULL); - -- if (strcmp(attr->name, "printer-info") == 0 && -- (attr->value_tag == IPP_TAG_TEXT || -- attr->value_tag == IPP_TAG_TEXTLANG)) -- info = attr->values[0].string.text; -+ if (strcmp(ippGetName(attr), "printer-info") == 0 && -+ (ippGetValueTag(attr) == IPP_TAG_TEXT || -+ ippGetValueTag(attr) == IPP_TAG_TEXTLANG)) -+ info = ippGetString(attr, 0, NULL); - - /* - * If the smb-enabled attribute is present and the -@@ -266,11 +309,11 @@ static int iprint_cache_add_printer(http_t *http, - * If the attribute is not present, assume that the - * printer should show up - */ -- if (!strcmp(attr->name, "smb-enabled") && -- ((attr->value_tag == IPP_TAG_INTEGER && -- !attr->values[0].integer) || -- (attr->value_tag == IPP_TAG_BOOLEAN && -- !attr->values[0].boolean))) -+ if (!strcmp(ippGetName(attr), "smb-enabled") && -+ ((ippGetValueTag(attr) == IPP_TAG_INTEGER && -+ !ippGetInteger(attr, 0)) || -+ (ippGetValueTag(attr) == IPP_TAG_BOOLEAN && -+ !ippGetBoolean(attr, 0)))) - smb_enabled = 0; - - /* -@@ -279,14 +322,14 @@ static int iprint_cache_add_printer(http_t *http, - * If the attribute is not present, assume that the - * printer should show up - */ -- if (!strcmp(attr->name, "security-enabled") && -- ((attr->value_tag == IPP_TAG_INTEGER && -- attr->values[0].integer) || -- (attr->value_tag == IPP_TAG_BOOLEAN && -- attr->values[0].boolean))) -+ if (!strcmp(ippGetName(attr), "security-enabled") && -+ ((ippGetValueTag(attr) == IPP_TAG_INTEGER && -+ ippGetInteger(attr, 0)) || -+ (ippGetValueTag(attr) == IPP_TAG_BOOLEAN && -+ ippGetBoolean(attr, 0)))) - secure = 1; - -- attr = attr->next; -+ attr = ippNextAttribute(response); - } - - /* -@@ -343,9 +386,8 @@ bool iprint_cache_reload(void) - - request = ippNew(); - -- request->request.op.operation_id = -- (ipp_op_t)OPERATION_NOVELL_LIST_PRINTERS; -- request->request.op.request_id = 1; -+ ippSetOperation(request, (ipp_op_t)OPERATION_NOVELL_LIST_PRINTERS); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -368,13 +410,13 @@ bool iprint_cache_reload(void) - goto out; - } - -- for (attr = response->attrs; attr != NULL;) { -+ for (attr = ippFirstAttribute(response); attr != NULL;) { - /* - * Skip leading attributes until we hit a printer... - */ - -- while (attr != NULL && attr->group_tag != IPP_TAG_PRINTER) -- attr = attr->next; -+ while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_PRINTER) -+ attr = ippNextAttribute(response); - - if (attr == NULL) - break; -@@ -383,24 +425,24 @@ bool iprint_cache_reload(void) - * Pull the needed attributes from this printer... - */ - -- while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER) -+ while (attr != NULL && ippGetGroupTag(attr) == IPP_TAG_PRINTER) - { -- if (strcmp(attr->name, "printer-name") == 0 && -- (attr->value_tag == IPP_TAG_URI || -- attr->value_tag == IPP_TAG_NAME || -- attr->value_tag == IPP_TAG_TEXT || -- attr->value_tag == IPP_TAG_NAMELANG || -- attr->value_tag == IPP_TAG_TEXTLANG)) -+ if (strcmp(ippGetName(attr), "printer-name") == 0 && -+ (ippGetValueTag(attr) == IPP_TAG_URI || -+ ippGetValueTag(attr) == IPP_TAG_NAME || -+ ippGetValueTag(attr) == IPP_TAG_TEXT || -+ ippGetValueTag(attr) == IPP_TAG_NAMELANG || -+ ippGetValueTag(attr) == IPP_TAG_TEXTLANG)) - { -- for (i = 0; i<attr->num_values; i++) -+ for (i = 0; i<ippGetCount(attr); i++) - { -- char *url = attr->values[i].string.text; -+ char *url = ippGetString(attr, i, NULL); - if (!url || !strlen(url)) - continue; - iprint_cache_add_printer(http, i+2, url); - } - } -- attr = attr->next; -+ attr = ippNextAttribute(response); - } - } - -@@ -466,8 +508,8 @@ static int iprint_job_delete(const char *sharename, co - - request = ippNew(); - -- request->request.op.operation_id = IPP_CANCEL_JOB; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_CANCEL_JOB); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -493,7 +535,7 @@ static int iprint_job_delete(const char *sharename, co - slprintf(httpPath, sizeof(httpPath) - 1, "/ipp/%s", sharename); - - if ((response = cupsDoRequest(http, request, httpPath)) != NULL) { -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to cancel job %d - %s\n", pjob->sysjob, - ippErrorString(cupsLastError()))); - } else { -@@ -564,8 +606,8 @@ static int iprint_job_pause(int snum, struct printjob - - request = ippNew(); - -- request->request.op.operation_id = IPP_HOLD_JOB; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_HOLD_JOB); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -593,7 +635,7 @@ static int iprint_job_pause(int snum, struct printjob - lp_printername(snum)); - - if ((response = cupsDoRequest(http, request, httpPath)) != NULL) { -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to hold job %d - %s\n", pjob->sysjob, - ippErrorString(cupsLastError()))); - } else { -@@ -664,8 +706,8 @@ static int iprint_job_resume(int snum, struct printjob - - request = ippNew(); - -- request->request.op.operation_id = IPP_RELEASE_JOB; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_RELEASE_JOB); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -693,7 +735,7 @@ static int iprint_job_resume(int snum, struct printjob - lp_printername(snum)); - - if ((response = cupsDoRequest(http, request, httpPath)) != NULL) { -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to release job %d - %s\n", pjob->sysjob, - ippErrorString(cupsLastError()))); - } else { -@@ -763,8 +805,8 @@ static int iprint_job_submit(int snum, struct printjob - - request = ippNew(); - -- request->request.op.operation_id = IPP_PRINT_JOB; -- request->request.op.request_id = 1; -+ ippSetOperation(request, IPP_PRINT_JOB); -+ ippSetRequestId(request, 1); - - language = cupsLangDefault(); - -@@ -797,7 +839,7 @@ static int iprint_job_submit(int snum, struct printjob - slprintf(uri, sizeof(uri) - 1, "/ipp/%s", lp_printername(snum)); - - if ((response = cupsDoFileRequest(http, request, uri, pjob->filename)) != NULL) { -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to print file to %s - %s\n", - lp_printername(snum), - ippErrorString(cupsLastError()))); -@@ -817,9 +859,9 @@ static int iprint_job_submit(int snum, struct printjob - if ( ret == 0 ) { - - attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER); -- if (attr != NULL && attr->group_tag == IPP_TAG_JOB) -+ if (attr != NULL && ippGetGroupTag(attr) == IPP_TAG_JOB) - { -- pjob->sysjob = attr->values[0].integer; -+ pjob->sysjob = ippGetInteger(attr, 0); - } - } - -@@ -866,7 +908,6 @@ static int iprint_queue_get(const char *sharename, - int job_id; /* job-id attribute */ - int job_k_octets; /* job-k-octets attribute */ - time_t job_time; /* time-at-creation attribute */ -- time_t printer_current_time = 0; /* printer's current time */ - time_t printer_up_time = 0; /* printer's uptime */ - ipp_jstate_t job_status; /* job-status attribute */ - int job_priority; /* job-priority attribute */ -@@ -939,8 +980,8 @@ static int iprint_queue_get(const char *sharename, - - request = ippNew(); - -- request->request.op.operation_id = IPP_GET_PRINTER_ATTRIBUTES; -- request->request.op.request_id = 2; -+ ippSetOperation(request, IPP_GET_PRINTER_ATTRIBUTES); -+ ippSetRequestId(request, 2); - - language = cupsLangDefault(); - -@@ -971,9 +1012,9 @@ static int iprint_queue_get(const char *sharename, - goto out; - } - -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to get printer status for %s - %s\n", printername, -- ippErrorString(response->request.status.status_code))); -+ ippErrorString(ippGetStatusCode(response)))); - *q = queue; - goto out; - } -@@ -983,7 +1024,7 @@ static int iprint_queue_get(const char *sharename, - */ - - if ((attr = ippFindAttribute(response, "printer-state", IPP_TAG_ENUM)) != NULL) { -- if (attr->values[0].integer == IPP_PRINTER_STOPPED) -+ if (ippGetInteger(attr, 0) == IPP_PRINTER_STOPPED) - status->status = LPSTAT_STOPPED; - else - status->status = LPSTAT_OK; -@@ -991,15 +1032,11 @@ static int iprint_queue_get(const char *sharename, - - if ((attr = ippFindAttribute(response, "printer-state-message", - IPP_TAG_TEXT)) != NULL) -- fstrcpy(status->message, attr->values[0].string.text); -+ fstrcpy(status->message, ippGetString(attr, 0, NULL)); - -- if ((attr = ippFindAttribute(response, "printer-current-time", -- IPP_TAG_DATE)) != NULL) -- printer_current_time = ippDateToTime(attr->values[0].date); -- - if ((attr = ippFindAttribute(response, "printer-up-time", - IPP_TAG_INTEGER)) != NULL) -- printer_up_time = attr->values[0].integer; -+ printer_up_time = ippGetInteger(attr, 0); - - ippDelete(response); - response = NULL; -@@ -1016,8 +1053,8 @@ static int iprint_queue_get(const char *sharename, - - request = ippNew(); - -- request->request.op.operation_id = IPP_GET_JOBS; -- request->request.op.request_id = 3; -+ ippSetOperation(request, IPP_GET_JOBS); -+ ippSetRequestId(request, 3); - - ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_CHARSET, - "attributes-charset", NULL, "utf-8"); -@@ -1045,9 +1082,9 @@ static int iprint_queue_get(const char *sharename, - goto out; - } - -- if (response->request.status.status_code >= IPP_OK_CONFLICT) { -+ if (ippGetStatusCode(response) >= IPP_OK_CONFLICT) { - DEBUG(0,("Unable to get jobs for %s - %s\n", uri, -- ippErrorString(response->request.status.status_code))); -+ ippErrorString(ippGetStatusCode(response)))); - goto out; - } - -@@ -1059,13 +1096,13 @@ static int iprint_queue_get(const char *sharename, - qalloc = 0; - queue = NULL; - -- for (attr = response->attrs; attr != NULL; attr = attr->next) { -+ for (attr = ippFirstAttribute(response); attr != NULL; attr = ippNextAttribute(response)) { - /* - * Skip leading attributes until we hit a job... - */ - -- while (attr != NULL && attr->group_tag != IPP_TAG_JOB) -- attr = attr->next; -+ while (attr != NULL && ippGetGroupTag(attr) != IPP_TAG_JOB) -+ attr = ippNextAttribute(response); - - if (attr == NULL) - break; -@@ -1100,30 +1137,30 @@ static int iprint_queue_get(const char *sharename, - user_name = NULL; - job_name = NULL; - -- while (attr != NULL && attr->group_tag == IPP_TAG_JOB) { -- if (attr->name == NULL) { -- attr = attr->next; -+ while (attr != NULL && ippGetGroupTag(attr) == IPP_TAG_JOB) { -+ if (ippGetName(attr) == NULL) { -+ attr = ippNextAttribute(response); - break; - } - -- if (strcmp(attr->name, "job-id") == 0 && -- attr->value_tag == IPP_TAG_INTEGER) -- job_id = attr->values[0].integer; -+ if (strcmp(ippGetName(attr), "job-id") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_INTEGER) -+ job_id = ippGetInteger(attr, 0); - -- if (strcmp(attr->name, "job-k-octets") == 0 && -- attr->value_tag == IPP_TAG_INTEGER) -- job_k_octets = attr->values[0].integer; -+ if (strcmp(ippGetName(attr), "job-k-octets") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_INTEGER) -+ job_k_octets = ippGetInteger(attr, 0); - -- if (strcmp(attr->name, "job-priority") == 0 && -- attr->value_tag == IPP_TAG_INTEGER) -- job_priority = attr->values[0].integer; -+ if (strcmp(ippGetName(attr), "job-priority") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_INTEGER) -+ job_priority = ippGetInteger(attr, 0); - -- if (strcmp(attr->name, "job-state") == 0 && -- attr->value_tag == IPP_TAG_ENUM) -- job_status = (ipp_jstate_t)(attr->values[0].integer); -+ if (strcmp(ippGetName(attr), "job-state") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_ENUM) -+ job_status = (ipp_jstate_t)ippGetInteger(attr, 0); - -- if (strcmp(attr->name, "time-at-creation") == 0 && -- attr->value_tag == IPP_TAG_INTEGER) -+ if (strcmp(ippGetName(attr), "time-at-creation") == 0 && -+ ippGetValueTag(attr) == IPP_TAG_INTEGER) - { - /* - * If jobs times are in Unix time, the accuracy of the job -@@ -1133,22 +1170,22 @@ static int iprint_queue_get(const char *sharename, - */ - - if (jobUseUnixTime) -- job_time = attr->values[0].integer; -+ job_time = ippGetInteger(attr, 0); - else -- job_time = time(NULL) - printer_up_time + attr->values[0].integer; -+ job_time = time(NULL) - printer_up_time + ippGetInteger(attr, 0); - } - -- if (strcmp(attr->name, "job-name") == 0 && -- (attr->value_tag == IPP_TAG_NAMELANG || -- attr->value_tag == IPP_TAG_NAME)) -- job_name = attr->values[0].string.text; -+ if (strcmp(ippGetName(attr), "job-name") == 0 && -+ (ippGetValueTag(attr) == IPP_TAG_NAMELANG || -+ ippGetValueTag(attr) == IPP_TAG_NAME)) -+ job_name = ippGetString(attr, 0, NULL); - -- if (strcmp(attr->name, "job-originating-user-name") == 0 && -- (attr->value_tag == IPP_TAG_NAMELANG || -- attr->value_tag == IPP_TAG_NAME)) -- user_name = attr->values[0].string.text; -+ if (strcmp(ippGetName(attr), "job-originating-user-name") == 0 && -+ (ippGetValueTag(attr) == IPP_TAG_NAMELANG || -+ ippGetValueTag(attr) == IPP_TAG_NAME)) -+ user_name = ippGetString(attr, 0, NULL); - -- attr = attr->next; -+ attr = ippNextAttribute(response); - } - - /*