s3: smbd - Fix SMB3.11 protocol encryption selection.
[Samba.git] / testsuite / nsswitch / getpwuid.c
blob3f364df29d51091a60e33baa84d01ebda908bd4c
1 /*
2 * Lookup a user by uid.
3 */
5 #include <stdio.h>
6 #include <pwd.h>
7 #include <sys/types.h>
9 int main(int argc, char **argv)
11 struct passwd *pw;
12 uid_t uid;
14 /* Check args */
16 if (argc != 2) {
17 printf("ERROR: no arg specified\n");
18 exit(1);
21 if ((uid = atoi(argv[1])) == 0) {
22 printf("ERROR: invalid uid specified\n");
23 exit(1);
26 /* Do getpwuid() */
28 if ((pw = getpwuid(uid)) == NULL) {
29 printf("FAIL: uid %d does not exist\n", uid);
30 exit(1);
33 printf("PASS: uid %d exists\n", uid);
34 printf("pw_name = %s\n", pw->pw_name);
35 printf("pw_passwd = %s\n", pw->pw_passwd);
36 printf("pw_uid = %d\n", pw->pw_uid);
37 printf("pw_gid = %d\n", pw->pw_gid);
38 printf("pw_gecos = %s\n", pw->pw_gecos);
39 printf("pw_dir = %s\n", pw->pw_dir);
40 printf("pw_shell = %s\n", pw->pw_shell);
42 exit(0);