Commit 761a1c37 authored by Michael Sawyer's avatar Michael Sawyer
Browse files

Add sanitizer and hide per-master key code behind sanitizing #ifdefs

parent 222ad908
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.47 2000/07/25 20:26:11 bwelling Exp $ */
/* $Id: zoneconf.c,v 1.48 2000/07/26 18:47:34 mws Exp $ */
#include <config.h>
......@@ -272,10 +272,15 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
iplist = NULL;
result = dns_c_zone_getmasterips(czone, &iplist);
if (result == ISC_R_SUCCESS)
#ifndef NOMINUM_PUBLIC
result = dns_zone_setmasterswithkeys(zone,
iplist->ips,
iplist->keys,
iplist->nextidx);
#else /* NOMINUM_PUBLIC */
result = dns_zone_setmasters(zone, iplist->ips,
iplist->nextidx);
#endif /* NOMINUM_PUBLIC */
else
result = dns_zone_setmasters(zone, NULL, 0);
RETERR(result);
......
......@@ -13,13 +13,14 @@
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# $Id: Makefile.in,v 1.13 2000/06/22 21:55:00 tale Exp $
# $Id: Makefile.in,v 1.14 2000/07/26 18:47:35 mws Exp $
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
YACC = @YACC@
PERL = @PERL@
@BIND9_VERSION@
......@@ -65,6 +66,14 @@ confparser.c: confparser.y
chmod a-w confparser.c
mv y.tab.h confparser_p.h
#ifndef NOMINUM_PUBLIC
## This rule is here only for Nominum internal use. The above "comment"
## will cause the sanitizer to remove it
confparser.y: confparser.y.dirty
${PERL} ../../../util/sanitize.pl -i - < confparser.y.dirty \
> confparser.y
#endif NOMINUM_PUBLIC
depend: confparser.c
distclean::
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confip.c,v 1.28 2000/07/21 21:24:56 brister Exp $ */
/* $Id: confip.c,v 1.29 2000/07/26 18:47:36 mws Exp $ */
#include <config.h>
......@@ -775,8 +775,9 @@ isc_result_t
dns_c_iplist_new(isc_mem_t *mem, int length, dns_c_iplist_t **newlist) {
dns_c_iplist_t *list;
size_t bytes;
#ifndef NOMINUM_PUBLIC
int i;
#endif /* NOMINUM_PUBLIC */
REQUIRE(mem != NULL);
REQUIRE(length > 0);
REQUIRE(newlist != NULL);
......@@ -796,6 +797,7 @@ dns_c_iplist_new(isc_mem_t *mem, int length, dns_c_iplist_t **newlist) {
bytes = sizeof (dns_name_t *) * length;
#ifndef NOMINUM_PUBLIC
list->keys = isc_mem_get(mem, bytes);
if (list->keys == NULL) {
isc_mem_put(mem, list->ips, sizeof (isc_sockaddr_t) * length);
......@@ -804,7 +806,7 @@ dns_c_iplist_new(isc_mem_t *mem, int length, dns_c_iplist_t **newlist) {
}
for (i = 0 ; i < length ; i++)
list->keys[i] = NULL;
#endif /* NOMINUM_PUBLIC */
list->magic = DNS_C_IPLIST_MAGIC;
list->size = length;
......@@ -834,6 +836,7 @@ dns_c_iplist_detach(dns_c_iplist_t **list) {
l->refcount--;
if (l->refcount == 0) {
#ifndef NOMINUM_PUBLIC
for (i = 0 ; i < l->size ; i++) {
if (l->keys[i] != NULL) {
dns_name_free(l->keys[i], l->mem);
......@@ -842,8 +845,8 @@ dns_c_iplist_detach(dns_c_iplist_t **list) {
l->keys[i] = NULL;
}
}
isc_mem_put(l->mem, l->keys, sizeof (dns_name_t *) * l->size);
#endif /* NOMINUM_PUBLIC */
isc_mem_put(l->mem, l->ips, sizeof (isc_sockaddr_t) * l->size);
isc_mem_put(l->mem, l, sizeof *l);
}
......@@ -853,7 +856,7 @@ dns_c_iplist_detach(dns_c_iplist_t **list) {
return (ISC_R_SUCCESS);
}
#ifndef NOMINUM_PUBLIC
isc_boolean_t
dns_c_iplist_haskeys(dns_c_iplist_t *list)
{
......@@ -871,7 +874,7 @@ dns_c_iplist_haskeys(dns_c_iplist_t *list)
return (ISC_FALSE);
}
#endif /* NOMINUM_PUBLIC */
void
dns_c_iplist_attach(dns_c_iplist_t *source, dns_c_iplist_t **target) {
......@@ -898,6 +901,7 @@ dns_c_iplist_copy(isc_mem_t *mem, dns_c_iplist_t **dest, dns_c_iplist_t *src) {
for (i = 0 ; i < src->nextidx ; i++) {
newl->ips[i] = src->ips[i];
#ifndef NOMINUM_PUBLIC
if (src->keys[i] != NULL) {
newl->keys[i] = isc_mem_get(mem, sizeof (dns_name_t));
if (newl->keys[i] == NULL) {
......@@ -912,6 +916,7 @@ dns_c_iplist_copy(isc_mem_t *mem, dns_c_iplist_t **dest, dns_c_iplist_t *src) {
}
}
}
#endif /* NOMINUM_PUBLIC */
}
newl->nextidx = src->nextidx;
......@@ -935,6 +940,7 @@ dns_c_iplist_equal(dns_c_iplist_t *list1, dns_c_iplist_t *list2) {
if (!isc_sockaddr_equal(&list1->ips[i], &list2->ips[i]))
return (ISC_FALSE);
#ifndef NOMINUM_PUBLIC
if ((list1->keys[i] == NULL && list2->keys[i] != NULL) ||
(list1->keys[i] != NULL && list2->keys[i] == NULL))
return (ISC_FALSE);
......@@ -942,6 +948,7 @@ dns_c_iplist_equal(dns_c_iplist_t *list1, dns_c_iplist_t *list2) {
if (list1->keys[i] != NULL &&
!dns_name_equal(list1->keys[i], list2->keys[i]))
return (ISC_FALSE);
#endif /* NOMINUM_PUBLIC */
}
return (ISC_TRUE);
......@@ -951,7 +958,9 @@ void
dns_c_iplist_printfully(FILE *fp, int indent, isc_boolean_t porttoo,
dns_c_iplist_t *list)
{
#ifndef NOMINUM_PUBLIC
isc_uint32_t i;
#endif /* NOMINUM_PUBLIC */
in_port_t port;
in_port_t tmpport;
isc_boolean_t athead = ISC_TRUE;
......@@ -991,11 +1000,13 @@ dns_c_iplist_printfully(FILE *fp, int indent, isc_boolean_t porttoo,
fprintf(fp, " port %d",
isc_sockaddr_getport(&list->ips[i]));
}
#ifndef NOMINUM_PUBLIC
if (list->keys[i] != NULL) {
fprintf(fp, " key \"");
dns_name_print(list->keys[i], fp);
fprintf(fp, "\" ");
}
#endif /* NOMINUM_PUBLIC */
fprintf(fp, ";\n");
}
dns_c_printtabs(fp, indent - 1);
......@@ -1010,9 +1021,15 @@ dns_c_iplist_print(FILE *fp, int indent, dns_c_iplist_t *list) {
dns_c_iplist_printfully(fp, indent, ISC_FALSE, list);
}
#ifndef NOMINUM_PUBLIC
isc_result_t
dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr,
const char *key) {
const char *key)
{
#else /* NOMINUM_PUBLIC */
isc_result_t
dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr) {
#endif /* NOMINUM_PUBLIC */
isc_uint32_t i;
isc_result_t res;
......@@ -1030,7 +1047,9 @@ dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr,
if (list->nextidx == list->size) {
isc_sockaddr_t *newlist;
#ifndef NOMINUM_PUBLIC
dns_name_t **newkeys;
#endif /* NOMINUM_PUBLIC */
size_t newbytes;
size_t oldbytes = list->size * sizeof (list->ips[0]);
size_t newsize = list->size + 10;
......@@ -1047,6 +1066,7 @@ dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr,
isc_mem_put(list->mem, list->ips, oldbytes);
list->ips = newlist;
#ifndef NOMINUM_PUBLIC
oldbytes = list->size * sizeof(list->keys[0]);
newbytes = sizeof (list->ips[0]) * newsize;
newkeys = isc_mem_get(list->mem, newbytes);
......@@ -1059,6 +1079,7 @@ dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr,
list->keys[i] = NULL;
isc_mem_put(list->mem, list->keys, oldbytes);
list->keys = newkeys;
#endif /* NOMINUM_PUBLIC */
i = list->size;
list->size = newsize;
......@@ -1070,6 +1091,7 @@ dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr,
res = ISC_R_SUCCESS;
#ifndef NOMINUM_PUBLIC
if (key != NULL) {
if (list->keys[i] != NULL) {
dns_name_free(list->keys[i], list->mem);
......@@ -1080,6 +1102,7 @@ dns_c_iplist_append(dns_c_iplist_t *list, isc_sockaddr_t newaddr,
res = dns_c_charptoname(list->mem, key, &list->keys[i]);
}
#endif /* NOMINUM_PUBLIC */
return (res);
}
......@@ -1104,11 +1127,13 @@ dns_c_iplist_remove(dns_c_iplist_t *list, isc_sockaddr_t newaddr) {
list->nextidx--;
#ifndef NOMINUM_PUBLIC
if (list->keys[i] != NULL) {
dns_name_reset(list->keys[i]);
isc_mem_put(list->mem, list->keys[i], sizeof (dns_name_t));
}
#endif /* NOMINUM_PUBLIC */
for ( /* nothing */ ; i < list->nextidx ; i++) {
list->ips[i] = list->ips[i + 1];
list->keys[i] = list->keys[i + 1];
......
......@@ -16,7 +16,7 @@
* SOFTWARE.
*/
/* $Id: confparser.y,v 1.106 2000/07/25 17:55:39 brister Exp $ */
/* $Id: confparser.y,v 1.107 2000/07/26 18:47:38 mws Exp $ */
#include <config.h>
......@@ -1817,7 +1817,7 @@ ip_and_port_list: ip_and_port_element maybe_key L_EOS
if ($3 != NULL) {
isc_mem_free(memctx, $3);
}
$$ = $1;
}
;
......
This diff is collapsed.
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: confip.h,v 1.23 2000/07/21 21:25:00 brister Exp $ */
/* $Id: confip.h,v 1.24 2000/07/26 18:47:41 mws Exp $ */
#ifndef DNS_CONFIP_H
#define DNS_CONFIP_H 1
......@@ -95,7 +95,9 @@ struct dns_c_iplist {
isc_mem_t *mem;
int refcount;
isc_sockaddr_t *ips;
#ifndef NOMINUM_PUBLIC
dns_name_t **keys;
#endif /* NOMINUM_PUBLIC */
isc_uint32_t size;
isc_uint32_t nextidx;
};
......@@ -227,12 +229,19 @@ isc_result_t dns_c_iplist_detach(dns_c_iplist_t **list);
isc_result_t dns_c_iplist_copy(isc_mem_t *mem, dns_c_iplist_t **dest,
dns_c_iplist_t *src);
#ifndef NOMINUM_PUBLIC
isc_boolean_t dns_c_iplist_haskeys(dns_c_iplist_t *list);
#endif /* NOMINUM_PUBLIC */
void dns_c_iplist_attach(dns_c_iplist_t *source, dns_c_iplist_t **target);
#ifndef NOMINUM_PUBLIC
isc_result_t dns_c_iplist_append(dns_c_iplist_t *list,
isc_sockaddr_t newaddr, const char *key);
#else /* NOMINUM_PUBLIC */
isc_result_t dns_c_iplist_append(dns_c_iplist_t *list,
isc_sockaddr_t newaddr, const char *key);
#endif /* NOMINUM_PUBLIC */
isc_result_t dns_c_iplist_remove(dns_c_iplist_t *list, isc_sockaddr_t newaddr);
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: zone.h,v 1.61 2000/07/24 22:59:44 explorer Exp $ */
/* $Id: zone.h,v 1.62 2000/07/26 18:47:42 mws Exp $ */
#ifndef DNS_ZONE_H
#define DNS_ZONE_H 1
......@@ -351,9 +351,11 @@ dns_zone_maintenance(dns_zone_t *zone);
isc_result_t
dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters,
isc_uint32_t count);
#ifndef NOMINUM_PUBLIC
isc_result_t
dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
dns_name_t **keynames, isc_uint32_t count);
#endif /* NOMINUM_PUBLIC */
/*
* Set the list of master servers for the zone.
*
......@@ -361,17 +363,21 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
* 'zone' to be a valid zone.
* 'masters' array of isc_sockaddr_t with port set or NULL.
* 'count' the number of masters.
#ifndef NOMINUM_PUBLIC
* 'keynames' array of dns_name_t's for tsig keys or NULL.
*
* dns_zone_setmasters() is just a wrapper to setmasterswithkeys(),
* passing NULL in the keynames field.
#endif NOMINUM_PUBLIC
*
* If 'masters' is NULL then 'count' must be zero.
*
* Returns:
* ISC_R_SUCCESS
* ISC_R_NOMEMORY
#ifndef NOMINUM_PUBLIC
* Any result dns_name_dup() can return, if keynames!=NULL
#endif NOMINUM_PUBLIC
*/
isc_result_t
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: zone.c,v 1.167 2000/07/25 19:29:00 mws Exp $ */
/* $Id: zone.c,v 1.168 2000/07/26 18:47:32 mws Exp $ */
#include <config.h>
......@@ -132,7 +132,9 @@ struct dns_zone {
isc_uint32_t expire;
isc_uint32_t minimum;
isc_sockaddr_t *masters;
#ifndef NOMINUM_PUBLIC
dns_name_t **masterkeynames;
#endif /* NOMINUM_PUBLIC */
unsigned int masterscnt;
unsigned int curmaster;
isc_sockaddr_t masteraddr;
......@@ -362,7 +364,9 @@ dns_zone_create(dns_zone_t **zonep, isc_mem_t *mctx) {
zone->expire = 0;
zone->minimum = 0;
zone->masters = NULL;
#ifndef NOMINUM_PUBLIC
zone->masterkeynames = NULL;
#endif /* NOMINUM_PUBLIC */
zone->masterscnt = 0;
zone->curmaster = 0;
zone->notify = NULL;
......@@ -439,7 +443,11 @@ zone_free(dns_zone_t *zone) {
if (zone->db != NULL)
dns_db_detach(&zone->db);
dns_zone_cleardbargs(zone);
#ifndef NOMINUM_PUBLIC
dns_zone_setmasterswithkeys(zone, NULL, NULL, 0);
#else /* NOMINUM_PUBLIC */
dns_zone_setmasters(zone, NULL, 0);
#endif /* NOMINUM_PUBLIC */
dns_zone_setalsonotify(zone, NULL, 0);
zone->check_names = dns_severity_ignore;
if (zone->update_acl != NULL)
......@@ -1271,6 +1279,7 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,
return (ISC_R_SUCCESS);
}
#ifndef NOMINUM_PUBLIC
isc_result_t
dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters,
isc_uint32_t count)
......@@ -1284,24 +1293,34 @@ dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters,
isc_result_t
dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
dns_name_t **keynames, isc_uint32_t count)
#else /* NOMINUM_PUBLIC */
isc_result_t
dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters,
isc_uint32_t count)
#endif /* NOMINUM_PUBLIC */
{
isc_sockaddr_t *new;
dns_name_t **newname;
isc_result_t result = ISC_R_SUCCESS;
#ifndef NOMINUM_PUBLIC
dns_name_t **newname;
unsigned int i;
#endif /* NOMINUM_PUBLIC */
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(count == 0 || masters != NULL);
#ifndef NOMINUM_PUBLIC
if (keynames != NULL) {
REQUIRE(count != 0);
}
#endif /* NOMINUM_PUBLIC */
LOCK(&zone->lock);
if (zone->masters != NULL) {
isc_mem_put(zone->mctx, zone->masters,
zone->masterscnt * sizeof *new);
zone->masters = NULL;
}
#ifndef NOMINUM_PUBLIC
if (zone->masterkeynames != NULL) {
for (i = 0; i < zone->masterscnt; i++) {
if (zone->masterkeynames[i] != NULL) {
......@@ -1317,6 +1336,7 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
zone->masterscnt * sizeof(dns_name_t *));
zone->masterkeynames = NULL;
}
#endif /* NOMINUM_PUBLIC */
zone->masterscnt = 0;
/*
* If count == 0, don't allocate any space for masters or keynames
......@@ -1339,6 +1359,7 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
zone->masterscnt = count;
zone->flags &= ~DNS_ZONEFLG_NOMASTERS;
#ifndef NOMINUM_PUBLIC
/*
* if keynames is non-NULL, it must contain count elements!
*/
......@@ -1379,6 +1400,7 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
}
zone->masterkeynames = newname;
}
#endif /* NOMINUM_PUBLIC */
unlock:
UNLOCK(&zone->lock);
return (result);
......@@ -4044,6 +4066,9 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) {
/*
* Determine if we should attempt to sign the request with TSIG.
*/
#ifndef NOMINUM_PUBLIC
/*
* First, look for a tsig key in the master statement, then
* try for a server key.
*/
......@@ -4053,7 +4078,9 @@ got_transfer_quota(isc_task_t *task, isc_event_t *event) {
keyname = zone->masterkeynames[zone->curmaster];
gotkey = ISC_TRUE;
}
else if (peer != NULL &&
else
#endif /* NOMINUM_PUBLIC */
if (peer != NULL &&
dns_peer_getkey(peer, &keyname) == ISC_R_SUCCESS) {
view = dns_zone_getview(zone);
gotkey = ISC_TRUE;
......
......@@ -15,7 +15,7 @@
* SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.47 2000/07/25 20:26:11 bwelling Exp $ */
/* $Id: zoneconf.c,v 1.48 2000/07/26 18:47:34 mws Exp $ */
#include <config.h>
......@@ -272,10 +272,15 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
iplist = NULL;
result = dns_c_zone_getmasterips(czone, &iplist);
if (result == ISC_R_SUCCESS)
#ifndef NOMINUM_PUBLIC
result = dns_zone_setmasterswithkeys(zone,
iplist->ips,
iplist->keys,
iplist->nextidx);
#else /* NOMINUM_PUBLIC */
result = dns_zone_setmasters(zone, iplist->ips,
iplist->nextidx);
#endif /* NOMINUM_PUBLIC */
else
result = dns_zone_setmasters(zone, NULL, 0);
RETERR(result);
......
#!/usr/bin/perl
#
# Copyright (C) 1999, 2000 Internet Software Consortium.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# $Id: sanitize.pl,v 1.1 2000/07/26 18:47:43 mws Exp $
# Don't try and sanitize this file: NOMINUM_IGNORE
# Go through the directory tree and make sure that all of the files are
# sanitized.
#
# In normal mode, check file, removing code between
# #ifndef NOMINUM_PUBLIC
# and the accompanying #else or #endif. Similarly, code in an #else
# clause after an #ifndef test will be removed. The #else or #endif's
# must appear as:
# #else /* NOMINUM_PUBLIC */
# #endif /* NOMINUM_PUBLIC */
# Balance is tested.
# Non-.c/.h files are tested for the existance of NOMINUM_PUBLIC anywhere
# in the file, and a warning is generated, unless the string
# NOMINUM_IGNORE appears before NOMINUM_PUBLIC.
# Usage:
# ./sanitize.pl -c - Check syntax only, don't change anything
# ./sanitize.pl -i - Reverse sense of sanitize.
# ./sanitize.pl - - Work as a pipe, sanitizing stdin to stdout.
# ./sanitize.pl file - Sanitize the specified file.
$makechange = 1;
$state = 0;
$showon = 1;
$debug = 0;
# States:
# 0 - Outside of test, include code
# 1 - Inside NOMINUM_PUBLIC
# 2 - Inside !NOMINUM_PUBLIC
foreach $arg (@ARGV) {
$_ = $arg;
if (/^-c$/i) {
$makechange = 0;
}
elsif (/^-i$/i) {
$showon = 2;
}
elsif (/^-$/i) {
&runfile("-","-");
}
# elsif (/^-a$/i) {
# &rundir();
# }
elsif (/^-d$/i) {
$debug = 1;
}
else {
&runfile($arg, $arg.".sanitize");
}
}
exit(0);
sub runfile($) {
$state = 0;
open(INFILE, $_[0]) || die ("$_[0]");
open(OUTFILE, ">$_[1]") || die ("$_[1]")
if ($makechange);
while (<INFILE>) {
if (/NOMINUM_IGNORE/) {
close(INFILE);
close(OUTFILE);
unlink($_[1]);
break;
}
if (/\#ifdef.+NOMINUM_PUBLIC/) {
if ($state != 0) {
print(STDERR "*** ERROR in file $_[0]: ".
"Found #ifdef without matching ".
"#endif.\n");
close(INFILE);
close(OUTFILE) if ($makechange);
unlink($_[1]);
break;
}
$state = 1;
}
elsif (/\#ifndef.+NOMINUM_PUBLIC/) {
if ($state != 0) {
print(STDERR "*** ERROR in file $_[0]: ".
"Found #ifndef without matching ".
"#endif.\n");
close(INFILE);
close(OUTFILE) if ($makechange);
unlink($_[1]);
break;
}
$state = 2;
}
elsif (/\#else.+NOMINUM_PUBLIC/) {
if ($state == 0) {
print(STDERR "*** ERROR in file $_[0]: ".
"Found #else without matching ".
"#if[n]def.\n");
close(INFILE);
close(OUTFILE) if ($makechange);
unlink($_[1]);
break;
}
if ($state == 1) {
$state = 2;
} else {
$state = 1;
}
}
elsif (/\#endif.+NOMINUM_PUBLIC/) {
if ($state == 0) {
print(STDERR "*** ERROR in file $_[0]: ".
"Found #else without matching ".
"#if[n]def.\n");
close(INFILE);
close(OUTFILE) if ($makechange);