summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-01-30 18:03:34 +0000
committerJeremy Allison <jra@samba.org>2003-01-30 18:03:34 +0000
commit32bfb31947af7f0a98ce58b317c79d979a753327 (patch)
treee1713167e93b0c4cab3ec25c1bec6f7c505f93ba /source3
parentf6fbf0c9dbe859603ed7bc5d08844dda195d3b98 (diff)
downloadsamba-32bfb31947af7f0a98ce58b317c79d979a753327.tar.gz
samba-32bfb31947af7f0a98ce58b317c79d979a753327.tar.bz2
samba-32bfb31947af7f0a98ce58b317c79d979a753327.zip
Revert tpot's HEAD merge which broke the Heimdal build.
Jeremy. (This used to be commit 1298ecd0b8a3a9e0a2de42d0c049856cad65e272)
Diffstat (limited to 'source3')
-rw-r--r--source3/libads/kerberos_verify.c60
1 files changed, 15 insertions, 45 deletions
diff --git a/source3/libads/kerberos_verify.c b/source3/libads/kerberos_verify.c
index c1402b1370..268326fca9 100644
--- a/source3/libads/kerberos_verify.c
+++ b/source3/libads/kerberos_verify.c
@@ -36,17 +36,13 @@ NTSTATUS ads_verify_ticket(ADS_STRUCT *ads, const DATA_BLOB *ticket,
krb5_keytab keytab = NULL;
krb5_data packet;
krb5_ticket *tkt = NULL;
- krb5_data salt;
- krb5_encrypt_block eblock;
- int ret, i;
+ int ret;
krb5_keyblock * key;
krb5_principal host_princ;
char *host_princ_s;
fstring myname;
char *password_s;
krb5_data password;
- krb5_enctype *enctypes = NULL;
- BOOL auth_ok = False;
if (!secrets_init()) {
DEBUG(1,("secrets_init failed\n"));
@@ -71,6 +67,7 @@ NTSTATUS ads_verify_ticket(ADS_STRUCT *ads, const DATA_BLOB *ticket,
ret = krb5_set_default_realm(context, ads->auth.realm);
if (ret) {
DEBUG(1,("krb5_set_default_realm failed (%s)\n", error_message(ret)));
+ ads_destroy(&ads);
return NT_STATUS_LOGON_FAILURE;
}
@@ -92,59 +89,32 @@ NTSTATUS ads_verify_ticket(ADS_STRUCT *ads, const DATA_BLOB *ticket,
return NT_STATUS_LOGON_FAILURE;
}
- ret = krb5_principal2salt(context, host_princ, &salt);
- if (ret) {
- DEBUG(1,("krb5_principal2salt failed (%s)\n", error_message(ret)));
- return NT_STATUS_LOGON_FAILURE;
- }
-
if (!(key = (krb5_keyblock *)malloc(sizeof(*key)))) {
return NT_STATUS_NO_MEMORY;
}
- if ((ret = krb5_get_permitted_enctypes(context, &enctypes))) {
- DEBUG(1,("krb5_get_permitted_enctypes failed (%s)\n",
- error_message(ret)));
+ if (create_kerberos_key_from_string(context, host_princ, &password, key)) {
+ SAFE_FREE(key);
return NT_STATUS_LOGON_FAILURE;
}
+
+ krb5_auth_con_setuseruserkey(context, auth_context, key);
- /* we need to setup a auth context with each possible encoding type in turn */
- for (i=0;enctypes[i];i++) {
- krb5_use_enctype(context, &eblock, enctypes[i]);
-
- ret = krb5_string_to_key(context, &eblock, key, &password, &salt);
- if (ret) {
- continue;
- }
-
- krb5_auth_con_setuseruserkey(context, auth_context, key);
-
- packet.length = ticket->length;
- packet.data = (krb5_pointer)ticket->data;
+ packet.length = ticket->length;
+ packet.data = (krb5_pointer)ticket->data;
- if (!(ret = krb5_rd_req(context, &auth_context, &packet,
- NULL, keytab, NULL, &tkt))) {
- krb5_free_ktypes(context, enctypes);
- auth_ok = True;
- break;
- }
- }
+#if 0
+ file_save("/tmp/ticket.dat", ticket->data, ticket->length);
+#endif
- if (!auth_ok) {
+ if ((ret = krb5_rd_req(context, &auth_context, &packet,
+ NULL, keytab, NULL, &tkt))) {
DEBUG(3,("krb5_rd_req with auth failed (%s)\n",
error_message(ret)));
return NT_STATUS_LOGON_FAILURE;
}
-#if 0
- file_save("/tmp/ticket.dat", ticket->data, ticket->length);
-#endif
-
-
- if (tkt->enc_part2) {
- *auth_data = data_blob(tkt->enc_part2->authorization_data[0]->contents,
- tkt->enc_part2->authorization_data[0]->length);
- }
+ get_auth_data_from_tkt(auth_data, tkt);
#if 0
if (tkt->enc_part2) {
@@ -154,7 +124,7 @@ NTSTATUS ads_verify_ticket(ADS_STRUCT *ads, const DATA_BLOB *ticket,
}
#endif
- if ((ret = krb5_unparse_name(context, tkt->enc_part2->client, principal))) {
+ if ((ret = krb5_unparse_name(context, get_principal_from_tkt(tkt), principal))) {
DEBUG(3,("krb5_unparse_name failed (%s)\n",
error_message(ret)));
return NT_STATUS_LOGON_FAILURE;