Subject: Re: getpwuid
From: [email-masked] (Gunther Ebert)

5 May 1997 07:34:22 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 4.0b2 (WinNT; I)
Original-To: Ken Keys <[email-masked]>, [email-masked]
X-Priority: 3 (Normal)
Original-Sender: [email-masked]

Ken Keys wrote:

  Geoffrey Noer wrote:
  > In beta 18 we add:
  >
  > Under NT only, chown(), getgrgid(), getgrnam(), endgrent(),
  getgrent(),
  > setpwend(), getpwent(), endpwent().  Win95 still has these as
  stubs.
  >
  > You will need to make an /etc/passwd and /etc/group for some
  > calls to work.  That said, we provide a mkpasswd and mkgroup that
  > create valid /etc files from the NT user database.

  Wouldn't it make more sense to have those functions operate directly
  on
  the NT user DB, instead of on "unixified" copies of them?  The
  cygwin
  copy will get out of sync and need to be rebuilt whenever the native

  copy is changed.  The pw API was explicitly designed to *avoid*
  dependance on a particluar storage format; cygwin should take
  advantage
  of that and not require users to maintain artificial copies.

Basically, you're right. It would be much nicer to use the native
API instead of the
passwd file operations. However, accessing a /etc/passwd file is
*much* faster than
browsing through the NT user account database, especially in a
(trusted) domain
environment. Note that every fstat call results in a call to several pwd
functions, and
using native APIs instead of /etc/passwd file operations would slow down
file operations
dramatically.

Sure, the implemention of an appropriate cache mechanism could save most
of the time.
Maybe someone will have the time to rewrite the passwd functions.

  One could argue that having a unix-style /etc/passwd would allow the

  working of programs that read /etc/passwd directly instead of going
  through the pw API.  But, 1) such programs are already nonportable,
  since not even all unix-like systems use the same format for
  /etc/passwd,

No, I think this was not the idea.

  and 2) IMO, supporting badly written software isn't worth the
  trouble
  it will cause for users when their user DB's get out of sync.

I think this would not be a big problem. How often does the account
database usually change?
Once a week? Or once a month?

--

Gunther Ebert
iXOS Anwendungs-Software GmbH
Angerstrasse 40-42
D-04177 Leipzig

Phone : +49 341 48503-0
Fax   : +49 341 48503-99
E-mail: mailto:[email-masked]
www   : http://www.ixos-leipzig.de

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".