X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-afs.git/blobdiff_plain/a589b6a78351509326cd03bc790c271de31e7914..4af97584e2401ec114fbbd846a46700613d50a15:/afs/_pts.pyx diff --git a/afs/_pts.pyx b/afs/_pts.pyx index eb62c08..2ebc064 100644 --- a/afs/_pts.pyx +++ b/afs/_pts.pyx @@ -1,5 +1,6 @@ from afs cimport * from afs import pyafs_error +import re cdef import from "afs/ptuser.h": enum: @@ -71,6 +72,27 @@ cdef import from "afs/pterror.h": enum: PRNOENT +cdef import from "krb5/krb5.h": + struct _krb5_context: + pass + struct krb5_principal_data: + pass + + ctypedef _krb5_context * krb5_context + ctypedef krb5_principal_data * krb5_principal + + ctypedef long krb5_int32 + ctypedef krb5_int32 krb5_error_code + krb5_error_code krb5_init_context(krb5_context *) + krb5_error_code krb5_parse_name(krb5_context, char *, krb5_principal *) + krb5_error_code krb5_unparse_name(krb5_context, krb5_principal, char **) + krb5_error_code krb5_524_conv_principal(krb5_context, krb5_principal, char *, char *, char *) + krb5_error_code krb5_425_conv_principal(krb5_context, char *, char *, char *, krb5_principal *) + krb5_error_code krb5_get_host_realm(krb5_context, char *, char ***) + void krb5_free_host_realm(krb5_context, char **) + void krb5_free_principal(krb5_context, krb5_principal) + void krb5_free_context(krb5_context) + cdef class PTEntry: cdef public afs_int32 flags cdef public afs_int32 id @@ -117,6 +139,28 @@ cdef int _ptentry_to_c(prcheckentry * c_entry, PTEntry p_entry) except -1: strncpy(c_entry.name, p_entry.name, sizeof(c_entry.name)) return 0 +cdef object kname_re = re.compile(r'^([^.].*?)(? 0: @@ -217,7 +275,7 @@ cdef class PTS: name if it's a string, or otherwise just converting it to an integer. """ - if isinstance(ident, (str, unicode)): + if isinstance(ident, basestring): return self._NameToId(ident) else: return int(ident)