diff options
Diffstat (limited to 'src/kim/lib/kim_identity.c')
-rw-r--r-- | src/kim/lib/kim_identity.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/kim/lib/kim_identity.c b/src/kim/lib/kim_identity.c index 333067bc5..b431ae8b8 100644 --- a/src/kim/lib/kim_identity.c +++ b/src/kim/lib/kim_identity.c @@ -200,14 +200,21 @@ kim_error kim_identity_create_from_krb5_principal (kim_identity *out_identity, if (!err && !out_identity ) { err = check_error (KIM_NULL_PARAMETER_ERR); } if (!err && !in_krb5_principal) { err = check_error (KIM_NULL_PARAMETER_ERR); } - if (!err && !in_krb5_context ) { err = check_error (KIM_NULL_PARAMETER_ERR); } + /* KLCreatePrincipalFromKerberos5Principal passes NULL in_krb5_context */ if (!err) { err = kim_identity_allocate (&identity); } if (!err) { - err = krb5_error (NULL, krb5_init_context (&identity->context)); + if (in_krb5_context) { + err = krb5_error (in_krb5_context, + krb5_copy_context (in_krb5_context, + &identity->context)); + } else { + err = krb5_error (NULL, + krb5_init_context (&identity->context)); + } } if (!err) { @@ -440,8 +447,8 @@ kim_error kim_identity_get_component_at_index (kim_identity in_identity, /* ------------------------------------------------------------------------ */ -kim_error kim_identity_get_components (kim_identity in_identity, - kim_string *out_components) +kim_error kim_identity_get_components_string (kim_identity in_identity, + kim_string *out_components) { kim_error err = KIM_NO_ERROR; kim_string components = NULL; @@ -502,8 +509,8 @@ kim_error kim_identity_get_krb5_principal (kim_identity in_identity, if (!err && !out_krb5_principal) { err = check_error (KIM_NULL_PARAMETER_ERR); } if (!err) { - err = krb5_error (in_identity->context, - krb5_copy_principal (in_identity->context, + err = krb5_error (in_krb5_context, + krb5_copy_principal (in_krb5_context, in_identity->principal, out_krb5_principal)); } @@ -513,6 +520,17 @@ kim_error kim_identity_get_krb5_principal (kim_identity in_identity, /* ------------------------------------------------------------------------ */ +krb5_principal kim_identity_krb5_principal (kim_identity in_identity) +{ + if (in_identity) { + return in_identity->principal; + } + check_error (KIM_NULL_PARAMETER_ERR); /* log error */ + return NULL; +} + +/* ------------------------------------------------------------------------ */ + kim_error kim_identity_is_tgt_service (kim_identity in_identity, kim_boolean *out_is_tgt_service) { |