From c16288e834009b59936443ce4e73e9afd147bb01 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sun, 15 Mar 2009 20:56:56 -0400 Subject: [PATCH] Add ListMax for getting the maximum (and minimum) user ID and group ID Signed-off-by: Evan Broder --- afs/_pts.pyx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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) -- 1.7.9.5