From: Michael R Sweet Date: Tue, 1 Apr 2025 17:45:37 +0000 (-0400) Subject: Multiple fixes: X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=25bf392eec211a6efe66c38d79d2f97834c30f1d;p=thirdparty%2Fcups.git Multiple fixes: - Fix encryption support (new httpSetEncryption function returns true on success) - Demote many developer messages to debug2 log level. - Adopt cupsdLogPrinter in a few places. - Normalize a few other messages. --- diff --git a/scheduler/client.c b/scheduler/client.c index fc92d17416..f0f28f1250 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -1,7 +1,7 @@ /* * Client routines for the CUPS scheduler. * - * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2020-2025 by OpenPrinting. * Copyright © 2007-2021 by Apple Inc. * Copyright © 1997-2007 by Easy Software Products, all rights reserved. * @@ -2102,7 +2102,7 @@ cupsdSendHeader( char auth_str[1024]; /* Authorization string */ - cupsdLogClient(con, CUPSD_LOG_DEBUG, "cupsdSendHeader: code=%d, type=\"%s\", auth_type=%d", code, type, auth_type); + cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cupsdSendHeader: code=%d, type=\"%s\", auth_type=%d", code, type, auth_type); /* * Send the HTTP status header... @@ -2275,8 +2275,8 @@ cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */ ipp_state_t ipp_state; /* IPP state value */ - cupsdLogClient(con, CUPSD_LOG_DEBUG, "con->http=%p", (void *)con->http); - cupsdLogClient(con, CUPSD_LOG_DEBUG, + cupsdLogClient(con, CUPSD_LOG_DEBUG2, "con->http=%p", (void *)con->http); + cupsdLogClient(con, CUPSD_LOG_DEBUG2, "cupsdWriteClient " "error=%d, " "used=%d, " @@ -2363,7 +2363,7 @@ cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */ } while (ipp_state != IPP_STATE_DATA && ipp_state != IPP_STATE_ERROR); - cupsdLogClient(con, CUPSD_LOG_DEBUG, + cupsdLogClient(con, CUPSD_LOG_DEBUG2, "Writing IPP response, ipp_state=%s, old " "wused=" CUPS_LLFMT ", new wused=" CUPS_LLFMT, ippStateString(ipp_state), @@ -2375,7 +2375,7 @@ cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */ bytes = ipp_state != IPP_STATE_ERROR && (con->file >= 0 || ipp_state != IPP_STATE_DATA); - cupsdLogClient(con, CUPSD_LOG_DEBUG, + cupsdLogClient(con, CUPSD_LOG_DEBUG2, "bytes=%d, http_state=%d, data_remaining=" CUPS_LLFMT, (int)bytes, httpGetState(con->http), CUPS_LLCAST httpGetLength2(con->http)); @@ -2543,9 +2543,9 @@ cupsdWriteClient(cupsd_client_t *con) /* I - Client connection */ } } - cupsdLogClient(con, CUPSD_LOG_DEBUG, "Flushing write buffer."); + cupsdLogClient(con, CUPSD_LOG_DEBUG2, "Flushing write buffer."); httpFlushWrite(con->http); - cupsdLogClient(con, CUPSD_LOG_DEBUG, "New state is %s", httpStateString(httpGetState(con->http))); + cupsdLogClient(con, CUPSD_LOG_DEBUG2, "New state is %s", httpStateString(httpGetState(con->http))); } cupsdAddSelect(httpGetFd(con->http), (cupsd_selfunc_t)cupsdReadClient, NULL, con); @@ -2682,7 +2682,7 @@ static int /* O - 0 on success, -1 on error */ cupsd_start_tls(cupsd_client_t *con, /* I - Client connection */ http_encryption_t e) /* I - Encryption mode */ { - if (httpSetEncryption(con->http, e)) + if (!httpSetEncryption(con->http, e)) { cupsdLogClient(con, CUPSD_LOG_ERROR, "Unable to encrypt connection: %s", cupsGetErrorString()); diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 26c4a32329..3943f67d78 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -418,9 +418,9 @@ cupsdProcessIPPRequest( */ if (uri) - cupsdLogMessage(CUPSD_LOG_DEBUG, "%s %s", ippOpString(con->request->request.op.operation_id), uri->values[0].string.text); + cupsdLogClient(con, CUPSD_LOG_DEBUG, "%s %s", ippOpString(con->request->request.op.operation_id), uri->values[0].string.text); else - cupsdLogMessage(CUPSD_LOG_DEBUG, "%s", ippOpString(con->request->request.op.operation_id)); + cupsdLogClient(con, CUPSD_LOG_DEBUG, "%s", ippOpString(con->request->request.op.operation_id)); switch (con->request->request.op.operation_id) { @@ -10323,7 +10323,7 @@ send_response(cupsd_client_t *con) /* I - Client */ length += (size_t)fileinfo.st_size; } - cupsdLogClient(con, CUPSD_LOG_DEBUG, "Content-Length: " CUPS_LLFMT, CUPS_LLCAST length); + cupsdLogClient(con, CUPSD_LOG_DEBUG2, "Content-Length: " CUPS_LLFMT, CUPS_LLCAST length); httpSetLength(con->http, length); } diff --git a/scheduler/select.c b/scheduler/select.c index 9852e59be4..634f0d4e2c 100644 --- a/scheduler/select.c +++ b/scheduler/select.c @@ -1,7 +1,7 @@ // // Select abstraction functions for the CUPS scheduler. // -// Copyright © 2020-2024 by OpenPrinting. +// Copyright © 2020-2025 by OpenPrinting. // Copyright © 2007-2016 by Apple Inc. // Copyright © 2006-2007 by Easy Software Products. // @@ -301,7 +301,7 @@ cupsdDoSelect(long timeout) // I - Timeout in seconds else nfds = poll(cupsd_pollfds, (nfds_t)count, -1); - cupsdLogMessage(CUPSD_LOG_DEBUG, "poll(nfds=%d, timeout=%ld) returned %d", count, timeout < 86400 ? timeout * 1000 : -1, nfds); + cupsdLogMessage(CUPSD_LOG_DEBUG2, "poll(nfds=%d, timeout=%ld) returned %d", count, timeout < 86400 ? timeout * 1000 : -1, nfds); if (nfds > 0) { @@ -313,11 +313,11 @@ cupsdDoSelect(long timeout) // I - Timeout in seconds if ((fdptr = find_fd(pfd->fd)) == NULL) { - cupsdLogMessage(CUPSD_LOG_DEBUG, "cups_pollfds[%d] not found", pfd->fd); + cupsdLogMessage(CUPSD_LOG_DEBUG2, "cups_pollfds[%d] not found", pfd->fd); continue; } - cupsdLogMessage(CUPSD_LOG_DEBUG, "cups_pollfds[%d].revents=%d", pfd->fd, pfd->revents); + cupsdLogMessage(CUPSD_LOG_DEBUG2, "cups_pollfds[%d].revents=%d", pfd->fd, pfd->revents); retain_fd(fdptr); diff --git a/scheduler/subscriptions.c b/scheduler/subscriptions.c index 8c1840e9c4..4e42c9c09d 100644 --- a/scheduler/subscriptions.c +++ b/scheduler/subscriptions.c @@ -9,10 +9,6 @@ * information. */ -/* - * Include necessary headers... - */ - #include "cupsd.h" #ifdef HAVE_DBUS # include @@ -159,6 +155,11 @@ cupsdAddEvent( ippAddString(temp->attrs, IPP_TAG_EVENT_NOTIFICATION, IPP_TAG_TEXT, "notify-text", NULL, ftext); + if (job) + cupsdLogJob(job, CUPSD_LOG_DEBUG, "%s: %s", cupsdEventName(event), ftext); + else + cupsdLogPrinter(dest, CUPSD_LOG_DEBUG, "%s: %s", cupsdEventName(event), ftext); + if (dest) { /* @@ -262,7 +263,7 @@ cupsdAddSubscription( cupsd_subscription_t *temp; /* New subscription object */ - cupsdLogMessage(CUPSD_LOG_DEBUG, + cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddSubscription(mask=%x, dest=%p(%s), job=%p(%d), " "uri=\"%s\")", mask, (void *)dest, dest ? dest->name : "", (void *)job, job ? job->id : 0, diff --git a/scheduler/sysman.c b/scheduler/sysman.c index cce3fa986c..c970b87d47 100644 --- a/scheduler/sysman.c +++ b/scheduler/sysman.c @@ -1,7 +1,7 @@ /* * System management functions for the CUPS scheduler. * - * Copyright © 2020-2024 by OpenPrinting. + * Copyright © 2020-2025 by OpenPrinting. * Copyright @ 2007-2018 by Apple Inc. * Copyright @ 2006 by Easy Software Products. * @@ -9,11 +9,6 @@ * information. */ - -/* - * Include necessary headers... - */ - #include "cupsd.h" #ifdef __APPLE__ # include @@ -86,7 +81,7 @@ cupsdCleanDirty(void) void cupsdMarkDirty(int what) /* I - What file(s) are dirty? */ { - cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdMarkDirty(%c%c%c%c%c)", + cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdMarkDirty(%c%c%c%c%c)", (what & CUPSD_DIRTY_PRINTERS) ? 'P' : '-', (what & CUPSD_DIRTY_CLASSES) ? 'C' : '-', (what & CUPSD_DIRTY_PRINTCAP) ? 'p' : '-', @@ -158,7 +153,7 @@ cupsdSetBusyState(int working) /* I - Doing significant work? */ if (job) newbusy |= 2; - cupsdLogMessage(CUPSD_LOG_DEBUG, + cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSetBusyState: newbusy=\"%s\", busy=\"%s\"", busy_text[newbusy], busy_text[busy]); @@ -180,7 +175,7 @@ cupsdSetBusyState(int working) /* I - Doing significant work? */ } else if (cupsArrayCount(PrintingJobs) == 0 && keep_awake) { - cupsdLogMessage(CUPSD_LOG_DEBUG, "Releasing power assertion."); + cupsdLogMessage(CUPSD_LOG_DEBUG, "Releasing NetworkClientActive."); IOPMAssertionRelease(keep_awake); keep_awake = 0; }