summaryrefslogtreecommitdiff
path: root/source/torture/auth
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2005-07-04 15:42:08 +0000
committerStefan Metzmacher <metze@samba.org>2005-07-04 15:42:08 +0000
commit416da2cc13324c7091a9c3be7bb91cea4cbd2e43 (patch)
tree39bc606c5837cc18b17c2cb9959eb433c6c6140d /source/torture/auth
parent9a44aa24a19b86d7d88cee0f98c404dd9d616371 (diff)
downloadsamba-416da2cc13324c7091a9c3be7bb91cea4cbd2e43.tar.gz
r8148: - make the PAC generation code a bit more readable and add some outof memory checks
- move to handmodified pull/push code for PAC_BUFFER to get the _ndr_size field and the subcontext size right - after looking closely to the sample w2k3 PAC in our torture test (and some more in my archive) I found out that the first uint32 before the netr_SamInfo3 was also a pointer, (and we passed a NULL pointer there before, so I think that was the reason why the windows clients doesn't want our PAC) w2k3 uses this for unique pointers: ptr = ndr->ptr_count * 4; ptr |= 0x00020000; ndr->ptr_count; - do one more pull/push round with the sample PAC metze
Diffstat (limited to 'source/torture/auth')
-rw-r--r--source/torture/auth/pac.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source/torture/auth/pac.c b/source/torture/auth/pac.c
index 00196b493f5..51f33781fa3 100644
--- a/source/torture/auth/pac.c
+++ b/source/torture/auth/pac.c
@@ -118,7 +118,9 @@ static BOOL torture_pac_self_check(void)
talloc_free(mem_ctx);
return False;
}
-
+
+ /* dump_data(0,tmp_blob.data,tmp_blob.length); */
+
/* Now check that we can read it back */
nt_status = kerberos_decode_pac(mem_ctx, &pac_info,
tmp_blob,
@@ -190,8 +192,9 @@ static BOOL torture_pac_saved_check(void)
{
NTSTATUS nt_status;
TALLOC_CTX *mem_ctx = talloc_named(NULL, 0, "PAC saved check");
- DATA_BLOB tmp_blob;
+ DATA_BLOB tmp_blob, validate_blob;
struct PAC_LOGON_INFO *pac_info;
+ struct PAC_DATA pac_data;
krb5_keyblock server_keyblock;
uint8_t server_bytes[16];
@@ -225,6 +228,10 @@ static BOOL torture_pac_saved_check(void)
tmp_blob = data_blob_const(saved_pac, sizeof(saved_pac));
+ /*tmp_blob.data = file_load(lp_parm_string(-1,"torture","pac_file"), &tmp_blob.length);*/
+
+ /*dump_data(0,tmp_blob.data,tmp_blob.length);*/
+
/* Decode and verify the signaure on the PAC */
nt_status = kerberos_decode_pac(mem_ctx, &pac_info,
tmp_blob,
@@ -239,6 +246,23 @@ static BOOL torture_pac_saved_check(void)
talloc_free(mem_ctx);
return False;
}
+
+ nt_status = ndr_pull_struct_blob(&tmp_blob, mem_ctx, &pac_data,
+ (ndr_pull_flags_fn_t)ndr_pull_PAC_DATA);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(0,("can't parse the PAC\n"));
+ return False;
+ }
+
+ nt_status = ndr_push_struct_blob(&validate_blob, mem_ctx, &pac_data,
+ (ndr_push_flags_fn_t)ndr_push_PAC_DATA);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(0, ("PAC push failed: %s\n", nt_errstr(nt_status)));
+ return False;
+ }
+
+ /* dump_data(0,validate_blob.data,validate_blob.length); */
+
talloc_free(mem_ctx);
return True;
}