-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Manvendra Bhangui wrote: >> How often does the code actually reference the UID/GID? Could you >> have a function to look it up and cache it in a static once found? >> >> A quick check and it looks like it's only referenced when adding a >> user or updating the tcp.smtp.cdb file. There are a few other >> references, but the common things (like vchkpw and vdelivermail) >> don't appear to make use of it. >> >> Probably not a big deal to use getpwnam.
You make a good point. > Not a big deal using getpwnam(). Also if you run nscd daemon, > password/group file lookups get cached > http://docs.sun.com/app/docs/doc/816-5166/nscd-1m?a=view Another good point. > Also using getpwnam() function allows you to use hooks like NSS (Name > Service Switch) - http://en.wikipedia.org/wiki/Name_Service_Switch > > In Unix-like operating systems, the Name Service Switch (NSS) allows > Unix configuration databases to be provided by different sources, > including local files (for > example: /etc/passwd, /etc/group, /etc/hosts), LDAP, and other sources. ..good points, etc, etc :) > In case it can be used, attaching a function GetVpopID() which I used > with vpopmail in my early days of using vpopmail. It uses static > variables to cache the uid/gid. I've patched the 5.5 branch in Subversion to dynamically determine the UID/GID as needed. - -- /* Matt Brookings <m...@inter7.com> GnuPG Key FAE0672C Software developer Systems technician Inter7 Internet Technologies, Inc. (815)776-9465 */ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqMKXQACgkQIwet2/rgZyzyvQCdHUz7P4lDxUIO2g2gDCxujOUy 31kAniHLfpJ6UqgTiBzUKJiE/BpEDGwV =FnXC -----END PGP SIGNATURE-----