security.idl: add SMB_SUPPORTED_SECINFO_FLAGS
[Samba.git] / testsuite / nsswitch / getgrnam.c
blob8ab4046bd9edd4dc5d826ac665fd0a9765c85c8a
1 /*
2 * Lookup a group by name
3 */
5 #include <stdio.h>
6 #include <grp.h>
7 #include <sys/types.h>
9 int main(int argc, char **argv)
11 struct group *gr;
13 /* Check args */
15 if (argc != 2) {
16 printf("ERROR: no arg specified\n");
17 exit(1);
20 /* Do getgrnam() */
22 if ((gr = getgrnam(argv[1])) == NULL) {
23 printf("FAIL: group %s does not exist\n", argv[1]);
24 exit(1);
27 /* Print group info */
29 printf("PASS: group %s exists\n", argv[1]);
30 printf("gr_name = %s\n", gr->gr_name);
31 printf("gr_passwd = %s\n", gr->gr_passwd);
32 printf("gr_gid = %d\n", gr->gr_gid);
34 /* Group membership */
36 if (gr->gr_mem != NULL) {
37 int i = 0;
39 printf("gr_mem = ");
40 while(gr->gr_mem[i] != NULL) {
41 printf("%s", gr->gr_mem[i]);
42 i++;
43 if (gr->gr_mem != NULL) {
44 printf(",");
47 printf("\n");
50 exit(0);