krb5_wrap: Add MIT implmentation of smb_krb5_keyblock_init_contents()
authorAndreas Schneider <asn@samba.org>
Mon, 29 Aug 2016 09:29:34 +0000 (11:29 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 31 Aug 2016 18:59:16 +0000 (20:59 +0200)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/krb5_wrap/krb5_samba.c

index a28580b122196dc0b70b82285287b6d7948ae0dc..06f144971f9d03f6da9ab4c14c1771cd20140e19 100644 (file)
@@ -1681,6 +1681,22 @@ krb5_error_code smb_krb5_keyblock_init_contents(krb5_context context,
 {
 #if defined(HAVE_KRB5_KEYBLOCK_INIT)
        return krb5_keyblock_init(context, enctype, data, length, key);
+#elif defined(HAVE_KRB5_INIT_KEYBLOCK)
+       krb5_error_code code;
+
+       code = krb5_init_keyblock(context,
+                                 enctype,
+                                 length,
+                                 key);
+       if (code != 0) {
+               return code;
+       }
+
+       if (length != 0) {
+               memcpy(KRB5_KEY_DATA(key), data, length);
+       }
+
+       return 0;
 #else
        memset(key, 0, sizeof(krb5_keyblock));
        KRB5_KEY_DATA(key) = SMB_MALLOC(length);