-/* $OpenBSD: pfctl.c,v 1.357 2018/09/07 19:56:07 kn Exp $ */
+/* $OpenBSD: pfctl.c,v 1.358 2018/09/08 14:12:57 kn Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
errx(1, "pfctl: calloc");
memset(anchorname, 0, sizeof(anchorname));
if (anchoropt != NULL) {
+ if (mode == O_RDONLY && showopt == NULL) {
+ warnx("anchors apply to -f, -F and -s only");
+ usage();
+ }
+ if (mode == O_RDWR &&
+ (anchoropt[0] == '_' || strstr(anchoropt, "/_") != NULL))
+ errx(1, "anchor names beginning with '_' cannot "
+ "be modified from the command line");
int len = strlen(anchoropt);
if (anchoropt[len - 1] == '*') {
anchorname, 0, 0, -1);
if (clearopt != NULL) {
- if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL)
- errx(1, "anchor names beginning with '_' cannot "
- "be modified from the command line");
-
switch (*clearopt) {
case 'r':
pfctl_clear_rules(dev, opts, anchorname);
}
if (rulesopt != NULL) {
- if (anchorname[0] == '_' || strstr(anchorname, "/_") != NULL)
- errx(1, "anchor names beginning with '_' cannot "
- "be modified from the command line");
if (pfctl_rules(dev, rulesopt, opts, optimize,
anchorname, NULL))
error = 1;