From: Evan Broder Date: Mon, 16 Mar 2009 01:02:21 +0000 (-0400) Subject: Add SetMax. X-Git-Tag: 0.1.0~52 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-afs.git/commitdiff_plain/1b11810826abf9a8a69e9cba3448f3da12da3e44 Add SetMax. Signed-off-by: Evan Broder --- diff --git a/afs/_pts.pyx b/afs/_pts.pyx index 9eddbb0..a48c64e 100644 --- a/afs/_pts.pyx +++ b/afs/_pts.pyx @@ -41,6 +41,7 @@ cdef import from "afs/ptuser.h": 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 *) + int ubik_PR_SetMax(ubik_client *, afs_int32, afs_int32, afs_int32) cdef import from "afs/pterror.h": enum: @@ -421,3 +422,25 @@ cdef class PTS: raise Exception("Error looking up max uid/gid: %s" % afs_error_message(code)) return (uid, gid) + + def SetMaxUserId(self, id): + """ + Set the maximum currently assigned user ID (the next + automatically assigned UID will be id + 1) + """ + cdef afs_int32 code + + code = ubik_PR_SetMax(self.client, 0, id, 0) + if code != 0: + raise Exception("Error setting max uid: %s" % afs_error_message(code)) + + def SetMaxGroupId(self, id): + """ + Set the maximum currently assigned user ID (the next + automatically assigned UID will be id + 1) + """ + cdef afs_int32 code + + code = ubik_PR_SetMax(self.client, 0, id, PRGRP) + if code != 0: + raise Exception("Error setting max gid: %s" % afs_error_message(code))