diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-10-20 10:21:04 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:45:04 -0500 |
commit | d820c353dc45970d4648d9ff0b909366f8f00812 (patch) | |
tree | 9682e122eb08113fb82dadb3a84f0eace2ceb8d5 /source4/auth | |
parent | 8103ef397409dc4b780ea9bcd98da090a3b01d1e (diff) | |
download | samba-d820c353dc45970d4648d9ff0b909366f8f00812.tar.gz samba-d820c353dc45970d4648d9ff0b909366f8f00812.tar.bz2 samba-d820c353dc45970d4648d9ff0b909366f8f00812.zip |
r11218: Always return the mutual authentication reply (needed for kpasswd),
and remove now duplicated unwrap_pac().
Andrew Bartlett
(This used to be commit 90642d54e02e09edc96b9498e66befda20dbb68d)
Diffstat (limited to 'source4/auth')
-rw-r--r-- | source4/auth/kerberos/kerberos_verify.c | 57 |
1 files changed, 12 insertions, 45 deletions
diff --git a/source4/auth/kerberos/kerberos_verify.c b/source4/auth/kerberos/kerberos_verify.c index 13d2c9fc26..020b63478e 100644 --- a/source4/auth/kerberos/kerberos_verify.c +++ b/source4/auth/kerberos/kerberos_verify.c @@ -33,36 +33,6 @@ #ifdef HAVE_KRB5 -DATA_BLOB unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data) -{ - DATA_BLOB out; - DATA_BLOB pac_contents = data_blob(NULL, 0); - struct asn1_data data; - int data_type; - if (!auth_data->length) { - return data_blob(NULL, 0); - } - - asn1_load(&data, *auth_data); - asn1_start_tag(&data, ASN1_SEQUENCE(0)); - asn1_start_tag(&data, ASN1_SEQUENCE(0)); - asn1_start_tag(&data, ASN1_CONTEXT(0)); - asn1_read_Integer(&data, &data_type); - asn1_end_tag(&data); - asn1_start_tag(&data, ASN1_CONTEXT(1)); - asn1_read_OctetString(&data, &pac_contents); - asn1_end_tag(&data); - asn1_end_tag(&data); - asn1_end_tag(&data); - asn1_free(&data); - - out = data_blob_talloc(mem_ctx, pac_contents.data, pac_contents.length); - - data_blob_free(&pac_contents); - - return out; -} - /********************************************************************************** Verify an incoming ticket and parse out the principal name and authorization_data if available. @@ -83,6 +53,7 @@ DATA_BLOB unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data) int ret; krb5_flags ap_req_options = 0; krb5_principal server; + krb5_data packet_out; struct keytab_container *keytab_container; @@ -119,23 +90,19 @@ DATA_BLOB unwrap_pac(TALLOC_CTX *mem_ctx, DATA_BLOB *auth_data) return NT_STATUS_LOGON_FAILURE; } *keyblock = local_keyblock; - - if (ap_req_options & AP_OPTS_MUTUAL_REQUIRED) { - krb5_data packet_out; - ret = krb5_mk_rep(smb_krb5_context->krb5_context, *auth_context, &packet_out); - if (ret) { - krb5_free_ticket(smb_krb5_context->krb5_context, *tkt); - - DEBUG(3,("ads_verify_ticket: Failed to generate mutual authentication reply (%s)\n", - smb_get_krb5_error_message(smb_krb5_context->krb5_context, ret, mem_ctx))); - return NT_STATUS_LOGON_FAILURE; - } + + + ret = krb5_mk_rep(smb_krb5_context->krb5_context, *auth_context, &packet_out); + if (ret) { + krb5_free_ticket(smb_krb5_context->krb5_context, *tkt); - *ap_rep = data_blob_talloc(mem_ctx, packet_out.data, packet_out.length); - krb5_free_data_contents(smb_krb5_context->krb5_context, &packet_out); - } else { - *ap_rep = data_blob(NULL, 0); + DEBUG(3,("ads_verify_ticket: Failed to generate mutual authentication reply (%s)\n", + smb_get_krb5_error_message(smb_krb5_context->krb5_context, ret, mem_ctx))); + return NT_STATUS_LOGON_FAILURE; } + + *ap_rep = data_blob_talloc(mem_ctx, packet_out.data, packet_out.length); + krb5_free_data_contents(smb_krb5_context->krb5_context, &packet_out); return NT_STATUS_OK; } |