1 |
Hi all: |
2 |
I meet a very strange problem on my NIS. I test two cases, which one is |
3 |
a Gentoo i386 box, and the other is Gentoo AMD64 box. |
4 |
I referenced this page: |
5 |
http://www.linux-nis.org/nis-howto/HOWTO/settingup_client.html , and can |
6 |
successfully login. |
7 |
|
8 |
But when my directory has unknown UID on AMD64 box, it will return a |
9 |
SEGMENTATION FAULT error. |
10 |
|
11 |
Then I use the following code to verify the client settings: |
12 |
|
13 |
#include <stdio.h> |
14 |
#include <pwd.h> |
15 |
#include <sys/types.h> |
16 |
|
17 |
int |
18 |
main(int argc, char *argv[]) |
19 |
{ |
20 |
struct passwd *pwd; |
21 |
|
22 |
if(argc != 2) |
23 |
{ |
24 |
fprintf(stderr,"Usage: getwpnam username\n"); |
25 |
exit(1); |
26 |
} |
27 |
|
28 |
pwd=getpwnam(argv[1]); |
29 |
|
30 |
if(pwd != NULL) |
31 |
{ |
32 |
printf("name.....: [%s]\n",pwd->pw_name); |
33 |
printf("password.: [%s]\n",pwd->pw_passwd); |
34 |
printf("user id..: [%d]\n", pwd->pw_uid); |
35 |
printf("group id.: [%d]\n",pwd->pw_gid); |
36 |
printf("gecos....: [%s]\n",pwd->pw_gecos); |
37 |
printf("directory: [%s]\n",pwd->pw_dir); |
38 |
printf("shell....: [%s]\n",pwd->pw_shell); |
39 |
} |
40 |
else |
41 |
fprintf(stderr,"User \"%s\" not found!\n",argv[1]); |
42 |
|
43 |
exit(0); |
44 |
} |
45 |
|
46 |
Finally, I found that getpwnam() call will cause segmentation fault |
47 |
rather than return NULL on pass a non-exist username on AMD64 box. |
48 |
|
49 |
Is anybody has encounter this situation? |
50 |
|
51 |
Regards, |
52 |
Weicheng. |
53 |
|
54 |
-- |
55 |
gentoo-amd64@g.o mailing list |