From: Michael R Sweet Date: Fri, 17 Sep 2021 15:40:54 +0000 (-0400) Subject: Fix an interaction between --remote-admin and --remote-any (Issue #158) X-Git-Tag: v2.4b1~51 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3698e1ff9fb59b401b20e7456901a4d9022b7881;p=thirdparty%2Fcups.git Fix an interaction between --remote-admin and --remote-any (Issue #158) --- diff --git a/CHANGES.md b/CHANGES.md index 7d6ed0f96f..d62024a56d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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) diff --git a/cups/adminutil.c b/cups/adminutil.c index 3118968c67..69b5f6c761 100644 --- a/cups/adminutil.c +++ b/cups/adminutil.c @@ -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;