CRLF as line terminator in zone file

Joe Abley jabley at patho.gen.nz
Tue Oct 5 12:55:59 UTC 1999


On Wed, Oct 06, 1999 at 12:59:49AM +1300, Joe Abley wrote:
> Here's a patch for the release 8.2.1 source. It introduces a new
> boolean option "treat-cr-as-space" in named.conf which, when turned
> on, causes any CR's found in zone files to be treated as spaces.
> It is off by default, with this patch applied.

Well, I don't know what release of bind that patch was for, but
on reflection it doesn't look much like 8.2.1. Mmm. Need Sleep.
Sleep good.

Here's an updated patch, which I have just verified _is_ for
8.2.1. Does the same thing. Sorry about replying to my own mail so
much.

> Feedback welcome.


Joe

--- src.orig/bin/named/db_load.c	Fri Jun 11 13:25:48 1999
+++ src/bin/named/db_load.c	Wed Oct  6 01:39:13 1999
@@ -1176,6 +1176,11 @@
 			lineno++;
 			continue;
 
+		case '\r':
+			if (NS_OPTION_P(OPTION_TREAT_CR_AS_SPACE) != 0)
+				return (CURRENT); /* just like ' ', '\t' */
+			/* else fall through to default handling */
+
 		default:
 			(void) ungetc(c, fp);
 			return (DNAME);
--- src.orig/bin/named/ns_defs.h	Fri Jun 18 15:03:01 1999
+++ src/bin/named/ns_defs.h	Wed Oct  6 01:37:28 1999
@@ -187,6 +187,7 @@
 #define OPTION_NORFC2308_TYPE1	0x0400	/* Prevent type1 respones (RFC 2308)
 					 * to cached negative respones */
 #define	OPTION_USE_ID_POOL	0x0800	/* Use the memory hogging query ID */
+#define OPTION_TREAT_CR_AS_SPACE	0x1000 /* treat CR in zone files as space */
 
 #define	DEFAULT_OPTION_FLAGS	(OPTION_NODIALUP|OPTION_NONAUTH_NXDOMAIN|\
 				 OPTION_USE_ID_POOL|OPTION_NORFC2308_TYPE1)
--- src.orig/bin/named/ns_lexer.c	Mon Jun 21 11:55:26 1999
+++ src/bin/named/ns_lexer.c	Wed Oct  6 01:36:13 1999
@@ -324,6 +324,7 @@
 	{"transfers-in", T_TRANSFERS_IN}, 
 	{"transfers-out", T_TRANSFERS_OUT}, 
 	{"transfers-per-ns", T_TRANSFERS_PER_NS}, 
+	{"treat-cr-as-space", T_TREAT_CR_AS_SPACE},
 	{"true", T_TRUE}, 
 	{"trusted-keys", T_TRUSTED_KEYS},
 	{"type", T_TYPE},
--- src.orig/bin/named/ns_parser.y	Fri Jun 18 15:03:02 1999
+++ src/bin/named/ns_parser.y	Wed Oct  6 01:42:24 1999
@@ -153,6 +153,7 @@
 %token			T_HEARTBEAT T_USE_ID_POOL
 %token			T_MAX_NCACHE_TTL T_HAS_OLD_CLIENTS T_RFC2308_TYPE1
 %token			T_LAME_TTL
+%token			T_TREAT_CR_AS_SPACE
 
 /* Items used for the "logging" statement: */
 %token			T_LOGGING T_CATEGORY T_CHANNEL T_SEVERITY T_DYNAMIC
@@ -540,6 +541,10 @@
 			free_rrset_order_list(current_options->ordering);
 		current_options->ordering = $3;
 	}
+	| T_TREAT_CR_AS_SPACE yea_or_nay
+        { 
+		set_global_boolean_option(current_options, OPTION_TREAT_CR_AS_SPACE, $2);
+	}       
 	| error
 	;
 


More information about the bind-users mailing list