From 84ec3a84450c4ded1d1847dc5becdfa8ed4c7c4b Mon Sep 17 00:00:00 2001 From: msweet Date: Mon, 6 Jan 2014 21:59:35 +0000 Subject: [PATCH] Using "@IF(name)" in an Allow or Deny rule did not work (STR #4328) Move the cupsdNetIFUpdate call before the name check - we need to update for all names. Add debug logging to show interfaces that are skipped and other "errors". git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11497 a1ca3aef-8c08-0410-bb20-df032aa958be --- CHANGES-1.7.txt | 1 + scheduler/auth.c | 6 +++--- scheduler/network.c | 32 +++++++++++++++++--------------- 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/CHANGES-1.7.txt b/CHANGES-1.7.txt index 3751371a8..a207788ae 100644 --- a/CHANGES-1.7.txt +++ b/CHANGES-1.7.txt @@ -32,6 +32,7 @@ CHANGES IN CUPS V1.7.1 before attempting to print () - CUPS did not support "auto-monochrome" or "process-monochrome" for the "print-color-mode" option () + - Using "@IF(name)" in an Allow or Deny rule did not work (STR #4328) CHANGES IN CUPS V1.7.0 diff --git a/scheduler/auth.c b/scheduler/auth.c index 5566e6ce6..9e5642ef8 100644 --- a/scheduler/auth.c +++ b/scheduler/auth.c @@ -3,7 +3,7 @@ * * Authorization routines for the CUPS scheduler. * - * Copyright 2007-2013 by Apple Inc. + * Copyright 2007-2014 by Apple Inc. * Copyright 1997-2007 by Easy Software Products, all rights reserved. * * This file contains Kerberos support code, copyright 2006 by @@ -1226,6 +1226,8 @@ cupsdCheckAuth(unsigned ip[4], /* I - Client address */ netip6[3] = htonl(ip[3]); #endif /* AF_INET6 */ + cupsdNetIFUpdate(); + if (!strcmp(mask->mask.name.name, "*")) { #ifdef __APPLE__ @@ -1241,8 +1243,6 @@ cupsdCheckAuth(unsigned ip[4], /* I - Client address */ * Check against all local interfaces... */ - cupsdNetIFUpdate(); - for (iface = (cupsd_netif_t *)cupsArrayFirst(NetIFList); iface; iface = (cupsd_netif_t *)cupsArrayNext(NetIFList)) diff --git a/scheduler/network.c b/scheduler/network.c index 054faa50f..350f4e3e9 100644 --- a/scheduler/network.c +++ b/scheduler/network.c @@ -1,23 +1,16 @@ /* * "$Id$" * - * Network interface functions for the CUPS scheduler. + * Network interface functions for the CUPS scheduler. * - * Copyright 2007-2012 by Apple Inc. - * Copyright 1997-2006 by Easy Software Products, all rights reserved. + * Copyright 2007-2014 by Apple Inc. + * Copyright 1997-2006 by Easy Software Products, all rights reserved. * - * These coded instructions, statements, and computer programs are the - * property of Apple Inc. and are protected by Federal copyright - * law. Distribution and use rights are outlined in the file "LICENSE.txt" - * "LICENSE" which should have been included with this file. If this - * file is missing or damaged, see the license at "http://www.cups.org/". - * - * Contents: - * - * cupsdNetIFFind() - Find a network interface. - * cupsdNetIFFree() - Free the current network interface list. - * cupsdNetIFUpdate() - Update the network interface list as needed... - * compare_netif() - Compare two network interfaces. + * These coded instructions, statements, and computer programs are the + * property of Apple Inc. and are protected by Federal copyright + * law. Distribution and use rights are outlined in the file "LICENSE.txt" + * "LICENSE" which should have been included with this file. If this + * file is missing or damaged, see the license at "http://www.cups.org/". */ /* @@ -133,7 +126,10 @@ cupsdNetIFUpdate(void) */ if (getifaddrs(&addrs) < 0) + { + cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdNetIFUpdate: Unable to get interface list - %s", strerror(errno)); return; + } for (addr = addrs; addr != NULL; addr = addr->ifa_next) { @@ -148,7 +144,10 @@ cupsdNetIFUpdate(void) #endif ) || addr->ifa_netmask == NULL || addr->ifa_name == NULL) + { + cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdNetIFUpdate: Ignoring \"%s\".", addr->ifa_name); continue; + } /* * Try looking up the hostname for the address as needed... @@ -178,7 +177,10 @@ cupsdNetIFUpdate(void) hostlen = strlen(hostname); if ((temp = calloc(1, sizeof(cupsd_netif_t) + hostlen)) == NULL) + { + cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdNetIFUpdate: Unable to allocate memory for interface."); break; + } /* * Copy all of the information... -- 2.39.2