[Gllug] cuserid?

Peter Grandi pg_gllug at gllug.for.sabi.co.UK
Mon Oct 17 19:46:59 UTC 2005


>>> On Mon, 17 Oct 2005 20:23:23 +0100, Peter Childs
>>> <peterachilds at gmail.com> said:

peterachilds> Ok So why can't I get the effective user id and
peterachilds> then look it up using the settings in nsswitch.conf
peterachilds> using standard nss libraries I guess.

You can do that, the art is in choosing the best compromise. And
that depends on what you want to do, which you, like so many
''surely you are psychic'' help seekers, are keeping secret. :-)

For example getting the _real_ uid (that you seem to want to
convert the effective id is deeply suspicious, because it is not
necessarily related to the value returned by 'whoami') and then
using 'getpwuid[_r]' is probably the simplest and most general
thing you can do, as long as you handle the case where it returns
0 (which should be hopefully very rare). But this is probably
rather inappropriate for checking identity for security purposes.

peterachilds> Why are things always 10 time more complex than
peterachilds> they seam at first?

Mostly because the semantics of such things is inherently
complex, as ''identity'', even in computers, is something with
really big, deep, issues.

Secondarily because of so called ''historical issues'', that is
the accumulation of virtual barnacles on existing designs.

Unfortunately rarely do the hulls of OSes go to drydock and get a
scraping; while programmers get regularly keelhauled on them. :-)

Linux, being a very late descendant of UNIX, has got quite a few
virtual barnacles, but MS Windows is probably the worst one here,
which is one of the factors why it achieves lock-in so easily.

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list