Re: Informix with NIS
Posted in 1994
Scott Ellard (cse@wetware.com) wrote:
: In article <JDHICKS.94Sep8050114@netcom10.netcom.com> jdhicks@netcom10.netcom.com (JD Hicks) writes:
: >We are installing NIS on our Network. One of the problems that we have run
: >in to is that Informix Products seem to need a physical entry in the passwd
: >file. While UNIX is smart enough to use NIS at log in time, Informix apps
: >like dbaccess error out with a "-468 Cannot obtain user id from system: unable
: >to start database server." When I issue an id command it returns my User and
: >Group name and id's so I know that UNIX considers me a legitimate user. This
: >implies that Informix is trying to read the passwd and group files on its own.
: >Has any one else had problems with this? Is there a work around?
: I'm curious. What is the right way for Informix to do this?
: What are the appropriate API calls?
Calling getpwuid() returns the passwd struct for a given UID. It searches
/etc/passwd first, then uses NIS if available.
This code snippet will print your user name:
#include <stdio.h>
#include <pwd.h>
int main(void)
{
struct passwd *p;
if (p = getpwuid(getuid()))
printf("%s\\n", p->pw_name);
return 0;
}
--
Jeffrey Sturm