RFD: uid of privileged user not fixed to 0
Corinna Vinschen
vinschen at redhat.com
Thu Jul 12 03:50:12 EST 2001
Hi,
I don't know if other systems are concerned as well but it's at least
a problem for Cygwin that the uid of the privileged user is fixed to
the constant 0 in the OpenSSH sources.
A month ago I ported Paul Vixie's cron to Cygwin and he's using
at least a define for that:
#define ROOT_UID 0
which simplified the porting vastly.
May I propose to change the usage of uid 0 in the sources to become
substituted by a define as above which would allow to configure
that for different systems which doesn't neccessarily have the uid
0 and a root user at all?
Instead of constant (and badly portable) comparisons like
if (st.st_uid == 0)
we could use something like
if (is_root(st.st_uid))
which would allow macros like the following on Unices:
#define ROOT_UID 0
#define is_root(x) ((x) == ROOT_UID)
and other definitions on other systems:
#define ROOT_UID 18 /* "SYSTEM" account on NT/W2K */
and even functions:
#define is_root(x) wierd_system_is_root(x)
extern int wierd_system_is_root(uid_t);
Is there any problem to do so? Since that change isn't messing
anything up (IMO) it should be no problem to apply that already
to the OpenBSD base sources of OpenSSH.
Any comments (besides flaming on Windows)?
Corinna
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen at redhat.com
More information about the openssh-unix-dev
mailing list