diff options
author | Günther Deschner <gd@samba.org> | 2008-10-13 17:25:35 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2009-11-26 11:40:18 +0100 |
commit | abe630be4f1b214c5e2f0896acc312e592e30eee (patch) | |
tree | 13ba3630c6c1f52df68e3b1b8d064f7916bb14f1 | |
parent | 6603017570875d79f2fd89bbec3745c6379deab6 (diff) | |
download | samba-abe630be4f1b214c5e2f0896acc312e592e30eee.tar.gz samba-abe630be4f1b214c5e2f0896acc312e592e30eee.tar.xz samba-abe630be4f1b214c5e2f0896acc312e592e30eee.zip |
s3-kerberos: add smb_krb5_get_tkt_from_creds().
Guenther
(cherry picked from commit 4ffbfc4475c92b9190811bd189802ff265aa6846)
(cherry picked from commit be4ad69eb9cd835ef9e97654793e60403c296b3a)
-rw-r--r-- | source3/libads/authdata.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c index 0032e9e4f65..14990676123 100644 --- a/source3/libads/authdata.c +++ b/source3/libads/authdata.c @@ -335,6 +335,46 @@ struct PAC_LOGON_INFO *get_logon_info_from_pac(struct PAC_DATA *pac_data) return NULL; } +static krb5_error_code smb_krb5_get_tkt_from_creds(krb5_creds *creds, + DATA_BLOB *tkt) +{ + krb5_error_code ret; + krb5_context context; + krb5_auth_context auth_context = NULL; + krb5_data inbuf, outbuf; + + ret = krb5_init_context(&context); + if (ret) { + return ret; + } + + ret = krb5_auth_con_init(context, &auth_context); + if (ret) { + goto done; + } + + ZERO_STRUCT(inbuf); + + ret = krb5_mk_req_extended(context, &auth_context, AP_OPTS_USE_SUBKEY, + &inbuf, creds, &outbuf); + if (ret) { + goto done; + } + + *tkt = data_blob(outbuf.data, outbuf.length); + done: + if (!context) { + return ret; + } + krb5_free_data_contents(context, &outbuf); + if (auth_context) { + krb5_auth_con_free(context, auth_context); + } + krb5_free_context(context); + + return ret; +} + /**************************************************************** ****************************************************************/ |