]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Multiple fixes:
authorMichael R Sweet <msweet@msweet.org>
Tue, 1 Apr 2025 17:45:37 +0000 (13:45 -0400)
committerMichael R Sweet <msweet@msweet.org>
Tue, 1 Apr 2025 17:45:37 +0000 (13:45 -0400)
- 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.

scheduler/client.c
scheduler/ipp.c
scheduler/select.c
scheduler/subscriptions.c
scheduler/sysman.c

index fc92d17416f9eb206b6d76ad75905097744d8d5a..f0f28f1250548d63a156138c0e09e9a747d1a094 100644 (file)
@@ -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());
index 26c4a3232969f2ee32b304425ef2f9e3ad058b67..3943f67d7849cd4b96b47767f94fbfd0c12692e9 100644 (file)
@@ -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);
   }
 
index 9852e59be42800bd868dba3f9c9beebfd290a0e5..634f0d4e2c3f10709643b2000dbbc2ce3cf1d265 100644 (file)
@@ -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);
 
index 8c1840e9c450fb71e71ca7e6b9e7e244c113b12f..4e42c9c09df11fb2929a4f2e4059e0b102d0f530 100644 (file)
@@ -9,10 +9,6 @@
  * information.
  */
 
-/*
- * Include necessary headers...
- */
-
 #include "cupsd.h"
 #ifdef HAVE_DBUS
 #  include <dbus/dbus.h>
@@ -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,
index cce3fa986cbe723c3dc5f334dcd7cea09b62e251..c970b87d47a2566135792b4848feb402f3022354 100644 (file)
@@ -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 <IOKit/pwr_mgt/IOPMLib.h>
@@ -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;
   }