From 1b11810826abf9a8a69e9cba3448f3da12da3e44 Mon Sep 17 00:00:00 2001 From: Evan Broder Date: Sun, 15 Mar 2009 21:02:21 -0400 Subject: [PATCH] Add SetMax. Signed-off-by: Evan Broder --- afs/_pts.pyx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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)) -- 1.7.9.5