Hi all:
I meet a very strange problem on my NIS. I test two cases, which one is
a Gentoo i386 box, and the other is Gentoo AMD64 box.
I referenced this page:
http://www.linux-nis.org/nis-howto/HOWTO/settingup_client.html , and can
successfully login.
But when my directory has unknown UID on AMD64 box, it will return a
SEGMENTATION FAULT error.
Then I use the following code to verify the client settings:
#include <stdio.h>
#include <pwd.h>
#include <sys/types.h>
int
main(int argc, char *argv[])
{
struct passwd *pwd;
if(argc != 2)
{
fprintf(stderr,"Usage: getwpnam username\n");
exit(1);
}
pwd=getpwnam(argv[1]);
if(pwd != NULL)
{
printf("name.....: [%s]\n",pwd->pw_name);
printf("password.: [%s]\n",pwd->pw_passwd);
printf("user id..: [%d]\n", pwd->pw_uid);
printf("group id.: [%d]\n",pwd->pw_gid);
printf("gecos....: [%s]\n",pwd->pw_gecos);
printf("directory: [%s]\n",pwd->pw_dir);
printf("shell....: [%s]\n",pwd->pw_shell);
}
else
fprintf(stderr,"User \"%s\" not found!\n",argv[1]);
exit(0);
}
Finally, I found that getpwnam() call will cause segmentation fault
rather than return NULL on pass a non-exist username on AMD64 box.
Is anybody has encounter this situation?
Regards,
Weicheng.
--
[email protected] mailing list