4 cdef ubik_client * client
6 def __cinit__(self, cell=None, sec=1):
11 cdef ktc_principal prin
13 cdef rx_securityClass *sc
14 cdef rx_connection *serverconns[MAXSERVERS]
26 raise Exception(code, "Error initializing Rx")
28 cdir = afsconf_Open(AFSDIR_CLIENT_ETC_DIRPATH)
31 "Error opening configuration directory (%s): %s" % \
32 (AFSDIR_CLIENT_ETC_DIRPATH, strerror(errno)))
33 code = afsconf_GetCellInfo(cdir, c_cell, "afsprot", &info)
35 raise Exception(code, "GetCellInfo: %s" % afs_error_message(code))
38 strncpy(prin.cell, info.name, sizeof(prin.cell))
40 strncpy(prin.name, "afs", sizeof(prin.name))
42 code = ktc_GetToken(&prin, &token, sizeof(token), NULL);
45 # No really - we wanted authentication
46 raise Exception(code, "Failed to get token for service AFS: %s" % afs_error_message(code))
53 sc = rxkad_NewClientSecurityObject(level, &token.sessionKey,
54 token.kvno, token.ticketLen,
58 sc = rxnull_NewClientSecurityObject()
62 memset(serverconns, 0, sizeof(serverconns))
63 for 0 <= i < info.numServers:
64 serverconns[i] = rx_NewConnection(info.hostAddr[i].sin_addr.s_addr,
65 info.hostAddr[i].sin_port,
70 code = ubik_ClientInit(serverconns, &self.client)
72 raise Exception("Failed to initialize ubik connection to Protection server: %s" % afs_error_message(code))
74 code = rxs_Release(sc)
76 def __dealloc__(self):
77 ubik_ClientDestroy(self.client)