From jpd@dsb.tudelft.nl  Sun Dec  7 12:44:31 2008
Return-Path: <jpd@dsb.tudelft.nl>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D1A581065672
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  7 Dec 2008 12:44:31 +0000 (UTC)
	(envelope-from jpd@dsb.tudelft.nl)
Received: from www73.your-server.de (www73.your-server.de [213.133.104.73])
	by mx1.freebsd.org (Postfix) with ESMTP id 94EE58FC1B
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  7 Dec 2008 12:44:31 +0000 (UTC)
	(envelope-from jpd@dsb.tudelft.nl)
Received: from [85.178.118.193] (helo=localhost)
	by www73.your-server.de with esmtpsa (TLSv1:AES256-SHA:256)
	(Exim 4.69)
	(envelope-from <jpd@dsb.tudelft.nl>)
	id 1L9Ie3-0001A9-41
	for FreeBSD-gnats-submit@freebsd.org; Sun, 07 Dec 2008 13:21:55 +0100
Message-Id: <20081207122131.GB18736@novh.net>
Date: Sun, 7 Dec 2008 13:21:31 +0100
From: jpd@dsb.tudelft.nl
Reply-To: jpd@dsb.tudelft.nl
To: FreeBSD-gnats-submit@freebsd.org
Subject: no way found to force standards compliance in resolver
X-Send-Pr-Version: 3.113

>Number:         129477
>Category:       kern
>Synopsis:       [request] resolver(5): knob to force standards compliance in resolver
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 07 12:50:02 UTC 2008
>Closed-Date:    Mon Sep 28 22:32:47 UTC 2009
>Last-Modified:  Mon Sep 28 22:40:01 UTC 2009
>Originator:     
>Release:        FreeBSD 6.4-RELEASE
>Organization:
>Environment:
FreeBSD 6.4-RELEASE from reading the release notes and cgi manpage.
>Description:
I notice that the release notes for 6.4-RELEASE (as read in [4])
announce that the resolver subsystem now allows lookups for labels that
violate the standard by inclusion of `_' (underscore) characters, with a
rationale given of ``all the cool kids are doing it''.

Suppose that for whatever reason I'd like standards compliance more
than resolving DNS requests that include non-compliant labels. Then it
would be useful to be able to disable this (mis)feature. I would ask for
standards compliance by default but will settle for having the option at
all. Same thing for an appropriate flag to resolver(3).

Where is the option to disallow underscores? I did not see it documented
in resolver(5) (as retrieved from [5]).

[4] http://www.FreeBSD.org/releases/6.4R/relnotes-i386.html
[5] http://www.freebsd.org/cgi/man.cgi?query=resolver&sektion=5&manpath=FreeBSD+6.4-RELEASE

>How-To-Repeat:
>Fix:
Add options to resolv.conf and the resolver library to enable/disable
standards conformance, document their existence.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->delphij 
Responsible-Changed-By: remko 
Responsible-Changed-When: Mon Dec 8 08:43:41 UTC 2008 
Responsible-Changed-Why:  
Hi Xin, I remember you worked on the DNS things? can you shed a light on 
this pelase? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=129477 

From: David Schultz <das@FreeBSD.ORG>
To: jpd@dsb.tudelft.nl
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/129477: no way found to force standards compliance in resolver
Date: Mon, 8 Dec 2008 15:27:22 -0500

 On Sun, Dec 07, 2008, jpd@dsb.tudelft.nl wrote:
 > Suppose that for whatever reason I'd like standards compliance more
 > than resolving DNS requests that include non-compliant labels. Then it
 > would be useful to be able to disable this (mis)feature.
 
 Did you have a pragmatic reason in mind, or is this purely
 hypothetical?

From: jpd@dsb.tudelft.nl
To: David Schultz <das@FreeBSD.ORG>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/129477: no way found to force standards compliance in resolver
Date: Mon, 8 Dec 2008 22:23:11 +0100

 On Mon, Dec 08, 2008 at 15:27:22 -0500, David Schultz wrote:
 > On Sun, Dec 07, 2008, jpd@dsb.tudelft.nl wrote:
 > > Suppose that for whatever reason I'd like standards compliance more
 > > than resolving DNS requests that include non-compliant labels. Then it
 > > would be useful to be able to disable this (mis)feature.
 > 
 > Did you have a pragmatic reason in mind, or is this purely
 > hypothetical?
 
 Any time a company policy mandating standards compliance pops up, for
 one. Honestly, I am fairly offended that you are asking me to justify
 why standards compliance is a good thing to an open source project.
 Especially seeing FreeBSD's previous track record of offering options
 even when you never thought you needed them.
 

From: David Schultz <das@FreeBSD.ORG>
To: jpd@dsb.tudelft.nl
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/129477: no way found to force standards compliance in resolver
Date: Mon, 8 Dec 2008 17:49:23 -0500

 On Mon, Dec 08, 2008, jpd@dsb.tudelft.nl wrote:
 > On Mon, Dec 08, 2008 at 15:27:22 -0500, David Schultz wrote:
 > > On Sun, Dec 07, 2008, jpd@dsb.tudelft.nl wrote:
 > > > Suppose that for whatever reason I'd like standards compliance more
 > > > than resolving DNS requests that include non-compliant labels. Then it
 > > > would be useful to be able to disable this (mis)feature.
 > > 
 > > Did you have a pragmatic reason in mind, or is this purely
 > > hypothetical?
 > 
 > Any time a company policy mandating standards compliance pops up, for
 > one. Honestly, I am fairly offended that you are asking me to justify
 > why standards compliance is a good thing to an open source project.
 
 I was asking because this issue was discussed to death when the
 change was made, including proposals to add a resolv.conf option,
 and I was wondering whether you had anything substantive to add.
 
 IIRC, the conclusion at the time was that every other OS out there
 allows underscores, so that's the de facto standard, and there's
 little value in being so pedantic about the ARPANET host name
 rules 5 decades later. Then again, if it's easy to add the knob...

From: jpd@dsb.tudelft.nl
To: David Schultz <das@FreeBSD.ORG>
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: bin/129477: no way found to force standards compliance in resolver
Date: Tue, 9 Dec 2008 00:29:45 +0100

 On Mon, Dec 08, 2008 at 17:49:23 -0500, David Schultz wrote:
 > I was asking because this issue was discussed to death when the
 > change was made, including proposals to add a resolv.conf option,
 > and I was wondering whether you had anything substantive to add.
 
 ``What on earth did move these fine people to fail to add the option
   while busily breaking the standard?''
 
 
 > IIRC, the conclusion at the time was that every other OS out there
 > allows underscores, so that's the de facto standard, and there's
 > little value in being so pedantic about the ARPANET host name
 > rules 5 decades later.
 
 If we're going to be practical, then it's prudent ask why the standard
 hasn't been updated yet. RFCs are community driven, so if FreeBSD is
 truly the last of the mohicans it might as well initiate putting an end
 to the discrepancy. Note that I did not even ask to strictly adhere to
 the standard in all cases, but to allow people who want to to do so.
 
 I don't have a detailed survey of which resolver supports what, exactly,
 but if you're going to stick to the ``everybody else'' argument: I am
 someone else and I'm asking.
 
 
 > Then again, if it's easy to add the knob...
 
 As soon as I have access to a box with suitable source installation again.
 
State-Changed-From-To: open->patched 
State-Changed-By: delphij 
State-Changed-When: Fri May 29 07:35:09 UTC 2009 
State-Changed-Why:  
I have applied a patch that user can request strict RFC 1034 
check by defining RES_ENFORCE_RFC1034 while compiling libc. 

Documentation to follow. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=129477 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/129477: commit references a PR
Date: Fri, 29 May 2009 07:35:11 +0000 (UTC)

 Author: delphij
 Date: Fri May 29 07:34:54 2009
 New Revision: 193023
 URL: http://svn.freebsd.org/changeset/base/193023
 
 Log:
   Add an option to enforce strict RFC 1034 compliance.
   
   PR:		kern/129477
 
 Modified:
   head/lib/libc/resolv/res_comp.c
 
 Modified: head/lib/libc/resolv/res_comp.c
 ==============================================================================
 --- head/lib/libc/resolv/res_comp.c	Fri May 29 07:26:44 2009	(r193022)
 +++ head/lib/libc/resolv/res_comp.c	Fri May 29 07:34:54 2009	(r193023)
 @@ -148,7 +148,11 @@ dn_skipname(const u_char *ptr, const u_c
  #define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
  
  #define borderchar(c) (alphachar(c) || digitchar(c))
 +#ifdef	RES_ENFORCE_RFC1034
 +#define middlechar(c) (borderchar(c) || hyphenchar(c))
 +#else
  #define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
 +#endif
  #define	domainchar(c) ((c) > 0x20 && (c) < 0x7f)
  
  int
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/129477: commit references a PR
Date: Fri, 29 May 2009 07:55:54 +0000 (UTC)

 Author: delphij
 Date: Fri May 29 07:55:44 2009
 New Revision: 193024
 URL: http://svn.freebsd.org/changeset/base/193024
 
 Log:
   Document how to enable strict RFC 1034 enforcements.
   
   PR:		kern/129477
 
 Modified:
   head/lib/libc/net/resolver.3
 
 Modified: head/lib/libc/net/resolver.3
 ==============================================================================
 --- head/lib/libc/net/resolver.3	Fri May 29 07:34:54 2009	(r193023)
 +++ head/lib/libc/net/resolver.3	Fri May 29 07:55:44 2009	(r193024)
 @@ -28,7 +28,7 @@
  .\"     @(#)resolver.3	8.1 (Berkeley) 6/4/93
  .\" $FreeBSD$
  .\"
 -.Dd November 4, 2006
 +.Dd May 29, 2009
  .Dt RESOLVER 3
  .Os
  .Sh NAME
 @@ -401,6 +401,19 @@ function properly if the programmer atte
  .Va _res
  structure in an attempt to replace the per-thread version referred to
  by that macro.
 +.Pp
 +The following compile-time option can be specified to change the default
 +behavior of resolver routines when necessary.
 +.Bl -tag -width RES_ENFORCE_RFC1034
 +.It Dv RES_ENFORCE_RFC1034
 +If this symbol is defined during compile-time,
 +.Fn res_search
 +will enforce RFC 1034 check, namely, disallow using of underscore character
 +within host names.
 +This is used by the standard host lookup routines like
 +.Xr gethostbyname 3 .
 +For compatibility reasons this option is not enabled by default.
 +.El
  .Sh RETURN VALUES
  The
  .Fn res_init
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/129477: commit references a PR
Date: Mon, 28 Sep 2009 22:29:43 +0000 (UTC)

 Author: delphij
 Date: Mon Sep 28 22:29:28 2009
 New Revision: 197601
 URL: http://svn.freebsd.org/changeset/base/197601
 
 Log:
   MFC 193023+193024:
   
   Add an option to enforce strict RFC 1034 compliance.
   Document how to enable strict RFC 1034 enforcements.
   
   PR:		kern/129477
 
 Modified:
   stable/7/lib/libc/   (props changed)
   stable/7/lib/libc/net/resolver.3
   stable/7/lib/libc/resolv/res_comp.c
 
 Modified: stable/7/lib/libc/net/resolver.3
 ==============================================================================
 --- stable/7/lib/libc/net/resolver.3	Mon Sep 28 22:18:38 2009	(r197600)
 +++ stable/7/lib/libc/net/resolver.3	Mon Sep 28 22:29:28 2009	(r197601)
 @@ -28,7 +28,7 @@
  .\"     @(#)resolver.3	8.1 (Berkeley) 6/4/93
  .\" $FreeBSD$
  .\"
 -.Dd November 4, 2006
 +.Dd May 29, 2009
  .Dt RESOLVER 3
  .Os
  .Sh NAME
 @@ -401,6 +401,19 @@ function properly if the programmer atte
  .Va _res
  structure in an attempt to replace the per-thread version referred to
  by that macro.
 +.Pp
 +The following compile-time option can be specified to change the default
 +behavior of resolver routines when necessary.
 +.Bl -tag -width RES_ENFORCE_RFC1034
 +.It Dv RES_ENFORCE_RFC1034
 +If this symbol is defined during compile-time,
 +.Fn res_search
 +will enforce RFC 1034 check, namely, disallow using of underscore character
 +within host names.
 +This is used by the standard host lookup routines like
 +.Xr gethostbyname 3 .
 +For compatibility reasons this option is not enabled by default.
 +.El
  .Sh RETURN VALUES
  The
  .Fn res_init
 
 Modified: stable/7/lib/libc/resolv/res_comp.c
 ==============================================================================
 --- stable/7/lib/libc/resolv/res_comp.c	Mon Sep 28 22:18:38 2009	(r197600)
 +++ stable/7/lib/libc/resolv/res_comp.c	Mon Sep 28 22:29:28 2009	(r197601)
 @@ -148,7 +148,11 @@ dn_skipname(const u_char *ptr, const u_c
  #define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
  
  #define borderchar(c) (alphachar(c) || digitchar(c))
 +#ifdef	RES_ENFORCE_RFC1034
 +#define middlechar(c) (borderchar(c) || hyphenchar(c))
 +#else
  #define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
 +#endif
  #define	domainchar(c) ((c) > 0x20 && (c) < 0x7f)
  
  int
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: delphij 
State-Changed-When: Mon Sep 28 22:32:24 UTC 2009 
State-Changed-Why:  
Patch MFC'ed to RELENG_7 and RELENG_6. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=129477 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/129477: commit references a PR
Date: Mon, 28 Sep 2009 22:31:44 +0000 (UTC)

 Author: delphij
 Date: Mon Sep 28 22:31:29 2009
 New Revision: 197602
 URL: http://svn.freebsd.org/changeset/base/197602
 
 Log:
   MFC 193023+193024:
   
   Add an option to enforce strict RFC 1034 compliance.
   Document how to enable strict RFC 1034 enforcements.
   
   PR:		kern/129477
 
 Modified:
   stable/6/lib/libc/   (props changed)
   stable/6/lib/libc/net/resolver.3
   stable/6/lib/libc/resolv/res_comp.c
 
 Modified: stable/6/lib/libc/net/resolver.3
 ==============================================================================
 --- stable/6/lib/libc/net/resolver.3	Mon Sep 28 22:29:28 2009	(r197601)
 +++ stable/6/lib/libc/net/resolver.3	Mon Sep 28 22:31:29 2009	(r197602)
 @@ -32,7 +32,7 @@
  .\"     @(#)resolver.3	8.1 (Berkeley) 6/4/93
  .\" $FreeBSD$
  .\"
 -.Dd November 4, 2006
 +.Dd May 29, 2009
  .Dt RESOLVER 3
  .Os
  .Sh NAME
 @@ -405,6 +405,19 @@ function properly if the programmer atte
  .Va _res
  structure in an attempt to replace the per-thread version referred to
  by that macro.
 +.Pp
 +The following compile-time option can be specified to change the default
 +behavior of resolver routines when necessary.
 +.Bl -tag -width RES_ENFORCE_RFC1034
 +.It Dv RES_ENFORCE_RFC1034
 +If this symbol is defined during compile-time,
 +.Fn res_search
 +will enforce RFC 1034 check, namely, disallow using of underscore character
 +within host names.
 +This is used by the standard host lookup routines like
 +.Xr gethostbyname 3 .
 +For compatibility reasons this option is not enabled by default.
 +.El
  .Sh RETURN VALUES
  The
  .Fn res_init
 
 Modified: stable/6/lib/libc/resolv/res_comp.c
 ==============================================================================
 --- stable/6/lib/libc/resolv/res_comp.c	Mon Sep 28 22:29:28 2009	(r197601)
 +++ stable/6/lib/libc/resolv/res_comp.c	Mon Sep 28 22:31:29 2009	(r197602)
 @@ -152,7 +152,11 @@ dn_skipname(const u_char *ptr, const u_c
  #define digitchar(c) ((c) >= 0x30 && (c) <= 0x39)
  
  #define borderchar(c) (alphachar(c) || digitchar(c))
 +#ifdef	RES_ENFORCE_RFC1034
 +#define middlechar(c) (borderchar(c) || hyphenchar(c))
 +#else
  #define middlechar(c) (borderchar(c) || hyphenchar(c) || underscorechar(c))
 +#endif
  #define	domainchar(c) ((c) > 0x20 && (c) < 0x7f)
  
  int
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
