I'm looking for a cross-platform way of determining whether or not a username and groupname is valid. The platforms are Linux, Solaris, Aix, and HPUX. It would need to work whether the user/group is defined locally (e.g. /etc/passwd) or through a service like LDAP or NIS/YP. It's probably wishful thinking that such a method exists, but it can't hurt (too much) to ask. Thanks!
Additional Info: Unfortunately I don't control the systems where this will run; the script is going out to clients and they can do whatever they want. And I don't have a way to test any of this myself...