From: Evan Broder Date: Mon, 16 Mar 2009 00:56:56 +0000 (-0400) Subject: Add ListMax for getting the maximum (and minimum) user ID and group ID X-Git-Tag: 0.1.0~53 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-afs.git/commitdiff_plain/c16288e834009b59936443ce4e73e9afd147bb01?hp=b5df6079cc89dd5cdb2bb5e9c4ad1a62eefa78b0 Add ListMax for getting the maximum (and minimum) user ID and group ID Signed-off-by: Evan Broder --- diff --git a/afs/_pts.pyx b/afs/_pts.pyx index d050a4c..9eddbb0 100644 --- a/afs/_pts.pyx +++ b/afs/_pts.pyx @@ -40,6 +40,7 @@ cdef import from "afs/ptuser.h": int ubik_PR_ListEntry(ubik_client *, afs_int32, afs_int32, prcheckentry *) int ubik_PR_ChangeEntry(ubik_client *, afs_int32, afs_int32, char *, afs_int32, afs_int32) int ubik_PR_IsAMemberOf(ubik_client *, afs_int32, afs_int32, afs_int32, afs_int32 *) + int ubik_PR_ListMax(ubik_client *, afs_int32, afs_int32 *, afs_int32 *) cdef import from "afs/pterror.h": enum: @@ -407,3 +408,16 @@ cdef class PTS: raise Exception("Error testing membership: %s" % afs_error_message(code)) return bool(flag) + + def ListMax(self): + """ + Return a tuple of the maximum user ID and the maximum group + ID currently assigned. + """ + cdef afs_int32 code, uid, gid + + code = ubik_PR_ListMax(self.client, 0, &uid, &gid) + if code != 0: + raise Exception("Error looking up max uid/gid: %s" % afs_error_message(code)) + + return (uid, gid)