Re: Listusers command
Re: Listusers command
- Subject: Re: Listusers command
- From: Jason Townsend <email@hidden>
- Date: Fri, 11 Mar 2005 15:08:17 -0800
There is a DSAgent in lookupd which bridges between POSIX style calls
like getpwnam()/getpwent() and others and the Directory Services
framework.
So this is implementation should work fine.
It would not make much sense to drop support for these POSIX APIs
since so much existing software uses them.
-Jason
From: Chuck Gagnon <email@hidden>
It makes use of getpwent from libc, I would hope there is a backend
bridge to DirectoryServices just like there is to NIS as such, perhaps
I'm wrong there. My account which is not in /etc/passwd shows up in
the list it. if the libc functions are to be abandon in favor of an
API then all the BSD tools that make use of them (users, groups,
who...) will need to be retooled.
On Mar 11, 2005, at 4:30 AM, Stephane Sudre wrote:
On 9 mars 05, at 05:45, Chuck Gagnon wrote:
I'm not sure if this is the appropriate way to do this, but for ease
and compatibility with the various flavors of unix I administer at
work I wrote this code.
It is basically a work alike to the SYSV command of the same name
(man page included), with no arguments it lists all users in a
sorted
list showing username and comment (gecos) field. the to options are
[ -l users ] to list specific users and or [ -g groups ] to list all
users in the given group(s). Users are defined as ID's with a uid
greater than 99.
We have a lot of scripts that made use of this command on Solaris
and
HP-UX, and I couldn't find a similar command in the BSD world.
It is under a BSD style license.
Code is at:
http://homepage.mac.com/gagnocg/downloads/listusers.zip
Hum, I'm not sure it would work correctly on OS X in every case.
AFAIK, the only safe way to have the correct list of users is to use
the Directory Services API. But I can be wrong.
The real difficult part with the Directory Services API IMHO is that
the APIs are a bit strange from a spelling point of view (Bug
filed on
this matter and closed as duplicate)
Happily, a SDK (not provided with the DevTools) exists at
http://developer.apple.com/sdk/ and contains a really good sample
code
showing how to list users.
My $0.02
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden