4 cdef a.ubik_client * client
6 def __cinit__(self, cell=None, sec=1):
8 cdef a.afsconf_dir *cdir
9 cdef a.afsconf_cell info
11 cdef a.ktc_principal prin
12 cdef a.ktc_token token
13 cdef a.rx_securityClass *sc
24 raise Exception(code, "Error initializing Rx")
26 cdir = a.afsconf_Open(a.AFSDIR_CLIENT_ETC_DIRPATH)
28 raise OSError(a.errno,
29 "Error opening configuration directory (%s): %s" % \
30 (a.AFSDIR_CLIENT_ETC_DIRPATH, a.strerror(a.errno)))
31 code = a.afsconf_GetCellInfo(cdir, c_cell, "afsprot", &info)
33 raise Exception(code, "GetCellInfo: %s" % a.error_message(code))
36 a.strncpy(prin.cell, info.name, sizeof(prin.cell))
38 a.strncpy(prin.name, "afs", sizeof(prin.name))
40 code = a.ktc_GetToken(&prin, &token, sizeof(token), NULL);
43 # No really - we wanted authentication
44 raise Exception(code, "Failed to get token for service AFS: %s" % a.error_message(code))
51 sc = a.rxkad_NewClientSecurityObject(level, &token.sessionKey,
52 token.kvno, token.ticketLen,
56 sc = a.rxnull_NewClientSecurityObject()
60 code = a.rxs_Release(sc)
62 def __dealloc__(self):