summaryrefslogtreecommitdiff
path: root/source4/auth/kerberos
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-06-30 01:04:51 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:18:57 -0500
commitddffc922dfdc2572dc622d5fdb89095d356a83e9 (patch)
tree6bc48bfb6a905a6654ea05ae029daeb92a865403 /source4/auth/kerberos
parent0a8d694e806a770395f5a165d56b9b8ea9ce94b8 (diff)
downloadsamba-ddffc922dfdc2572dc622d5fdb89095d356a83e9.tar.gz
samba-ddffc922dfdc2572dc622d5fdb89095d356a83e9.tar.bz2
samba-ddffc922dfdc2572dc622d5fdb89095d356a83e9.zip
r8001: Also fill in the krbtgt checksum, and make sure to put the right
checksum in the right place... Andrew Bartlett (This used to be commit 90d0f502da20add6784c883b2085cde519604933)
Diffstat (limited to 'source4/auth/kerberos')
-rw-r--r--source4/auth/kerberos/kerberos.h4
-rw-r--r--source4/auth/kerberos/kerberos_pac.c26
2 files changed, 25 insertions, 5 deletions
diff --git a/source4/auth/kerberos/kerberos.h b/source4/auth/kerberos/kerberos.h
index 1fd48197f8..2fc000fd0d 100644
--- a/source4/auth/kerberos/kerberos.h
+++ b/source4/auth/kerberos/kerberos.h
@@ -132,10 +132,12 @@ NTSTATUS kerberos_decode_pac(TALLOC_CTX *mem_ctx,
DATA_BLOB blob,
struct smb_krb5_context *smb_krb5_context,
krb5_keyblock *keyblock);
+
krb5_error_code kerberos_encode_pac(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info *server_info,
krb5_context context,
- krb5_keyblock *keyblock,
+ krb5_keyblock *krbtgt_keyblock,
+ krb5_keyblock *server_keyblock,
krb5_data *pac);
#endif /* HAVE_KRB5 */
diff --git a/source4/auth/kerberos/kerberos_pac.c b/source4/auth/kerberos/kerberos_pac.c
index e1d05b9949..fb8755c0b8 100644
--- a/source4/auth/kerberos/kerberos_pac.c
+++ b/source4/auth/kerberos/kerberos_pac.c
@@ -222,11 +222,13 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx,
krb5_error_code kerberos_encode_pac(TALLOC_CTX *mem_ctx,
struct auth_serversupplied_info *server_info,
krb5_context context,
- krb5_keyblock *keyblock,
+ krb5_keyblock *krbtgt_keyblock,
+ krb5_keyblock *server_keyblock,
krb5_data *pac)
{
NTSTATUS nt_status;
DATA_BLOB tmp_blob = data_blob(NULL, 0);
+ DATA_BLOB server_checksum_blob;
krb5_error_code ret;
struct PAC_DATA *pac_data = talloc(mem_ctx, struct PAC_DATA);
struct netr_SamBaseInfo *sam;
@@ -279,7 +281,10 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx,
/* First, just get the keytypes filled in (and lengths right, eventually) */
ret = make_pac_checksum(mem_ctx, tmp_blob, &pac_data->buffers[2].info->srv_cksum,
- context, keyblock);
+ context, krbtgt_keyblock);
+
+ ret = make_pac_checksum(mem_ctx, tmp_blob, &pac_data->buffers[3].info->srv_cksum,
+ context, server_keyblock);
if (ret) {
DEBUG(2, ("making PAC checksum failed: %s\n",
smb_get_krb5_error_message(context, ret, mem_ctx)));
@@ -303,9 +308,22 @@ static krb5_error_code make_pac_checksum(TALLOC_CTX *mem_ctx,
/* Then sign the result of the previous push, where the sig was zero'ed out */
ret = make_pac_checksum(mem_ctx, tmp_blob, &pac_data->buffers[3].info->srv_cksum,
- context, keyblock);
+ context, server_keyblock);
+
+ /* Push the Server checksum out */
+ nt_status = ndr_push_struct_blob(&server_checksum_blob, mem_ctx, &pac_data->buffers[3].info->srv_cksum,
+ (ndr_push_flags_fn_t)ndr_push_PAC_SIGNATURE_DATA);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ DEBUG(1, ("PAC push failed: %s\n", nt_errstr(nt_status)));
+ talloc_free(pac_data);
+ return EINVAL;
+ }
+
+ /* Then sign the result of the previous push, where the sig was zero'ed out */
+ ret = make_pac_checksum(mem_ctx, server_checksum_blob, &pac_data->buffers[2].info->kdc_cksum,
+ context, krbtgt_keyblock);
- /* And push it out to the world. This relies on determanistic pointer values */
+ /* And push it out again, this time to the world. This relies on determanistic pointer values */
nt_status = ndr_push_struct_blob(&tmp_blob, mem_ctx, pac_data,
(ndr_push_flags_fn_t)ndr_push_PAC_DATA);
if (!NT_STATUS_IS_OK(nt_status)) {