Re: gethostname returns loginname on "Pather Server" version
Re: gethostname returns loginname on "Pather Server" version
- Subject: Re: gethostname returns loginname on "Pather Server" version
- From: Justin Walker <email@hidden>
- Date: Fri, 6 Feb 2004 18:06:45 -0800
On Friday, February 6, 2004, at 05:35 PM, Jason Linhart wrote:
On 2/6/04 7:47 PM Justin Walker (email@hidden) wrote:
Bottom line: don't use gethostname(); anyone with root access on that
machine can set the 'hostname' to be anything he wants. It is not
related to any "standard", except by convention.
There are a great many things that a program with root access can do,
but
just because they can do something, that doesn't make that behavior
either correct or useful.
This is beside the point.
There is a clear standard. gethostname() is defined both by POSIX and
by
Darwin in the same way. Just because the standard is not enforced by
the
kernel doesn't mean that violating the standard is not a bug.
I'm not sure that 'bug' is an issue in this thread.
The difficulty here is not the lack of a standard, it is the ambiguity
of
the standard. The spec calls for the "standard host name".
Unfortunatly,
that is ambiguous. The spec is not specific enough to require a valid
DNS
name, but it is specific enough to disallow things which could not
possibly be a host name. A DNS name would be compliant, an AppleTalk
name
would be compliant, a name typed into a system configuration dialog box
as "Commputer Name" would be compliant, various other things would be
compliant, but a user name would not be compliant.
My reading of the man pages I can come up with does not support any of
this.
Cheers,
Justin
--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | Men are from Earth.
| Women are from Earth.
| Deal with it.
*--------------------------------------*-------------------------------*
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.