1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

python/tests: Add test for new krb5 keytab parser

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jo Sutton <josutton@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2024-02-21 10:22:12 +13:00
parent e6ef2fc224
commit 2e230f728e
3 changed files with 85 additions and 0 deletions

View File

@ -561,3 +561,21 @@ dump OK
self.fail(e)
self.assertEqual(actual, expected)
def test_ndrdump_keyetab(self):
with open(self.data_path(
'secrets.keytab.txt')) as f:
expected = f.read()
data_path = self.data_path(
'secrets.keytab')
# We don't do a validate on this as the parser deliberately
# ignores some extra data written by Heimdal, but not MIT.
try:
actual = self.check_output(
'ndrdump krb5ccache KEYTAB struct '
+ data_path)
except BlackboxProcessError as e:
self.fail(e)
self.assertEqual(actual, expected.encode('utf-8'))

Binary file not shown.

View File

@ -0,0 +1,67 @@
pull returned Success
KEYTAB: struct KEYTAB
pvno : 0x05 (5)
version : 0x02 (2)
entry: struct KEYTAB_ENTRY
principal: struct KEYTAB_PRINCIPAL
component_count : 0x0002 (2)
realm : 'ADDOM.SAMBA.EXAMPLE.COM'
components: ARRAY(2)
components : 'HOST'
components : 'addc'
name_type : 0x00000001 (1)
timestamp : 0x65d3c99c (1708378524)
key_version : 0x01 (1)
enctype : 0x0012 (18)
key: struct KEYTAB_KEYBLOCK
length : 0x0020 (32)
data : acfa2fae41b4c901c50a223dd3722d154f8c380d52a307d68f8de1ba817182da
full_key_version : 0x00000001 (1)
further_entry : DATA_BLOB length=729
[0000] 00 00 00 74 00 02 00 17 41 44 44 4F 4D 2E 53 41 ...t.... ADDOM.SA
[0010] 4D 42 41 2E 45 58 41 4D 50 4C 45 2E 43 4F 4D 00 MBA.EXAM PLE.COM.
[0020] 04 48 4F 53 54 00 1C 61 64 64 63 2E 61 64 64 6F .HOST..a ddc.addo
[0030] 6D 2E 73 61 6D 62 61 2E 65 78 61 6D 70 6C 65 2E m.samba. example.
[0040] 63 6F 6D 00 00 00 01 65 D3 C9 9C 01 00 12 00 20 com....e .......
[0050] AC FA 2F AE 41 B4 C9 01 C5 0A 22 3D D3 72 2D 15 ../.A... .."=.r-.
[0060] 4F 8C 38 0D 52 A3 07 D6 8F 8D E1 BA 81 71 82 DA O.8.R... .....q..
[0070] 00 00 00 01 00 00 00 00 00 00 00 57 00 01 00 17 ........ ...W....
[0080] 41 44 44 4F 4D 2E 53 41 4D 42 41 2E 45 58 41 4D ADDOM.SA MBA.EXAM
[0090] 50 4C 45 2E 43 4F 4D 00 05 41 44 44 43 24 00 00 PLE.COM. .ADDC$..
[00A0] 00 01 65 D3 C9 9C 01 00 12 00 20 AC FA 2F AE 41 ..e..... .. ../.A
[00B0] B4 C9 01 C5 0A 22 3D D3 72 2D 15 4F 8C 38 0D 52 ....."=. r-.O.8.R
[00C0] A3 07 D6 8F 8D E1 BA 81 71 82 DA 00 00 00 01 00 ........ q.......
[00D0] 00 00 00 00 00 00 4C 00 02 00 17 41 44 44 4F 4D ......L. ...ADDOM
[00E0] 2E 53 41 4D 42 41 2E 45 58 41 4D 50 4C 45 2E 43 .SAMBA.E XAMPLE.C
[00F0] 4F 4D 00 04 48 4F 53 54 00 04 61 64 64 63 00 00 OM..HOST ..addc..
[0100] 00 01 65 D3 C9 9C 01 00 11 00 10 74 D5 31 8D 99 ..e..... ...t.1..
[0110] 0A 4C B7 83 0A FC CD 11 4B 59 CF 00 00 00 01 00 .L...... KY......
[0120] 00 00 00 00 00 00 64 00 02 00 17 41 44 44 4F 4D ......d. ...ADDOM
[0130] 2E 53 41 4D 42 41 2E 45 58 41 4D 50 4C 45 2E 43 .SAMBA.E XAMPLE.C
[0140] 4F 4D 00 04 48 4F 53 54 00 1C 61 64 64 63 2E 61 OM..HOST ..addc.a
[0150] 64 64 6F 6D 2E 73 61 6D 62 61 2E 65 78 61 6D 70 ddom.sam ba.examp
[0160] 6C 65 2E 63 6F 6D 00 00 00 01 65 D3 C9 9C 01 00 le.com.. ..e.....
[0170] 11 00 10 74 D5 31 8D 99 0A 4C B7 83 0A FC CD 11 ...t.1.. .L......
[0180] 4B 59 CF 00 00 00 01 00 00 00 00 00 00 00 47 00 KY...... ......G.
[0190] 01 00 17 41 44 44 4F 4D 2E 53 41 4D 42 41 2E 45 ...ADDOM .SAMBA.E
[01A0] 58 41 4D 50 4C 45 2E 43 4F 4D 00 05 41 44 44 43 XAMPLE.C OM..ADDC
[01B0] 24 00 00 00 01 65 D3 C9 9C 01 00 11 00 10 74 D5 $....e.. ......t.
[01C0] 31 8D 99 0A 4C B7 83 0A FC CD 11 4B 59 CF 00 00 1...L... ...KY...
[01D0] 00 01 00 00 00 00 00 00 00 4C 00 02 00 17 41 44 ........ .L....AD
[01E0] 44 4F 4D 2E 53 41 4D 42 41 2E 45 58 41 4D 50 4C DOM.SAMB A.EXAMPL
[01F0] 45 2E 43 4F 4D 00 04 48 4F 53 54 00 04 61 64 64 E.COM..H OST..add
[0200] 63 00 00 00 01 65 D3 C9 9C 01 00 17 00 10 CD 71 c....e.. .......q
[0210] BA D5 2E 21 23 B3 D0 0F 9E 8D 89 7B AD 81 00 00 ...!#... ...{....
[0220] 00 01 00 00 00 00 00 00 00 64 00 02 00 17 41 44 ........ .d....AD
[0230] 44 4F 4D 2E 53 41 4D 42 41 2E 45 58 41 4D 50 4C DOM.SAMB A.EXAMPL
[0240] 45 2E 43 4F 4D 00 04 48 4F 53 54 00 1C 61 64 64 E.COM..H OST..add
[0250] 63 2E 61 64 64 6F 6D 2E 73 61 6D 62 61 2E 65 78 c.addom. samba.ex
[0260] 61 6D 70 6C 65 2E 63 6F 6D 00 00 00 01 65 D3 C9 ample.co m....e..
[0270] 9C 01 00 17 00 10 CD 71 BA D5 2E 21 23 B3 D0 0F .......q ...!#...
[0280] 9E 8D 89 7B AD 81 00 00 00 01 00 00 00 00 00 00 ...{.... ........
[0290] 00 47 00 01 00 17 41 44 44 4F 4D 2E 53 41 4D 42 .G....AD DOM.SAMB
[02A0] 41 2E 45 58 41 4D 50 4C 45 2E 43 4F 4D 00 05 41 A.EXAMPL E.COM..A
[02B0] 44 44 43 24 00 00 00 01 65 D3 C9 9C 01 00 17 00 DDC$.... e.......
[02C0] 10 CD 71 BA D5 2E 21 23 B3 D0 0F 9E 8D 89 7B AD ..q...!# ......{.
[02D0] 81 00 00 00 01 00 00 00 00 ........ .
dump OK