diff options
author | Simo Sorce <idra@samba.org> | 2012-04-26 16:52:37 -0400 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2012-05-04 16:51:28 +0200 |
commit | 93de8e45707ab834eb9d4e2a442025d109955382 (patch) | |
tree | 66b871e0f2ba4a2561282ca5aec4c7c464dee569 /lib | |
parent | 62f3be7af3f743ddc2ec0c4d8e6a431fae583282 (diff) | |
download | samba-93de8e45707ab834eb9d4e2a442025d109955382.tar.gz samba-93de8e45707ab834eb9d4e2a442025d109955382.tar.bz2 samba-93de8e45707ab834eb9d4e2a442025d109955382.zip |
krb5samba: Add compat code to initialize keyblock contents
Diffstat (limited to 'lib')
-rw-r--r-- | lib/krb5_wrap/krb5_samba.c | 22 | ||||
-rw-r--r-- | lib/krb5_wrap/krb5_samba.h | 5 |
2 files changed, 27 insertions, 0 deletions
diff --git a/lib/krb5_wrap/krb5_samba.c b/lib/krb5_wrap/krb5_samba.c index 82c25103e7..482684fc11 100644 --- a/lib/krb5_wrap/krb5_samba.c +++ b/lib/krb5_wrap/krb5_samba.c @@ -1555,6 +1555,28 @@ krb5_error_code smb_krb5_get_creds(const char *server_s, return ret; } + +krb5_error_code smb_krb5_keyblock_init_contents(krb5_context context, + krb5_enctype enctype, + const void *data, + size_t length, + krb5_keyblock *key) +{ +#if defined(HAVE_KRB5_KEYBLOCK_INIT) + return krb5_keyblock_init(context, enctype, data, length, key); +#else + memset(key, 0, sizeof(krb5_keyblock)); + KRB5_KEY_DATA(key) = SMB_MALLOC(length); + if (NULL == KRB5_KEY_DATA(key)) { + return ENOMEM; + } + memcpy(KRB5_KEY_DATA(key), data, length); + KRB5_KEY_LENGTH(key) = length; + KRB5_KEY_TYPE(key) = enctype; + return 0; +#endif +} + /* simulate a kinit, putting the tgt in the given credentials cache. Orignally by remus@snapserver.com diff --git a/lib/krb5_wrap/krb5_samba.h b/lib/krb5_wrap/krb5_samba.h index e2bd634d7a..a60be35a98 100644 --- a/lib/krb5_wrap/krb5_samba.h +++ b/lib/krb5_wrap/krb5_samba.h @@ -198,6 +198,11 @@ krb5_error_code smb_krb5_get_creds(const char *server_s, const char *cc, const char *impersonate_princ_s, krb5_creds **creds_p); +krb5_error_code smb_krb5_keyblock_init_contents(krb5_context context, + krb5_enctype enctype, + const void *data, + size_t length, + krb5_keyblock *key); krb5_error_code kerberos_kinit_keyblock_cc(krb5_context ctx, krb5_ccache cc, krb5_principal principal, krb5_keyblock *keyblock, |