Re: CVS commit: src/lib/libc/net

2015-11-02 Thread Steffen Nurpmeso
Erik Fair  wrote:
 |So, what did we do by default: allow “_” in hostnames when that’s exp\
 |licitly against standard, or not? I read the patch in the PR and coul\
 |dn’t make heads or tails of it.

fwiw i don't think this is generally true, my own one has
a DNS::verifyName() and that does

// find label border, if any
#if(_ASSUME_LONG)
wbuf = s(char*,Mem::Utils::find(_dname, _DOT, _dnamelen));
llen = (wbuf ? s(ui32,wbuf-_dname) : _dnamelen);
#else
for(wbuf=_dname, llen^=llen;  llen < _dnamelen;  ++llen)
if(*(wbuf++) == _DOT)
break;
#endif
if(!llen || llen > 63)
goto jesll;

[and]

// 1033, 1034, 2929 (3.3): rather anything (printable ASCII)
[these numbers are RFCs, vnm_ is enum DNS::VerifyNameMode:
vnm_none= 0,// boundary checks only
vnm_boundary= vnm_none,
vnm_dname   = 1,// printable ASCII
vnm_hostname= 2,// hostname acc. RFC 1035 + 1123, 2.1
vnm_srv = 3,// vnm_hostname plus _ label start
]
case vnm_dname:
while(llen--) {
ui8 c = s(ui8,*(wbuf++));
if(!_IS_ASCII_PRINTABLE(c))
goto jeill;
}
break;

// hostname acc. 1035:2.3.1, 1123:2.1
[these numbers are RFCs]
case vnm_hostname:
case vnm_srv:
// may start with letter or digit (latter 1123, 2.1)
if(!_IS_ASCII_ALNUM(wbuf[0]))
// t_srv may start with underscore (RFC 2782)
if(_vnm != vnm_srv || wbuf[0] != _UNDERSCORE)
goto jeill;
// may consist of letters, digits and hyphen
while(s(si32,--llen) > 0) {
charc = *(++wbuf);
if(c != _HYPHEN && !_IS_ASCII_ALNUM(c))
goto jeill;
}
// but may end with letter or digit only
if(wbuf[0] == _HYPHEN)
goto jeill;
break;
} // switch(_vnm)

and then

  ?0[sdaoden@wales ]$ git grep IS_ASCII_PRI master
  master:modules/dns/config.h:#define _IS_ASCII_PRINTABLE(CHAR) ((CHAR) > 0x20 
&& (CHAR) < 0x7F)

So vnm_srv does regulary allow underscore as in

/*!
* \var vnm_srv
* Boundary check (#vnm_none) plus content verification.
* This is exactly like #vnm_hostname,
* but additionally allows a label to start with an underscore ("_").
* RFC 2782 introduced the use of underscores as a leading character for
* service and protocol names to reduce accidental clashes,
* and thus we support them as required.
* Note however that this check is stupid
* in that \e all labels are allowed to start with underscores \ldots
*/

Oh, it seems not to be completely correct, unfortunately.  I think
i should stop tracking -d again.

--steffen


Re: CVS commit: src/lib/libc/net

2015-11-02 Thread Christos Zoulas
In article <56dd2b5f-26b1-40b7-bd84-103d3f255...@netbsd.org>,
Erik Fair   wrote:
>So, what did we do by default: allow “_” in hostnames when that’s
>explicitly against standard, or not? I read the patch in the PR and
>couldn’t make heads or tails of it.

res_init() sets RES_NOCHECKNAME, but the resolver code knows nothing
about that flag. It is only being checked in the leaf implementing
functions:  getaddrinfo(3), gethostbyname(3), getnetbyname(3).
gethostbyname(3) respected the flag and allowed names with bad
characters to be resolved (remember all this is client-side), but
the other two did not respect the flag and failed names containing
_'s for example.

christos


Re: CVS commit: src/sys/nfs

2015-11-02 Thread Paul Goyette

On Mon, 2 Nov 2015, Greg Oster wrote:


On Mon, 2 Nov 2015 09:57:43 +
"Paul Goyette"  wrote:


Module Name:src
Committed By:   pgoyette
Date:   Mon Nov  2 09:57:43 UTC 2015

Modified Files:
src/sys/nfs: nfs_vfsops.c

Log Message:
Don't forget to call nfs_fini() when we're finished.  Without this,
we leave a dangling pool nfsrvdescpl around.


Is this a candidate for pullups? (sounds like a good fix to me! :) )


Considering that this actually fixes (at least) one of my three nasty
module-related issues (see thread on current-users), I think it is an
excellent candidate for pull-up.



+--+--+-+
| Paul Goyette | PGP Key fingerprint: | E-mail addresses:   |
| (Retired)| FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com|
| Kernel Developer | 0786 F758 55DE 53BA 7731 | pgoyette at netbsd.org  |
+--+--+-+


Re: CVS commit: src/lib/libc/net

2015-11-02 Thread Steffen Nurpmeso
oops, of course

  ?0[sdaoden@wales]$ git grep IS_ASCII_ master  
   
  master:modules/dns/config.h:#define _IS_ASCII_PRINTABLE(CHAR) ((CHAR) > 0x20 
&& (CHAR) < 0x7F)
  master:modules/dns/config.h:#define _IS_ASCII_ALNUM(CHAR)   
(_IS_ASCII_ALPHA(CHAR) ||_IS_ASCII_DIGIT(CHAR))
  master:modules/dns/config.h:#define _IS_ASCII_ALPHA(CHAR)   (  ((CHAR) >= 
0x41 && (CHAR) <= 0x5A) \
  master:modules/dns/config.h:#define _IS_ASCII_DIGIT(CHAR)   ((CHAR) >= 
0x30 && (CHAR) <= 0x39)

--steffen


Re: CVS commit: src/lib/libc/net

2015-11-02 Thread Erik Fair
So, what did we do by default: allow “_” in hostnames when that’s explicitly 
against standard, or not? I read the patch in the PR and couldn’t make heads or 
tails of it.

Erik 



> On Oct 26, 2015, at 07:48, Christos Zoulas  wrote:
> 
> Module Name:  src
> Committed By: christos
> Date: Mon Oct 26 14:48:04 UTC 2015
> 
> Modified Files:
>   src/lib/libc/net: getaddrinfo.c
> 
> Log Message:
> PR/50367: Stefan Schaeckeler: libc resolver library does not resolve host
> names with underscores ("_"). According to resolv.conf(5) RES_NOCHECKNAME
> is on by default; well, it is and gethostbyname(3) obeys it
> (gethnamaddr.c:maybe_ok), but getaddrinfo(3) up till this commit not.
> XXX: pullup-7, pullup-6
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.109 -r1.110 src/lib/libc/net/getaddrinfo.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 


Re: CVS commit: src/sys/nfs

2015-11-02 Thread Greg Oster
On Mon, 2 Nov 2015 09:57:43 +
"Paul Goyette"  wrote:

> Module Name:  src
> Committed By: pgoyette
> Date: Mon Nov  2 09:57:43 UTC 2015
> 
> Modified Files:
>   src/sys/nfs: nfs_vfsops.c
> 
> Log Message:
> Don't forget to call nfs_fini() when we're finished.  Without this,
> we leave a dangling pool nfsrvdescpl around.

Is this a candidate for pullups? (sounds like a good fix to me! :) )

Later...

Greg Oster