Add debug_decl/debug_return (almost) everywhere.
Remove old sudo_debug() and convert users to sudo_debug_printf().
This commit is contained in:
@@ -59,6 +59,7 @@ addr_matches_if(char *n)
|
||||
int j;
|
||||
#endif
|
||||
int family;
|
||||
debug_decl(addr_matches_if, SUDO_DEBUG_MATCH)
|
||||
|
||||
#ifdef HAVE_IN6_ADDR
|
||||
if (inet_pton(AF_INET6, n, &addr.ip6) > 0) {
|
||||
@@ -78,24 +79,24 @@ addr_matches_if(char *n)
|
||||
if (ifp->addr.ip4.s_addr == addr.ip4.s_addr ||
|
||||
(ifp->addr.ip4.s_addr & ifp->netmask.ip4.s_addr)
|
||||
== addr.ip4.s_addr)
|
||||
return TRUE;
|
||||
debug_return_bool(TRUE);
|
||||
break;
|
||||
#ifdef HAVE_IN6_ADDR
|
||||
case AF_INET6:
|
||||
if (memcmp(ifp->addr.ip6.s6_addr, addr.ip6.s6_addr,
|
||||
sizeof(addr.ip6.s6_addr)) == 0)
|
||||
return TRUE;
|
||||
debug_return_bool(TRUE);
|
||||
for (j = 0; j < sizeof(addr.ip6.s6_addr); j++) {
|
||||
if ((ifp->addr.ip6.s6_addr[j] & ifp->netmask.ip6.s6_addr[j]) != addr.ip6.s6_addr[j])
|
||||
break;
|
||||
}
|
||||
if (j == sizeof(addr.ip6.s6_addr))
|
||||
return TRUE;
|
||||
debug_return_bool(TRUE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
debug_return_bool(FALSE);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -108,6 +109,7 @@ addr_matches_if_netmask(char *n, char *m)
|
||||
int j;
|
||||
#endif
|
||||
int family;
|
||||
debug_decl(addr_matches_if, SUDO_DEBUG_MATCH)
|
||||
|
||||
#ifdef HAVE_IN6_ADDR
|
||||
if (inet_pton(AF_INET6, n, &addr.ip6) > 0)
|
||||
@@ -157,7 +159,7 @@ addr_matches_if_netmask(char *n, char *m)
|
||||
switch(family) {
|
||||
case AF_INET:
|
||||
if ((ifp->addr.ip4.s_addr & mask.ip4.s_addr) == addr.ip4.s_addr)
|
||||
return TRUE;
|
||||
debug_return_bool(TRUE);
|
||||
#ifdef HAVE_IN6_ADDR
|
||||
case AF_INET6:
|
||||
for (j = 0; j < sizeof(addr.ip6.s6_addr); j++) {
|
||||
@@ -165,12 +167,12 @@ addr_matches_if_netmask(char *n, char *m)
|
||||
break;
|
||||
}
|
||||
if (j == sizeof(addr.ip6.s6_addr))
|
||||
return TRUE;
|
||||
debug_return_bool(TRUE);
|
||||
#endif /* HAVE_IN6_ADDR */
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
debug_return_bool(FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -182,6 +184,7 @@ addr_matches(char *n)
|
||||
{
|
||||
char *m;
|
||||
int retval;
|
||||
debug_decl(addr_matches, SUDO_DEBUG_MATCH)
|
||||
|
||||
/* If there's an explicit netmask, use it. */
|
||||
if ((m = strchr(n, '/'))) {
|
||||
@@ -191,5 +194,5 @@ addr_matches(char *n)
|
||||
} else
|
||||
retval = addr_matches_if(n);
|
||||
|
||||
return retval;
|
||||
debug_return_bool(retval);
|
||||
}
|
||||
|
Reference in New Issue
Block a user