Underscore in hostnames
PATCH 1/1 Underscore in hostnames
Hi all,
Even though underscores are not really valid in hostnames, many people use them and they seem to be tolerated in many places. So I propose the one-liner below to see what you think.
This one-liner adds underscore as a valid hostname character for NFS mounts.
---
parse_sun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
modules/parse_sun.c +1 -1
@@ -691,7 +691,7 @@ static int validate_location(char *loc)if (check_colon (ptr)) {while (*ptr && *ptr !=':' ) {if (!(isalnum (*ptr) || - *ptr =='-' || *ptr =='.' || + *ptr =='-' || *ptr =='.' || *ptr =='_' || *ptr ==',' || *ptr =='(' || *ptr ==')' ))return 0 ; ptr++;
Kind regards,
Fábio
Signature · 1 line
ex sed lex awk yacc, e pluribus unix, amem
Ian Kent
maintainerQuoted 5 lines · Fabio Olive Leite
Hi all,
Even though underscores are not really valid in hostnames, many people use them and they seem to be tolerated in many places. So I propose the one-liner below to see what you think.
Not valid at all.
And they are tolerated because the admin explicitly configures DNS to violate the RFC.
Quoted 3 lines
This one-liner adds underscore as a valid hostname character for NFS mounts.
I'm not keen on this in the core package.
We could create a contrib directory and put it there and add something to the README.
Quoted 21 lines
Signed-off-by Fabio Olive Leite <[email protected]>---
parse_sun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)modules/parse_sun.c +1
-1@@ -691,7 +691,7 @@ static int validate_location(char *loc)if (check_colon (ptr)) {while (*ptr && *ptr !=':' ) {if (!(isalnum (*ptr) || - *ptr =='-' || *ptr =='.' || + *ptr =='-' || *ptr =='.' || *ptr =='_' || *ptr ==',' || *ptr =='(' || *ptr ==')' ))return 0 ; ptr++;
Quoted 2 lines
Kind regards,
Fábio
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs
Quoted 4 lines · Ian Kent
Not valid at all.
And they are tolerated because the admin explicitly configures DNS to violate the RFC.
The sad thing is that mount(1) does no such validation, and allows one to mount an NFS export on a hostname containing underscores just fine. So we can end up in a situation where automount does not allow the user to configure a working NFS mount she has.
Regards,
Fábio
Signature · 1 line
ex sed lex awk yacc, e pluribus unix, amem
==> On Mon, 11 Dec 2006 10:05:07 -0200, Fabio Olive Leite <[email protected]> said:
Fabio> On Mon, Dec 11, 2006 at 12:56:31PM +0900, Ian Kent wrote:
Fabio> >
Fabio> > Not valid at all.
Fabio> > And they are tolerated because the admin explicitly configures DNS to Fabio> > violate the RFC.
Fabio> The sad thing is that mount(1) does no such validation, and allows one Fabio> to mount an NFS export on a hostname containing underscores just fine. Fabio> So we can end up in a situation where automount does not allow the Fabio> user to configure a working NFS mount she has.
Yes, and when coupled with the fact that some other vendors' products allow this sort of thing by default, I think we may have to support it. I'm a big fan of sticking to the RFC's, but in this case, I think we should make an exception.
-Jeff
Ian Kent
maintainerQuoted 13 lines · Jeff Moyer
==> On Mon, 11 Dec 2006 10:05:07 -0200, Fabio Olive Leite <[email protected]> said:
Fabio> On Mon, Dec 11, 2006 at 12:56:31PM +0900, Ian Kent wrote:
Fabio> >
Fabio> > Not valid at all.
Fabio> > And they are tolerated because the admin explicitly configures DNS to Fabio> > violate the RFC.Fabio> The sad thing is that mount(1) does no such validation, and allows one Fabio> to mount an NFS export on a hostname containing underscores just fine. Fabio> So we can end up in a situation where automount does not allow the Fabio> user to configure a working NFS mount she has.
Quoted 4 lines
Yes, and when coupled with the fact that some other vendors' products allow this sort of thing by default, I think we may have to support it. I'm a big fan of sticking to the RFC's, but in this case, I think we should make an exception.
Ya .. I reality I don't feel as strongly as I made out.
I did want to see if there was anyone else that did have an opinion though.
I'll merge the patch unless anyone else feels strongly against it.
Ian
Quoted 21 lines · Ian Kent
Quoted 13 lines · Jeff Moyer
==> On Mon, 11 Dec 2006 10:05:07 -0200, Fabio Olive Leite <[email protected]> said:
Fabio> On Mon, Dec 11, 2006 at 12:56:31PM +0900, Ian Kent wrote:
Fabio> >
Fabio> > Not valid at all.
Fabio> > And they are tolerated because the admin explicitly configures DNS to Fabio> > violate the RFC.Fabio> The sad thing is that mount(1) does no such validation, and allows one Fabio> to mount an NFS export on a hostname containing underscores just fine. Fabio> So we can end up in a situation where automount does not allow the Fabio> user to configure a working NFS mount she has.
Quoted 5 lines
Yes, and when coupled with the fact that some other vendors' products allow this sort of thing by default, I think we may have to support it. I'm a big fan of sticking to the RFC's, but in this case, I think we should make an exception.
Quoted 6 lines
Ya .. I reality I don't feel as strongly as I made out.
I did want to see if there was anyone else that did have an opinion though.
I'll merge the patch unless anyone else feels strongly against it.
Do we know which other vendors products support '_' as a valid character in a hostname?
I might be more in favor of fixing the NFS mount code than modifying autofs in this fashion.
Thanx...
ps==> On Mon, 11 Dec 2006 10:57:11 -0500, Peter Staubach <[email protected]> said:
Peter> I might be more in favor of fixing the NFS mount code than modifying Peter> autofs in this fashion.
If you want to disallow this, then surely it is best to simply "fix" the name resolution routines in libc. At this point, however, that could be viewed as a regression.
-Jeff
Quoted 4 lines · Jeff Moyer
If you want to disallow this, then surely it is best to simply "fix" the name resolution routines in libc. At this point, however, that could be viewed as a regression.
Even though I do my own RFC evangelizing at times, I can't help but
think: why limit automount with a hostname validation routine when automount is *not* the authoritative entity that decides what is a valid hostname? Will you want to patch automount again whenever the RFCs get updated?
automount should regard the hostname as a string, and if it can be resolved, great. If it cannot, complain in the logs and exit. But it should not enforce validation on top of something that can be redefined under its feet anytime in the future.
Will you also include validation for bracketed IPv6 literals? And whatever comes next?
Two additional cents...
Fábio
Signature · 1 line
ex sed lex awk yacc, e pluribus unix, amem
Ian Kent
maintainerQuoted 5 lines · Fabio Olive Leite
Quoted 4 lines · Jeff Moyer
If you want to disallow this, then surely it is best to simply "fix" the name resolution routines in libc. At this point, however, that could be viewed as a regression.
I've thought more about this and Peter certainly has a valid concern.
However, I think that the decision as to whether a host name may contain an "_" is the responsibility of the service that resolves names, such as FNS, and not of an application that uses the names. If the name resolves I think we should just use it.
So I'm going to add the original patch when I get a chance..
Quoted 7 lines
Even though I do my own RFC evangelizing at times, I can't help but
think: why limit automount with a hostname validation routine when automount is *not* the authoritative entity that decides what is a valid hostname? Will you want to patch automount again whenever the RFCs get updated?
Quoted 7 lines
automount should regard the hostname as a string, and if it can be resolved, great. If it cannot, complain in the logs and exit. But it should not enforce validation on top of something that can be redefined under its feet anytime in the future.
Will you also include validation for bracketed IPv6 literals? And whatever comes next?
Basically, yes.
I want input validation and will have to deal with it as and when needed.
Ian
Quoted 9 lines · Ian Kent
Quoted 6 lines · Fabio Olive Leite
Quoted 4 lines · Jeff Moyer
If you want to disallow this, then surely it is best to simply "fix" the name resolution routines in libc. At this point, however, that could be viewed as a regression.
Quoted 8 lines
I've thought more about this and Peter certainly has a valid concern.
However, I think that the decision as to whether a host name may contain an "_" is the responsibility of the service that resolves names, such as FNS, and not of an application that uses the names. If the name resolves I think we should just use it.
This sounds very reasonable to me.
ps
Quoted 29 lines
So I'm going to add the original patch when I get a chance..
Quoted 6 lines
Even though I do my own RFC evangelizing at times, I can't help but
think: why limit automount with a hostname validation routine when automount is *not* the authoritative entity that decides what is a valid hostname? Will you want to patch automount again whenever the RFCs get updated?Quoted 8 lines
automount should regard the hostname as a string, and if it can be resolved, great. If it cannot, complain in the logs and exit. But it should not enforce validation on top of something that can be redefined under its feet anytime in the future.
Will you also include validation for bracketed IPv6 literals? And whatever comes next?
Basically, yes.
I want input validation and will have to deal with it as and when needed.Ian
_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs
Ian Kent
maintainerQuoted 24 lines · Peter Staubach
Quoted 23 lines · Ian Kent
Quoted 13 lines · Jeff Moyer
==> On Mon, 11 Dec 2006 10:05:07 -0200, Fabio Olive Leite <[email protected]> said:
Fabio> On Mon, Dec 11, 2006 at 12:56:31PM +0900, Ian Kent wrote:
Fabio> >
Fabio> > Not valid at all.
Fabio> > And they are tolerated because the admin explicitly configures DNS to Fabio> > violate the RFC.Fabio> The sad thing is that mount(1) does no such validation, and allows one Fabio> to mount an NFS export on a hostname containing underscores just fine. Fabio> So we can end up in a situation where automount does not allow the Fabio> user to configure a working NFS mount she has.
Quoted 5 lines
Yes, and when coupled with the fact that some other vendors' products allow this sort of thing by default, I think we may have to support it. I'm a big fan of sticking to the RFC's, but in this case, I think we should make an exception.
Ya .. I reality I don't feel as strongly as I made out.
Quoted 7 lines
Quoted 4 lines
I did want to see if there was anyone else that did have an opinion though.
I'll merge the patch unless anyone else feels strongly against it.
Do we know which other vendors products support '_' as a valid character in a hostname?
Bind can be configured to allow it, as you probably know, but the default has been to not allow it for several years now.
I guess that many sites that have Windows machines with '_' in host names configure DNS to allow them or they probably use the Windows DNS.
Ian