We use a few different ifdef's names to check if we are using Casper or not,

let's standardize this. Now we are always use WITH_CASPER name.

Discussed with:	emaste@
MFC after:	1 month
This commit is contained in:
Mariusz Zaborski 2017-09-21 14:41:41 +00:00
parent 6d2e5f3ddf
commit 2560d18180
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323866
10 changed files with 48 additions and 48 deletions

View File

@ -26,10 +26,10 @@
#include "config.h"
#endif
#ifdef HAVE_CASPER
#ifdef WITH_CASPER
#include <libcasper.h>
#include <casper/cap_dns.h>
#endif /* HAVE_CASPER */
#endif /* WITH_CASPER */
#include <netdissect-stdinc.h>
@ -202,7 +202,7 @@ intoa(uint32_t addr)
static uint32_t f_netmask;
static uint32_t f_localnet;
#ifdef HAVE_CASPER
#ifdef WITH_CASPER
extern cap_channel_t *capdns;
#endif
@ -250,7 +250,7 @@ getname(netdissect_options *ndo, const u_char *ap)
*/
if (!ndo->ndo_nflag &&
(addr & f_netmask) == f_localnet) {
#ifdef HAVE_CASPER
#ifdef WITH_CASPER
if (capdns != NULL) {
hp = cap_gethostbyaddr(capdns, (char *)&addr, 4,
AF_INET);
@ -311,7 +311,7 @@ getname6(netdissect_options *ndo, const u_char *ap)
* Do not print names if -n was given.
*/
if (!ndo->ndo_nflag) {
#ifdef HAVE_CASPER
#ifdef WITH_CASPER
if (capdns != NULL) {
hp = cap_gethostbyaddr(capdns, (char *)&addr,
sizeof(addr), AF_INET6);

View File

@ -82,10 +82,10 @@ The Regents of the University of California. All rights reserved.\n";
#include <sys/ioccom.h>
#include <net/bpf.h>
#include <libgen.h>
#ifdef HAVE_CASPER
#ifdef WITH_CASPER
#include <libcasper.h>
#include <casper/cap_dns.h>
#endif /* HAVE_CASPER */
#endif /* WITH_CASPER */
#endif /* HAVE_CAPSICUM */
#include <pcap.h>
#include <signal.h>
@ -176,7 +176,7 @@ static int infoprint;
char *program_name;
#ifdef HAVE_CASPER
#ifdef WITH_CASPER
cap_channel_t *capdns;
#endif
@ -730,7 +730,7 @@ get_next_file(FILE *VFile, char *ptr)
return ret;
}
#ifdef HAVE_CASPER
#ifdef WITH_CASPER
static cap_channel_t *
capdns_setup(void)
{
@ -757,7 +757,7 @@ capdns_setup(void)
return (capdnsloc);
}
#endif /* HAVE_CASPER */
#endif /* WITH_CASPER */
#ifdef HAVE_PCAP_SET_TSTAMP_PRECISION
static int
@ -1839,10 +1839,10 @@ main(int argc, char **argv)
exit_tcpdump(0);
}
#ifdef HAVE_CASPER
#ifdef WITH_CASPER
if (!ndo->ndo_nflag)
capdns = capdns_setup();
#endif /* HAVE_CASPER */
#endif /* WITH_CASPER */
init_print(ndo, localnet, netmask, timezone_offset);
@ -2066,11 +2066,11 @@ main(int argc, char **argv)
#ifdef HAVE_CAPSICUM
cansandbox = (VFileName == NULL && zflag == NULL);
#ifdef HAVE_CASPER
#ifdef WITH_CASPER
cansandbox = (cansandbox && (ndo->ndo_nflag || capdns != NULL));
#else
cansandbox = (cansandbox && ndo->ndo_nflag);
#endif /* HAVE_CASPER */
#endif /* WITH_CASPER */
if (cansandbox && cap_enter() < 0 && errno != ENOSYS)
error("unable to enter the capability mode");
#endif /* HAVE_CAPSICUM */

View File

@ -227,7 +227,7 @@ static const char rcsid[] =
#include <arpa/inet.h>
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
#include <libcasper.h>
#include <casper/cap_dns.h>
#endif
@ -369,7 +369,7 @@ extern int optind;
extern int opterr;
extern char *optarg;
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
static cap_channel_t *capdns;
#endif
@ -521,7 +521,7 @@ main(int argc, char **argv)
int requestPort = -1;
int sump = 0;
int sockerrno;
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
const char *types[] = { "NAME", "ADDR" };
int families[1];
cap_channel_t *casper;
@ -556,7 +556,7 @@ main(int argc, char **argv)
exit(1);
}
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
casper = cap_init();
if (casper == NULL)
errx(1, "unable to create casper process");
@ -568,7 +568,7 @@ main(int argc, char **argv)
families[0] = AF_INET;
if (cap_dns_family_limit(capdns, families, 1) < 0)
errx(1, "unable to limit access to system.dns service");
#endif /* HAVE_LIBCASPER */
#endif /* WITH_CASPER */
#ifdef IPCTL_DEFTTL
{
@ -584,7 +584,7 @@ main(int argc, char **argv)
max_ttl = 30;
#endif
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
cap_close(casper);
#endif
@ -1006,7 +1006,7 @@ main(int argc, char **argv)
exit(1);
}
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
cansandbox = true;
#else
if (nflag)
@ -1851,7 +1851,7 @@ inetname(struct in_addr in)
else {
cp = strchr(domain, '.');
if (cp == NULL) {
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
if (capdns != NULL)
hp = cap_gethostbyname(capdns, domain);
else
@ -1870,7 +1870,7 @@ inetname(struct in_addr in)
}
}
if (!nflag && in.s_addr != INADDR_ANY) {
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
if (capdns != NULL)
hp = cap_gethostbyaddr(capdns, (char *)&in, sizeof(in),
AF_INET);
@ -1922,7 +1922,7 @@ gethostinfo(register char *hostname)
return (hi);
}
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
if (capdns != NULL)
hp = cap_gethostbyname(capdns, hostname);
else

View File

@ -14,7 +14,7 @@ LIBADD= m
.if ${MK_CASPER} != "no" && !defined(RESCUE)
LIBADD+= casper
LIBADD+= cap_dns
CFLAGS+=-DHAVE_LIBCASPER
CFLAGS+=-DWITH_CASPER
.endif
.if !defined(RELEASE_CRUNCH)

View File

@ -76,7 +76,7 @@ __FBSDID("$FreeBSD$");
#include <netinet/ip_var.h>
#include <arpa/inet.h>
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
#include <libcasper.h>
#include <casper/cap_dns.h>
#endif
@ -204,13 +204,13 @@ static double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
static volatile sig_atomic_t finish_up;
static volatile sig_atomic_t siginfo_p;
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
static cap_channel_t *capdns;
#endif
static void fill(char *, char *);
static u_short in_cksum(u_short *, int);
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
static cap_channel_t *capdns_setup(void);
#endif
static void check_status(void);
@ -563,7 +563,7 @@ main(int argc, char *const *argv)
if (options & F_PINGFILLED) {
fill((char *)datap, payload);
}
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
capdns = capdns_setup();
#endif
if (source) {
@ -572,7 +572,7 @@ main(int argc, char *const *argv)
if (inet_aton(source, &sock_in.sin_addr) != 0) {
shostname = source;
} else {
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
if (capdns != NULL)
hp = cap_gethostbyname2(capdns, source,
AF_INET);
@ -606,7 +606,7 @@ main(int argc, char *const *argv)
if (inet_aton(target, &to->sin_addr) != 0) {
hostname = target;
} else {
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
if (capdns != NULL)
hp = cap_gethostbyname2(capdns, target, AF_INET);
else
@ -624,7 +624,7 @@ main(int argc, char *const *argv)
hostname = hnamebuf;
}
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
/* From now on we will use only reverse DNS lookups. */
if (capdns != NULL) {
const char *types[1];
@ -722,7 +722,7 @@ main(int argc, char *const *argv)
if (options & F_NUMERIC)
cansandbox = true;
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
else if (capdns != NULL)
cansandbox = true;
#endif
@ -1707,7 +1707,7 @@ pr_addr(struct in_addr ina)
if (options & F_NUMERIC)
return inet_ntoa(ina);
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
if (capdns != NULL)
hp = cap_gethostbyaddr(capdns, (char *)&ina, 4, AF_INET);
else
@ -1791,7 +1791,7 @@ fill(char *bp, char *patp)
}
}
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
static cap_channel_t *
capdns_setup(void)
{
@ -1817,7 +1817,7 @@ capdns_setup(void)
return (capdnsloc);
}
#endif /* HAVE_LIBCASPER */
#endif /* WITH_CASPER */
#if defined(IPSEC) && defined(IPSEC_POLICY_IPSEC)
#define SECOPT " [-P policy]"

View File

@ -14,7 +14,7 @@ LIBADD= sysdecode
LIBADD+= casper
LIBADD+= cap_grp
LIBADD+= cap_pwd
CFLAGS+=-DHAVE_LIBCASPER
CFLAGS+=-DWITH_CASPER
.endif
#NO_WERROR?= YES

View File

@ -56,7 +56,7 @@ __FBSDID("$FreeBSD$");
#include <sys/un.h>
#include <sys/queue.h>
#include <sys/wait.h>
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
#include <sys/nv.h>
#endif
#include <arpa/inet.h>
@ -80,7 +80,7 @@ __FBSDID("$FreeBSD$");
#include <vis.h>
#include "ktrace.h"
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
#include <libcasper.h>
#include <casper/cap_grp.h>
@ -164,7 +164,7 @@ struct proc_info
static TAILQ_HEAD(trace_procs, proc_info) trace_procs;
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
static cap_channel_t *cappwd, *capgrp;
#endif
@ -193,7 +193,7 @@ localtime_init(void)
(void)localtime(&ltime);
}
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
static int
cappwdgrp_setup(cap_channel_t **cappwdp, cap_channel_t **capgrpp)
{
@ -235,7 +235,7 @@ cappwdgrp_setup(cap_channel_t **cappwdp, cap_channel_t **capgrpp)
*capgrpp = capgrploc;
return (0);
}
#endif /* HAVE_LIBCASPER */
#endif /* WITH_CASPER */
static void
print_integer_arg(const char *(*decoder)(int), int value)
@ -443,7 +443,7 @@ main(int argc, char *argv[])
strerror_init();
localtime_init();
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
if (resolv != 0) {
if (cappwdgrp_setup(&cappwd, &capgrp) < 0) {
cappwd = NULL;
@ -1874,7 +1874,7 @@ ktrstat(struct stat *statp)
if (resolv == 0) {
pwd = NULL;
} else {
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
if (cappwd != NULL)
pwd = cap_getpwuid(cappwd, statp->st_uid);
else
@ -1888,7 +1888,7 @@ ktrstat(struct stat *statp)
if (resolv == 0) {
grp = NULL;
} else {
#ifdef HAVE_LIBCASPER
#ifdef WITH_CASPER
if (capgrp != NULL)
grp = cap_getgrgid(capgrp, statp->st_gid);
else

View File

@ -190,7 +190,7 @@ LIBADD= l pcap
.if ${MK_CASPER} != "no"
LIBADD+= casper
LIBADD+= cap_dns
CFLAGS+=-DHAVE_CASPER
CFLAGS+=-DWITH_CASPER
.endif
.if ${MK_OPENSSL} != "no"
LIBADD+= crypto

View File

@ -18,7 +18,7 @@
/* Casper library support available */
/* See Makefile */
/* #undef HAVE_CASPER */
/* #undef WITH_CASPER */
/* Define to 1 if you have the `cap_enter' function. */
#define HAVE_CAP_ENTER 1

View File

@ -33,7 +33,7 @@ LIBADD+= ipsec
.if ${MK_CASPER} != "no"
LIBADD+= casper
LIBADD+= cap_dns
CFLAGS+=-DHAVE_LIBCASPER
CFLAGS+=-DWITH_CASPER
.endif
CFLAGS+= -I${TRACEROUTE_DISTDIR}