]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix an interaction between --remote-admin and --remote-any (Issue #158)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 17 Sep 2021 15:40:54 +0000 (11:40 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Fri, 17 Sep 2021 15:40:54 +0000 (11:40 -0400)
CHANGES.md
cups/adminutil.c

index 7d6ed0f96fa0f6d6ff6ab1832a78e6dd3169db64..d62024a56df1e801187ffb4bf10f5123e10c779f 100644 (file)
@@ -39,6 +39,8 @@ CUPS v2.4rc1 (Pending)
 - Now show better error messages when a driver interface program fails to
   provide a PPD file (Issue #148)
 - Added a workaround for Solaris in `httpAddrConnect2` (Issue #156)
+- Fixed an interaction between `--remote-admin` and `--remote-any` for the
+  `cupsctl` command (Issue #158)
 - Now use a 60 second timeout for reading USB backchannel data (Issue #160)
 - The USB backend now tries harder to find a serial number (Issue #170)
 - Fixed `@IF(name)` handling in `cupsd.conf` (Apple #5918)
index 3118968c67cfb24f6e4f3b33dadedbbf8b403c98..69b5f6c761b3bb99884445ebd03079631b2eb8a5 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Administration utility API definitions for CUPS.
  *
+ * Copyright © 2021 by OpenPrinting.
  * Copyright © 2007-2019 by Apple Inc.
  * Copyright © 2001-2007 by Easy Software Products.
  *
@@ -845,8 +846,12 @@ cupsAdminSetServerSettings(
         cupsFilePuts(temp, "  Order allow,deny\n");
 
        if (remote_admin)
-         cupsFilePrintf(temp, "  Allow %s\n",
-                        remote_any > 0 ? "all" : "@LOCAL");
+       {
+         if (remote_any >= 0)
+           cupsFilePrintf(temp, "  Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
+         else
+           cupsFilePrintf(temp, "  Allow %s\n", old_remote_any > 0 ? "all" : "@LOCAL");
+       }
       }
       else if (in_conf_location && remote_admin >= 0)
       {
@@ -862,8 +867,12 @@ cupsAdminSetServerSettings(
         cupsFilePuts(temp, "  Order allow,deny\n");
 
        if (remote_admin)
-         cupsFilePrintf(temp, "  Allow %s\n",
-                        remote_any > 0 ? "all" : "@LOCAL");
+       {
+         if (remote_any >= 0)
+           cupsFilePrintf(temp, "  Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
+         else
+           cupsFilePrintf(temp, "  Allow %s\n", old_remote_any > 0 ? "all" : "@LOCAL");
+       }
       }
       else if (in_log_location && remote_admin >= 0)
       {
@@ -879,8 +888,12 @@ cupsAdminSetServerSettings(
         cupsFilePuts(temp, "  Order allow,deny\n");
 
        if (remote_admin)
-         cupsFilePrintf(temp, "  Allow %s\n",
-                        remote_any > 0 ? "all" : "@LOCAL");
+       {
+         if (remote_any >= 0)
+           cupsFilePrintf(temp, "  Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
+         else
+           cupsFilePrintf(temp, "  Allow %s\n", old_remote_any > 0 ? "all" : "@LOCAL");
+       }
       }
       else if (in_root_location &&
                (remote_admin >= 0 || remote_any >= 0 || share_printers >= 0))
@@ -902,8 +915,12 @@ cupsAdminSetServerSettings(
         cupsFilePuts(temp, "  Order allow,deny\n");
 
        if (remote_admin > 0 || remote_any > 0 || share_printers > 0)
-         cupsFilePrintf(temp, "  Allow %s\n",
-                        remote_any > 0 ? "all" : "@LOCAL");
+       {
+         if (remote_any >= 0)
+           cupsFilePrintf(temp, "  Allow %s\n", remote_any > 0 ? "all" : "@LOCAL");
+         else
+           cupsFilePrintf(temp, "  Allow %s\n", old_remote_any > 0 ? "all" : "@LOCAL");
+       }
       }
 
       in_admin_location = 0;