author | Melynda Hunter <melynda.hunter@oracle.com> |
Thu, 01 Nov 2012 10:01:23 -0700 | |
branch | s11u1-sru |
changeset 2415 | db591cab6e24 |
parent 875 | 5e870fe2b411 |
permissions | -rw-r--r-- |
875
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
1 |
--- old/modules/mod_auth_unix.c Fri May 25 08:31:35 2012 |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
2 |
+++ new/modules/mod_auth_unix.c Fri May 25 08:31:35 2012 |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
3 |
@@ -896,6 +896,13 @@ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
4 |
|
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
5 |
return gr ? mod_create_data(cmd, (void *) &gr->gr_gid) : PR_DECLINED(cmd); |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
6 |
} |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
7 |
+#ifdef HAVE__GETGRPSBYMEMBER |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
8 |
+ extern int _getgroupsbymember |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
9 |
+ ( |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
10 |
+ const char* username, gid_t gid_array[], |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
11 |
+ int maxgids, int numgids |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
12 |
+ ); |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
13 |
+#endif /* HAVE__GETGRPSBYMEMBER */ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
14 |
|
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
15 |
/* cmd->argv[0] = name |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
16 |
* cmd->argv[1] = (array_header **) group_ids |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
17 |
@@ -1065,7 +1072,40 @@ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
18 |
} |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
19 |
|
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
20 |
free(ptr); |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
21 |
-#else |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
22 |
+#else /* !HAVE_GETGRSET */ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
23 |
+#ifdef HAVE__GETGRPSBYMEMBER |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
24 |
+ gid_t group_ids[NGROUPS_MAX]; |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
25 |
+ int ngroups = NGROUPS_MAX; |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
26 |
+ register unsigned int i; |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
27 |
+ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
28 |
+ pr_trace_msg("auth", 4, |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
29 |
+ "using _getgroupsbymember() to look up group membership"); |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
30 |
+ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
31 |
+ memset(group_ids, 0, sizeof(group_ids)); |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
32 |
+ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
33 |
+ group_ids[0]=pw->pw_gid; |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
34 |
+ ngroups= |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
35 |
+ _getgroupsbymember(pw->pw_name, group_ids, NGROUPS_MAX, 1); |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
36 |
+ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
37 |
+ if (ngroups < 0) { |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
38 |
+ pr_log_pri(PR_LOG_ERR, |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
39 |
+ "_getgroupsbymember error: %s", strerror(errno)); |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
40 |
+ return PR_DECLINED(cmd); |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
41 |
+ } |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
42 |
+ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
43 |
+ for (i = 0; i < ngroups; i++) { |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
44 |
+ gr = my_getgrgid(group_ids[i]); |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
45 |
+ if (gr) { |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
46 |
+ if (gids && pw->pw_gid != gr->gr_gid) |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
47 |
+ *((gid_t *) push_array(gids)) = gr->gr_gid; |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
48 |
+ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
49 |
+ if (groups && pw->pw_gid != gr->gr_gid) { |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
50 |
+ *((char **) push_array(groups)) = pstrdup(session.pool, |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
51 |
+ gr->gr_name); |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
52 |
+ } |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
53 |
+ } |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
54 |
+ } |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
55 |
+#else /* !HAVE__GETGRPSBYMEMBER */ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
56 |
char **gr_member = NULL; |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
57 |
|
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
58 |
/* This is where things get slow, expensive, and ugly. Loop through |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
59 |
@@ -1091,6 +1131,7 @@ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
60 |
} |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
61 |
} |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
62 |
} |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
63 |
+#endif /* !HAVE__GETGROUPSBYMEMBER */ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
64 |
#endif /* !HAVE_GETGRSET */ |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
65 |
} |
5e870fe2b411
7150536 ftp (proftpd) service times out and goes to maintenance on T5220 and DEBUG kernel
William.Johnston <William.Johnston@Sun.Com>
parents:
diff
changeset
|
66 |