Unix SMB/CIFS implementation.
test suite for PAC ndr operations
- Copyright (C) Guenther Deschner 2012
+ Copyright (C) Guenther Deschner 2012,2013
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
return true;
}
+static const uint8_t PAC_DATA_data_RODC_HMAC_MD5[] = {
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xb0, 0x01, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
+ 0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0xa8, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x08, 0x00, 0xcc, 0xcc, 0xcc, 0xcc,
+ 0xa0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0x9e, 0x72, 0x93, 0x3a, 0x82, 0x0b, 0xce, 0x01, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0x7e, 0xf8, 0x6b, 0xb2, 0x9a, 0xc0, 0xcc, 0x01, 0x7e, 0xb8, 0xd5, 0xdc,
+ 0x63, 0xc1, 0xcc, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x04, 0x00, 0x04, 0x00,
+ 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x02, 0x00,
+ 0x5d, 0x00, 0x00, 0x00, 0x52, 0x04, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x1a, 0x00, 0x20, 0x00, 0x02, 0x00,
+ 0x0e, 0x00, 0x10, 0x00, 0x24, 0x00, 0x02, 0x00, 0x28, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x67, 0x00, 0x64, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8f, 0x04, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x47, 0x00, 0x44, 0x00, 0x57, 0x00, 0x32, 0x00,
+ 0x4b, 0x00, 0x38, 0x00, 0x52, 0x00, 0x32, 0x00, 0x52, 0x00, 0x4f, 0x00,
+ 0x44, 0x00, 0x43, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00, 0x38, 0x00,
+ 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00,
+ 0x58, 0xcd, 0x06, 0x06, 0xed, 0x40, 0x2a, 0x76, 0x83, 0xc8, 0xe3, 0x99,
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0xed, 0x78, 0xcf, 0xdf, 0x0d, 0xce, 0x01,
+ 0x04, 0x00, 0x67, 0x00, 0x64, 0x00, 0x00, 0x00, 0x32, 0x00, 0x10, 0x00,
+ 0x2c, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x67, 0x00, 0x64, 0x00, 0x40, 0x00, 0x77, 0x00, 0x32, 0x00, 0x6b, 0x00,
+ 0x38, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00, 0x62, 0x00,
+ 0x65, 0x00, 0x72, 0x00, 0x2e, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00,
+ 0x68, 0x00, 0x61, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00,
+ 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x32, 0x00,
+ 0x4b, 0x00, 0x38, 0x00, 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x2e, 0x00,
+ 0x42, 0x00, 0x45, 0x00, 0x52, 0x00, 0x2e, 0x00, 0x52, 0x00, 0x45, 0x00,
+ 0x44, 0x00, 0x48, 0x00, 0x41, 0x00, 0x54, 0x00, 0x2e, 0x00, 0x43, 0x00,
+ 0x4f, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0xff, 0xff, 0xff,
+ 0xf9, 0x5d, 0x15, 0x18, 0x48, 0xd4, 0x31, 0xae, 0xf3, 0x08, 0xcc, 0x7e,
+ 0xff, 0xa5, 0x73, 0x97, 0x00, 0x00, 0x00, 0x00, 0x76, 0xff, 0xff, 0xff,
+ 0x66, 0x7e, 0x4f, 0x0d, 0x40, 0x86, 0x68, 0x5e, 0x86, 0x23, 0x75, 0x8b,
+ 0x54, 0x31, 0x69, 0xe5, 0x09, 0x60, 0x00, 0x00
+};
+
+static bool PAC_DATA_check_RODC_HMAC_MD5(struct torture_context *tctx,
+ struct PAC_DATA *r)
+{
+ int i;
+
+ torture_assert_int_equal(tctx, r->num_buffers, 5, "num_buffers");
+
+ for (i=0; i < r->num_buffers; i++) {
+
+ struct PAC_SIGNATURE_DATA sig;
+
+ switch (r->buffers[i].type) {
+ case PAC_TYPE_SRV_CHECKSUM:
+ sig = r->buffers[i].info->srv_cksum;
+ torture_assert_int_equal(tctx, r->buffers[i]._ndr_size, 20, "_ndr_size");
+ torture_assert_int_equal(tctx, sig.type, -138, "type");
+ torture_assert_int_equal(tctx, sig.signature.length, 16, "signature.length");
+ torture_assert_int_equal(tctx, sig.RODCIdentifier, 0, "sig.RODCIdentifier");
+ break;
+ case PAC_TYPE_KDC_CHECKSUM:
+ sig = r->buffers[i].info->kdc_cksum;
+ torture_assert_int_equal(tctx, r->buffers[i]._ndr_size, 22, "_ndr_size");
+ torture_assert_int_equal(tctx, sig.type, -138, "type");
+ torture_assert_int_equal(tctx, sig.signature.length, 16, "signature.length");
+ torture_assert_int_equal(tctx, sig.RODCIdentifier, 0x6009, "sig.RODCIdentifier");
+ break;
+ case PAC_TYPE_LOGON_INFO:
+ torture_assert_str_equal(tctx, r->buffers[i].info->logon_info.info->info3.base.logon_server.string, "GDW2K8R2RODC", "logon_server");
+ break;
+ default:
+ break;
+ }
+ }
+
+ return true;
+}
+
+static const uint8_t PAC_DATA_data_RODC_AES[] = {
+ 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ 0xb0, 0x01, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0a, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00,
+ 0x18, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
+ 0x10, 0x00, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x10, 0x08, 0x00, 0xcc, 0xcc, 0xcc, 0xcc,
+ 0xa0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
+ 0xcc, 0xa3, 0xe8, 0x1e, 0xc5, 0x0e, 0xce, 0x01, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0x7e, 0xf8, 0x6b, 0xb2, 0x9a, 0xc0, 0xcc, 0x01, 0x7e, 0xb8, 0xd5, 0xdc,
+ 0x63, 0xc1, 0xcc, 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f,
+ 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x02, 0x00, 0x04, 0x00, 0x04, 0x00,
+ 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x02, 0x00,
+ 0x68, 0x00, 0x00, 0x00, 0x52, 0x04, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x02, 0x00, 0x20, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x1a, 0x00, 0x20, 0x00, 0x02, 0x00,
+ 0x0e, 0x00, 0x10, 0x00, 0x24, 0x00, 0x02, 0x00, 0x28, 0x00, 0x02, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x02, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x67, 0x00, 0x64, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x01, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x8f, 0x04, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x0c, 0x00, 0x00, 0x00, 0x47, 0x00, 0x44, 0x00, 0x57, 0x00, 0x32, 0x00,
+ 0x4b, 0x00, 0x38, 0x00, 0x52, 0x00, 0x32, 0x00, 0x52, 0x00, 0x4f, 0x00,
+ 0x44, 0x00, 0x43, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x07, 0x00, 0x00, 0x00, 0x57, 0x00, 0x32, 0x00, 0x4b, 0x00, 0x38, 0x00,
+ 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
+ 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x15, 0x00, 0x00, 0x00,
+ 0x58, 0xcd, 0x06, 0x06, 0xed, 0x40, 0x2a, 0x76, 0x83, 0xc8, 0xe3, 0x99,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xeb, 0xd5, 0x27, 0xc5, 0x0e, 0xce, 0x01,
+ 0x04, 0x00, 0x67, 0x00, 0x64, 0x00, 0x00, 0x00, 0x32, 0x00, 0x10, 0x00,
+ 0x2c, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x67, 0x00, 0x64, 0x00, 0x40, 0x00, 0x77, 0x00, 0x32, 0x00, 0x6b, 0x00,
+ 0x38, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x6d, 0x00, 0x2e, 0x00, 0x62, 0x00,
+ 0x65, 0x00, 0x72, 0x00, 0x2e, 0x00, 0x72, 0x00, 0x65, 0x00, 0x64, 0x00,
+ 0x68, 0x00, 0x61, 0x00, 0x74, 0x00, 0x2e, 0x00, 0x63, 0x00, 0x6f, 0x00,
+ 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x32, 0x00,
+ 0x4b, 0x00, 0x38, 0x00, 0x44, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x2e, 0x00,
+ 0x42, 0x00, 0x45, 0x00, 0x52, 0x00, 0x2e, 0x00, 0x52, 0x00, 0x45, 0x00,
+ 0x44, 0x00, 0x48, 0x00, 0x41, 0x00, 0x54, 0x00, 0x2e, 0x00, 0x43, 0x00,
+ 0x4f, 0x00, 0x4d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
+ 0x95, 0x47, 0x8f, 0xf7, 0xea, 0xc7, 0xfb, 0x21, 0xe4, 0xc5, 0x35, 0x1a,
+ 0x10, 0x00, 0x00, 0x00, 0x1b, 0x3f, 0xd1, 0xd1, 0x4b, 0x29, 0x91, 0xa4,
+ 0xbe, 0xd1, 0x9a, 0xbe, 0x09, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
+static bool PAC_DATA_check_RODC_AES(struct torture_context *tctx,
+ struct PAC_DATA *r)
+{
+ int i;
+
+ torture_assert_int_equal(tctx, r->num_buffers, 5, "num_buffers");
+
+ for (i=0; i < r->num_buffers; i++) {
+
+ struct PAC_SIGNATURE_DATA sig;
+
+ switch (r->buffers[i].type) {
+ case PAC_TYPE_SRV_CHECKSUM:
+ sig = r->buffers[i].info->srv_cksum;
+ torture_assert_int_equal(tctx, r->buffers[i]._ndr_size, 16, "_ndr_size");
+ torture_assert_int_equal(tctx, sig.type, 0x10, "type");
+ torture_assert_int_equal(tctx, sig.signature.length, 12, "signature.length");
+ torture_assert_int_equal(tctx, sig.RODCIdentifier, 0, "sig.RODCIdentifier");
+ break;
+ case PAC_TYPE_KDC_CHECKSUM:
+ sig = r->buffers[i].info->kdc_cksum;
+ torture_assert_int_equal(tctx, r->buffers[i]._ndr_size, 18, "_ndr_size");
+ torture_assert_int_equal(tctx, sig.type, 0x10, "type");
+ torture_assert_int_equal(tctx, sig.signature.length, 12, "signature.length");
+ torture_assert_int_equal(tctx, sig.RODCIdentifier, 0x6009, "sig.RODCIdentifier");
+ break;
+ case PAC_TYPE_LOGON_INFO:
+ torture_assert_str_equal(tctx, r->buffers[i].info->logon_info.info->info3.base.logon_server.string, "GDW2K8R2RODC", "logon_server");
+ break;
+ default:
+ break;
+ }
+ }
+
+ return true;
+}
+
struct torture_suite *ndr_krb5pac_suite(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(ctx, "krb5pac");
PAC_DATA,
PAC_DATA_data2,
PAC_DATA_check2);
+ torture_suite_add_ndr_pull_test(suite,
+ PAC_DATA,
+ PAC_DATA_data_RODC_HMAC_MD5,
+ PAC_DATA_check_RODC_HMAC_MD5);
+ torture_suite_add_ndr_pull_test(suite,
+ PAC_DATA,
+ PAC_DATA_data_RODC_AES,
+ PAC_DATA_check_RODC_AES);
+
/*
torture_suite_add_ndr_pull_validate_test(suite,
PAC_DATA,