From fb26a7edaf0fcee44fd60eabf4aaf38f0680c0ff Mon Sep 17 00:00:00 2001 From: Benjamin Franzke Date: Tue, 15 Oct 2013 12:55:06 +0200 Subject: heimdal: Use sss_krb5_princ_realm where not yet --- src/providers/krb5/krb5_child.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c index 06e1654c..5bc6ec00 100644 --- a/src/providers/krb5/krb5_child.c +++ b/src/providers/krb5/krb5_child.c @@ -397,7 +397,8 @@ static krb5_error_code create_empty_cred(krb5_context ctx, krb5_principal princ, { krb5_error_code kerr; krb5_creds *cred = NULL; - krb5_data *krb5_realm; + const char *realm_name; + int realm_length; cred = calloc(sizeof(krb5_creds), 1); if (cred == NULL) { @@ -411,12 +412,12 @@ static krb5_error_code create_empty_cred(krb5_context ctx, krb5_principal princ, goto done; } - krb5_realm = krb5_princ_realm(ctx, princ); + sss_krb5_princ_realm(ctx, princ, &realm_name, &realm_length); kerr = krb5_build_principal_ext(ctx, &cred->server, - krb5_realm->length, krb5_realm->data, + realm_length, realm_name, KRB5_TGS_NAME_SIZE, KRB5_TGS_NAME, - krb5_realm->length, krb5_realm->data, 0); + realm_length, realm_name, 0); if (kerr != 0) { DEBUG(1, ("krb5_build_principal_ext failed.\n")); goto done; @@ -1698,7 +1699,8 @@ static errno_t k5c_recv_data(struct krb5_req *kr, int fd, uint32_t *offline) static int k5c_setup_fast(struct krb5_req *kr, char *lifetime_str, bool demand) { krb5_principal fast_princ_struct; - krb5_data *realm_data; + const char *realm_name; + int realm_length; char *fast_principal_realm; char *fast_principal; krb5_error_code kerr; @@ -1729,8 +1731,11 @@ static int k5c_setup_fast(struct krb5_req *kr, char *lifetime_str, bool demand) return KRB5KRB_ERR_GENERIC; } free(tmp_str); - realm_data = krb5_princ_realm(kr->ctx, fast_princ_struct); - fast_principal_realm = talloc_asprintf(kr, "%.*s", realm_data->length, realm_data->data); + sss_krb5_princ_realm(kr->ctx, fast_princ_struct, + &realm_name, &realm_length); + + fast_principal_realm = talloc_asprintf(kr, "%.*s", + realm_length, realm_name); if (!fast_principal_realm) { DEBUG(1, ("talloc_asprintf failed.\n")); return ENOMEM; -- cgit