syntax error in MX record

Miek Gieben miekg at atoom.net
Tue Aug 17 10:52:45 UTC 2004


[On 16 Aug, @20:35, Phil wrote in "syntax error in MX record ..."]
> Here's one that worked in NSD 1 but breaks in NSD 2:
> 
> @ 12h IN MX 0 @
> 
> It seems that the check on valid characters for the target host name for
> the MX doesn't include the "@".  I wonder if it works for ".".  I worked
> around this for now.

here is a patch against 2.1.2. This should add the usage of @ in the
rdata of any type. I only tested it MX and NS,

grtz Miek


--- begin patch ----
Index: RELNOTES
===================================================================
RCS file: /cvs/nsd/RELNOTES,v
retrieving revision 1.38
diff -u -r1.38 RELNOTES
--- RELNOTES	29 Jul 2004 11:46:45 -0000	1.38
+++ RELNOTES	17 Aug 2004 10:30:13 -0000
@@ -1,5 +1,12 @@
 NSD RELEASE NOTES
 
+2.1.3
+=============
+FEATURES:
+
+BUG FIXES:
+	- Bug #87: allow @ in the rdata
+
 2.1.2
 =============
 FEATURES:
Index: zlexer.lex
===================================================================
RCS file: /cvs/nsd/zlexer.lex,v
retrieving revision 1.46
diff -u -r1.46 zlexer.lex
--- zlexer.lex	28 Jul 2004 11:43:53 -0000	1.46
+++ zlexer.lex	17 Aug 2004 10:30:13 -0000
@@ -34,7 +34,7 @@
 SPACE   [ \t]
 LETTER  [a-zA-Z]
 NEWLINE \n
-ZONESTR [a-zA-Z0-9+/=:_!\-\*#%&^\[\]?]
+ZONESTR [a-zA-Z0-9+/=:_!\-\*#%&^\[\]?@]
 DOLLAR  \$
 COMMENT ;
 DOT     \.
@@ -49,6 +49,7 @@
     static enum rr_spot in_rr = outside;
 {SPACE}*{COMMENT}.*     /* ignore */
 ^@                      {
+		            LEXOUT(("ORIGIN "));		
                             in_rr = expecting_dname;
                             return ORIGIN;
                         }
@@ -347,6 +348,16 @@
 		}
 		/* fall through, default first, order matters */
 	default:
+		/* check to see if some body used @ in the rdata
+		 * if so return the origin str, and RD_ORIGIN token
+		 */
+		if (strcasecmp(yytext, "@") == 0) {
+			ztext = (char *)dname_to_string(domain_dname(parser->origin));
+			yylval.data.len = strlen(ztext);
+			yylval.data.str = ztext;
+			LEXOUT(("RDATA_ORI "));
+			return RD_ORIGIN;
+		}
 		ztext = region_strdup(parser->rr_region, yytext);
 		yylval.data.len = zoctet(ztext);
 		yylval.data.str = ztext;
Index: zparser.y
===================================================================
RCS file: /cvs/nsd/zparser.y,v
retrieving revision 1.73
diff -u -r1.73 zparser.y
--- zparser.y	9 Aug 2004 11:47:36 -0000	1.73
+++ zparser.y	17 Aug 2004 10:30:13 -0000
@@ -54,7 +54,7 @@
 %token <type> T_AXFR T_MAILB T_MAILA T_DS T_SSHFP T_RRSIG T_NSEC T_DNSKEY
 
 /* other tokens */
-%token         DIR_TTL DIR_ORIG NL ORIGIN SP
+%token         DIR_TTL DIR_ORIG NL ORIGIN SP RD_ORIGIN
 %token <data>  STR PREV TTL
 %token <klass> T_IN T_CH T_HS
 
@@ -232,6 +232,10 @@
     {
 	    $$ = parser->db->domains->root;
     }
+    | 	    RD_ORIGIN
+    {
+	    $$ = parser->origin;
+    }
     |       rel_dname '.'
     { 
 	    if ($1 != error_dname) {



More information about the nsd-users mailing list