aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/syslimits.h
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2009-06-19 17:10:35 +0000
committerBrooks Davis <brooks@FreeBSD.org>2009-06-19 17:10:35 +0000
commit838d9858251e9729d0b9c40b9aca89be3e171c1a (patch)
tree851f3659dd95c07bf7aaf4a54cd53e83c804702d /sys/sys/syslimits.h
parentf345b422d1238f2bf7fa261da253223e74d21179 (diff)
downloadsrc-838d9858251e9729d0b9c40b9aca89be3e171c1a.tar.gz
src-838d9858251e9729d0b9c40b9aca89be3e171c1a.zip
Rework the credential code to support larger values of NGROUPS and
NGROUPS_MAX, eliminate ABI dependencies on them, and raise the to 1024 and 1023 respectively. (Previously they were equal, but under a close reading of POSIX, NGROUPS_MAX was defined to be too large by 1 since it is the number of supplemental groups, not total number of groups.) The bulk of the change consists of converting the struct ucred member cr_groups from a static array to a pointer. Do the equivalent in kinfo_proc. Introduce new interfaces crcopysafe() and crsetgroups() for duplicating a process credential before modifying it and for setting group lists respectively. Both interfaces take care for the details of allocating groups array. crsetgroups() takes care of truncating the group list to the current maximum (NGROUPS) if necessary. In the future, crsetgroups() may be responsible for insuring invariants such as sorting the supplemental groups to allow groupmember() to be implemented as a binary search. Because we can not change struct xucred without breaking application ABIs, we leave it alone and introduce a new XU_NGROUPS value which is always 16 and is to be used or NGRPS as appropriate for things such as NFS which need to use no more than 16 groups. When feasible, truncate the group list rather than generating an error. Minor changes: - Reduce the number of hand rolled versions of groupmember(). - Do not assign to both cr_gid and cr_groups[0]. - Modify ipfw to cache ucreds instead of part of their contents since they are immutable once referenced by more than one entity. Submitted by: Isilon Systems (initial implementation) X-MFC after: never PR: bin/113398 kern/133867
Notes
Notes: svn path=/head/; revision=194498
Diffstat (limited to 'sys/sys/syslimits.h')
-rw-r--r--sys/sys/syslimits.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/sys/syslimits.h b/sys/sys/syslimits.h
index 28a5eba07616..c38648f58f12 100644
--- a/sys/sys/syslimits.h
+++ b/sys/sys/syslimits.h
@@ -54,7 +54,9 @@
#define MAX_CANON 255 /* max bytes in term canon input line */
#define MAX_INPUT 255 /* max bytes in terminal input */
#define NAME_MAX 255 /* max bytes in a file name */
-#define NGROUPS_MAX 16 /* max supplemental group id's */
+#ifndef NGROUPS_MAX
+#define NGROUPS_MAX 1023 /* max supplemental group id's */
+#endif
#ifndef OPEN_MAX
#define OPEN_MAX 64 /* max open files per process */
#endif