Revision: 4128 http://trac.macosforge.org/projects/calendarserver/changeset/4128 Author: wsanchez@apple.com Date: 2009-05-01 09:58:39 -0700 (Fri, 01 May 2009) Log Message: ----------- Pulled up r4116 from trunk. Added Paths: ----------- CalendarServer/branches/release/CalendarServer-2.2-dev/lib-patches/Twisted/twisted.python.util.patch Property Changed: ---------------- CalendarServer/branches/release/CalendarServer-2.2-dev/ CalendarServer/branches/release/CalendarServer-2.2-dev/doc/Extensions/caldav-privatecomments.txt CalendarServer/branches/release/CalendarServer-2.2-dev/doc/Extensions/caldav-privatecomments.xml CalendarServer/branches/release/CalendarServer-2.2-dev/doc/Extensions/caldav-schedulingchanges.txt CalendarServer/branches/release/CalendarServer-2.2-dev/doc/Extensions/caldav-schedulingchanges.xml Property changes on: CalendarServer/branches/release/CalendarServer-2.2-dev ___________________________________________________________________ Modified: svn:mergeinfo - /CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067 /CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075 /CalendarServer/trunk:4105-4107,4113-4115 + /CalendarServer/branches/users/sagen/resource-delegates-4038:4040-4067 /CalendarServer/branches/users/sagen/resource-delegates-4066:4068-4075 /CalendarServer/trunk:4105-4107,4113-4116 Property changes on: CalendarServer/branches/release/CalendarServer-2.2-dev/doc/Extensions/caldav-privatecomments.txt ___________________________________________________________________ Modified: svn:mergeinfo - /CalendarServer/branches/users/cdaboo/attendee-comments-2886/doc/Extensions/caldav-privatecomments-00.txt:2887-2910 /CalendarServer/branches/users/cdaboo/byebye-serviceslocator-2937/doc/Extensions/caldav-privatecomments-00.txt:2938-3097 /CalendarServer/branches/users/cdaboo/implicit-if-match-3306/doc/Extensions/caldav-privatecomments.txt:3307-3349 /CalendarServer/branches/users/cdaboo/implicitauto-2947/doc/Extensions/caldav-privatecomments-00.txt:2948-2989 /CalendarServer/branches/users/cdaboo/location-partial-accept-3573/doc/Extensions/caldav-privatecomments.txt:3574-3581 /CalendarServer/branches/users/sagen/resource-delegates-4038/doc/Extensions/caldav-privatecomments.txt:4040-4067 /CalendarServer/branches/users/sagen/resource-delegates-4066/doc/Extensions/caldav-privatecomments.txt:4068-4075 /CalendarServer/trunk/doc/Extensions/caldav-privatecomments.txt:4105-4107,4113-4115 + /CalendarServer/branches/users/cdaboo/attendee-comments-2886/doc/Extensions/caldav-privatecomments-00.txt:2887-2910 /CalendarServer/branches/users/cdaboo/byebye-serviceslocator-2937/doc/Extensions/caldav-privatecomments-00.txt:2938-3097 /CalendarServer/branches/users/cdaboo/implicit-if-match-3306/doc/Extensions/caldav-privatecomments.txt:3307-3349 /CalendarServer/branches/users/cdaboo/implicitauto-2947/doc/Extensions/caldav-privatecomments-00.txt:2948-2989 /CalendarServer/branches/users/cdaboo/location-partial-accept-3573/doc/Extensions/caldav-privatecomments.txt:3574-3581 /CalendarServer/branches/users/sagen/resource-delegates-4038/doc/Extensions/caldav-privatecomments.txt:4040-4067 /CalendarServer/branches/users/sagen/resource-delegates-4066/doc/Extensions/caldav-privatecomments.txt:4068-4075 /CalendarServer/trunk/doc/Extensions/caldav-privatecomments.txt:4105-4107,4113-4116 Property changes on: CalendarServer/branches/release/CalendarServer-2.2-dev/doc/Extensions/caldav-privatecomments.xml ___________________________________________________________________ Modified: svn:mergeinfo - /CalendarServer/branches/users/cdaboo/attendee-comments-2886/doc/Extensions/caldav-privatecomments-00.xml:2887-2910 /CalendarServer/branches/users/cdaboo/byebye-serviceslocator-2937/doc/Extensions/caldav-privatecomments-00.xml:2938-3097 /CalendarServer/branches/users/cdaboo/implicit-if-match-3306/doc/Extensions/caldav-privatecomments.xml:3307-3349 /CalendarServer/branches/users/cdaboo/implicitauto-2947/doc/Extensions/caldav-privatecomments-00.xml:2948-2989 /CalendarServer/branches/users/cdaboo/location-partial-accept-3573/doc/Extensions/caldav-privatecomments.xml:3574-3581 /CalendarServer/branches/users/sagen/resource-delegates-4038/doc/Extensions/caldav-privatecomments.xml:4040-4067 /CalendarServer/branches/users/sagen/resource-delegates-4066/doc/Extensions/caldav-privatecomments.xml:4068-4075 /CalendarServer/trunk/doc/Extensions/caldav-privatecomments.xml:4105-4107,4113-4115 + /CalendarServer/branches/users/cdaboo/attendee-comments-2886/doc/Extensions/caldav-privatecomments-00.xml:2887-2910 /CalendarServer/branches/users/cdaboo/byebye-serviceslocator-2937/doc/Extensions/caldav-privatecomments-00.xml:2938-3097 /CalendarServer/branches/users/cdaboo/implicit-if-match-3306/doc/Extensions/caldav-privatecomments.xml:3307-3349 /CalendarServer/branches/users/cdaboo/implicitauto-2947/doc/Extensions/caldav-privatecomments-00.xml:2948-2989 /CalendarServer/branches/users/cdaboo/location-partial-accept-3573/doc/Extensions/caldav-privatecomments.xml:3574-3581 /CalendarServer/branches/users/sagen/resource-delegates-4038/doc/Extensions/caldav-privatecomments.xml:4040-4067 /CalendarServer/branches/users/sagen/resource-delegates-4066/doc/Extensions/caldav-privatecomments.xml:4068-4075 /CalendarServer/trunk/doc/Extensions/caldav-privatecomments.xml:4105-4107,4113-4116 Property changes on: CalendarServer/branches/release/CalendarServer-2.2-dev/doc/Extensions/caldav-schedulingchanges.txt ___________________________________________________________________ Modified: svn:mergeinfo - /CalendarServer/branches/users/cdaboo/attendee-comments-2886/doc/Extensions/caldav-schedulingchanges-01.txt:2887-2910 /CalendarServer/branches/users/cdaboo/byebye-serviceslocator-2937/doc/Extensions/caldav-schedulingchanges-01.txt:2938-3097 /CalendarServer/branches/users/cdaboo/implicit-if-match-3306/doc/Extensions/caldav-schedulingchanges.txt:3307-3349 /CalendarServer/branches/users/cdaboo/implicitauto-2947/doc/Extensions/caldav-schedulingchanges-01.txt:2948-2989 /CalendarServer/branches/users/cdaboo/location-partial-accept-3573/doc/Extensions/caldav-schedulingchanges.txt:3574-3581 /CalendarServer/branches/users/sagen/resource-delegates-4038/doc/Extensions/caldav-schedulingchanges.txt:4040-4067 /CalendarServer/branches/users/sagen/resource-delegates-4066/doc/Extensions/caldav-schedulingchanges.txt:4068-4075 /CalendarServer/trunk/doc/Extensions/caldav-schedulingchanges.txt:4105-4107,4113-4115 + /CalendarServer/branches/users/cdaboo/attendee-comments-2886/doc/Extensions/caldav-schedulingchanges-01.txt:2887-2910 /CalendarServer/branches/users/cdaboo/byebye-serviceslocator-2937/doc/Extensions/caldav-schedulingchanges-01.txt:2938-3097 /CalendarServer/branches/users/cdaboo/implicit-if-match-3306/doc/Extensions/caldav-schedulingchanges.txt:3307-3349 /CalendarServer/branches/users/cdaboo/implicitauto-2947/doc/Extensions/caldav-schedulingchanges-01.txt:2948-2989 /CalendarServer/branches/users/cdaboo/location-partial-accept-3573/doc/Extensions/caldav-schedulingchanges.txt:3574-3581 /CalendarServer/branches/users/sagen/resource-delegates-4038/doc/Extensions/caldav-schedulingchanges.txt:4040-4067 /CalendarServer/branches/users/sagen/resource-delegates-4066/doc/Extensions/caldav-schedulingchanges.txt:4068-4075 /CalendarServer/trunk/doc/Extensions/caldav-schedulingchanges.txt:4105-4107,4113-4116 Property changes on: CalendarServer/branches/release/CalendarServer-2.2-dev/doc/Extensions/caldav-schedulingchanges.xml ___________________________________________________________________ Modified: svn:mergeinfo - /CalendarServer/branches/users/cdaboo/attendee-comments-2886/doc/Extensions/caldav-schedulingchanges-01.xml:2887-2910 /CalendarServer/branches/users/cdaboo/byebye-serviceslocator-2937/doc/Extensions/caldav-schedulingchanges-01.xml:2938-3097 /CalendarServer/branches/users/cdaboo/implicit-if-match-3306/doc/Extensions/caldav-schedulingchanges.xml:3307-3349 /CalendarServer/branches/users/cdaboo/implicitauto-2947/doc/Extensions/caldav-schedulingchanges-01.xml:2948-2989 /CalendarServer/branches/users/cdaboo/location-partial-accept-3573/doc/Extensions/caldav-schedulingchanges.xml:3574-3581 /CalendarServer/branches/users/sagen/resource-delegates-4038/doc/Extensions/caldav-schedulingchanges.xml:4040-4067 /CalendarServer/branches/users/sagen/resource-delegates-4066/doc/Extensions/caldav-schedulingchanges.xml:4068-4075 /CalendarServer/trunk/doc/Extensions/caldav-schedulingchanges.xml:4105-4107,4113-4115 + /CalendarServer/branches/users/cdaboo/attendee-comments-2886/doc/Extensions/caldav-schedulingchanges-01.xml:2887-2910 /CalendarServer/branches/users/cdaboo/byebye-serviceslocator-2937/doc/Extensions/caldav-schedulingchanges-01.xml:2938-3097 /CalendarServer/branches/users/cdaboo/implicit-if-match-3306/doc/Extensions/caldav-schedulingchanges.xml:3307-3349 /CalendarServer/branches/users/cdaboo/implicitauto-2947/doc/Extensions/caldav-schedulingchanges-01.xml:2948-2989 /CalendarServer/branches/users/cdaboo/location-partial-accept-3573/doc/Extensions/caldav-schedulingchanges.xml:3574-3581 /CalendarServer/branches/users/sagen/resource-delegates-4038/doc/Extensions/caldav-schedulingchanges.xml:4040-4067 /CalendarServer/branches/users/sagen/resource-delegates-4066/doc/Extensions/caldav-schedulingchanges.xml:4068-4075 /CalendarServer/trunk/doc/Extensions/caldav-schedulingchanges.xml:4105-4107,4113-4116 Copied: CalendarServer/branches/release/CalendarServer-2.2-dev/lib-patches/Twisted/twisted.python.util.patch (from rev 4116, CalendarServer/trunk/lib-patches/Twisted/twisted.python.util.patch) =================================================================== --- CalendarServer/branches/release/CalendarServer-2.2-dev/lib-patches/Twisted/twisted.python.util.patch (rev 0) +++ CalendarServer/branches/release/CalendarServer-2.2-dev/lib-patches/Twisted/twisted.python.util.patch 2009-05-01 16:58:39 UTC (rev 4128) @@ -0,0 +1,180 @@ +Index: twisted/python/util.py +=================================================================== +--- twisted/python/util.py (revision 19773) ++++ twisted/python/util.py (working copy) +@@ -561,83 +561,107 @@ + L2.sort() + return [e[2] for e in L2] + ++ ++# The python implementation of initgroups below, which iterates all groups, ++# doesn't scale, so use the libc version if available: ++ + try: +- import pwd, grp +- from os import setgroups, getgroups +- +- def _setgroups_until_success(l): +- while(1): +- # NASTY NASTY HACK (but glibc does it so it must be okay): +- # In case sysconfig didn't give the right answer, find the limit +- # on max groups by just looping, trying to set fewer and fewer +- # groups each time until it succeeds. ++ from ctypes import * ++ import ctypes.util ++ hasCtypes = True ++except ImportError: ++ hasCtypes = False ++ ++if sys.platform == "darwin" and hasCtypes: ++ import pwd ++ ++ libc = cdll.LoadLibrary(ctypes.util.find_library("libc")) ++ ++ def initgroups(uid, primaryGid): ++ c_gid = c_int(primaryGid) ++ username = pwd.getpwuid(uid)[0] ++ c_username = c_char_p(username) ++ return libc.initgroups(c_username, c_gid) ++ ++else: ++ # Original twisted implementation ++ try: ++ import pwd, grp ++ from os import setgroups, getgroups ++ ++ def _setgroups_until_success(l): ++ while(1): ++ # NASTY NASTY HACK (but glibc does it so it must be okay): ++ # In case sysconfig didn't give the right answer, find the limit ++ # on max groups by just looping, trying to set fewer and fewer ++ # groups each time until it succeeds. ++ try: ++ setgroups(l) ++ except ValueError: ++ # This exception comes from python itself restricting ++ # number of groups allowed. ++ if len(l) > 1: ++ del l[-1] ++ else: ++ raise ++ except OSError, e: ++ if e.errno == errno.EINVAL and len(l) > 1: ++ # This comes from the OS saying too many groups ++ del l[-1] ++ else: ++ raise ++ else: ++ # Success, yay! ++ return ++ ++ def initgroups(uid, primaryGid): ++ """Initializes the group access list. ++ ++ This is done by reading the group database /etc/group and using all ++ groups of which C{uid} is a member. The additional group ++ C{primaryGid} is also added to the list. ++ ++ If the given user is a member of more than C{NGROUPS}, arbitrary ++ groups will be silently discarded to bring the number below that ++ limit. ++ """ + try: +- setgroups(l) +- except ValueError: +- # This exception comes from python itself restricting +- # number of groups allowed. +- if len(l) > 1: +- del l[-1] +- else: +- raise ++ # Try to get the maximum number of groups ++ max_groups = os.sysconf("SC_NGROUPS_MAX") ++ except: ++ # No predefined limit ++ max_groups = 0 ++ ++ username = pwd.getpwuid(uid)[0] ++ l = [] ++ if primaryGid is not None: ++ l.append(primaryGid) ++ for groupname, password, gid, userlist in grp.getgrall(): ++ if username in userlist: ++ l.append(gid) ++ if len(l) == max_groups: ++ break # No more groups, ignore any more ++ try: ++ _setgroups_until_success(l) + except OSError, e: +- if e.errno == errno.EINVAL and len(l) > 1: +- # This comes from the OS saying too many groups +- del l[-1] ++ # We might be able to remove this code now that we ++ # don't try to setgid/setuid even when not asked to. ++ if e.errno == errno.EPERM: ++ for g in getgroups(): ++ if g not in l: ++ raise + else: + raise +- else: +- # Success, yay! +- return +- +- def initgroups(uid, primaryGid): +- """Initializes the group access list. ++ + +- This is done by reading the group database /etc/group and using all +- groups of which C{uid} is a member. The additional group +- C{primaryGid} is also added to the list. ++ except: ++ def initgroups(uid, primaryGid): ++ """Do nothing. + +- If the given user is a member of more than C{NGROUPS}, arbitrary +- groups will be silently discarded to bring the number below that +- limit. +- """ +- try: +- # Try to get the maximum number of groups +- max_groups = os.sysconf("SC_NGROUPS_MAX") +- except: +- # No predefined limit +- max_groups = 0 +- +- username = pwd.getpwuid(uid)[0] +- l = [] +- if primaryGid is not None: +- l.append(primaryGid) +- for groupname, password, gid, userlist in grp.getgrall(): +- if username in userlist: +- l.append(gid) +- if len(l) == max_groups: +- break # No more groups, ignore any more +- try: +- _setgroups_until_success(l) +- except OSError, e: +- # We might be able to remove this code now that we +- # don't try to setgid/setuid even when not asked to. +- if e.errno == errno.EPERM: +- for g in getgroups(): +- if g not in l: +- raise +- else: +- raise +- ++ Underlying platform support require to manipulate groups is missing. ++ """ + +-except: +- def initgroups(uid, primaryGid): +- """Do nothing. + +- Underlying platform support require to manipulate groups is missing. +- """ +- +- + def switchUID(uid, gid, euid=False): + if euid: + setuid = os.seteuid
participants (1)
-
source_changes@macosforge.org