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: Jason Linhart <email@hidden>
- Date: Fri, 6 Feb 2004 20:35:02 -0500
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.
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.
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.
Jason
-----------------
email@hidden
-----------------
Dr. Seuss books . . . can be read and enjoyed on several levels. For
example, 'One Fish Two Fish, Red Fish Blue Fish' can be deconstructed
as a searing indictment of the narrow-minded binary counting system.
-- Peter van der Linden, Expert C Programming, Deep C Secrets
_______________________________________________
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.