diff options
author | Günther Deschner <gd@samba.org> | 2008-10-13 17:25:35 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-11-06 12:43:46 +0100 |
commit | 4ffbfc4475c92b9190811bd189802ff265aa6846 (patch) | |
tree | cca944d2ea4b592941fcd5a5c47385920b607b5c | |
parent | bb75f713d628073c503b06a3d217195aa95d72b2 (diff) | |
download | samba-4ffbfc4475c92b9190811bd189802ff265aa6846.tar.gz samba-4ffbfc4475c92b9190811bd189802ff265aa6846.tar.bz2 samba-4ffbfc4475c92b9190811bd189802ff265aa6846.zip |
s3-kerberos: add smb_krb5_get_tkt_from_creds().
Guenther
-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 0032e9e4f6..1499067612 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; +} + /**************************************************************** ****************************************************************/ |