diff options
author | assar <assar@FreeBSD.org> | 2001-03-13 04:42:38 +0000 |
---|---|---|
committer | assar <assar@FreeBSD.org> | 2001-03-13 04:42:38 +0000 |
commit | 95047bd0c5543dcbd3f9b9d3834ac449043c8e82 (patch) | |
tree | a5df67a1dfa0a4bfc3a4c0293c3062bb6ff47f1a /crypto/openssh/sshconnect.c | |
parent | 09aba933aa00bdc9102922fe48f75c012cedd8b1 (diff) | |
download | FreeBSD-src-95047bd0c5543dcbd3f9b9d3834ac449043c8e82.zip FreeBSD-src-95047bd0c5543dcbd3f9b9d3834ac449043c8e82.tar.gz |
(try_krb5_authentication): simplify code. from joda@netbsd.org
Diffstat (limited to 'crypto/openssh/sshconnect.c')
-rw-r--r-- | crypto/openssh/sshconnect.c | 51 |
1 files changed, 4 insertions, 47 deletions
diff --git a/crypto/openssh/sshconnect.c b/crypto/openssh/sshconnect.c index b2906cc..57d4a43 100644 --- a/crypto/openssh/sshconnect.c +++ b/crypto/openssh/sshconnect.c @@ -666,8 +666,6 @@ try_krb5_authentication(krb5_context *context, krb5_auth_context *auth_context) const char *tkfile; struct stat buf; krb5_ccache ccache = NULL; - krb5_creds req_creds; - krb5_creds *new_creds = NULL; const char *remotehost; krb5_data ap; int type, payload_len; @@ -698,45 +696,10 @@ try_krb5_authentication(krb5_context *context, krb5_auth_context *auth_context) goto out; } - memset(&req_creds, 0, sizeof(req_creds)); - remotehost = get_canonical_hostname(); - problem = krb5_sname_to_principal(*context, remotehost, - "host", KRB5_NT_SRV_HST, - &req_creds.server); - if (problem) { - ret = 0; - goto out; - - } - - problem = krb5_cc_get_principal(*context, ccache, &req_creds.client); - if (problem) { - ret = 0; - goto out; - } - - /* creds.session.keytype=ETYPE_DES_CBC_CRC; */ - - problem = krb5_get_credentials(*context, 0, ccache, &req_creds, &new_creds); - if (problem) { - ret = 0; - goto out; - } - - problem = krb5_auth_con_init(*context, auth_context); - if (problem) { - ret = 0; - goto out; - } - - /* krb5_auth_con_setflags(ssh_context, auth_context, - KRB5_AUTH_CONTEXT_RET_TIME); - */ - problem = krb5_mk_req_extended(*context, auth_context, - AP_OPTS_MUTUAL_REQUIRED /*| AP_OPTS_USE_SUBKEY*/ , - NULL, new_creds, &ap); + problem = krb5_mk_req(*context, auth_context, AP_OPTS_MUTUAL_REQUIRED, + "host", remotehost, NULL, ccache, &ap); if (problem) { ret = 0; goto out; @@ -783,14 +746,8 @@ try_krb5_authentication(krb5_context *context, krb5_auth_context *auth_context) } out: - if (req_creds.server != NULL) - krb5_free_principal(*context, req_creds.server); - if (req_creds.client != NULL) - krb5_free_principal(*context, req_creds.client); - if (new_creds != NULL) - krb5_free_creds(*context, new_creds); - if (ccache != NULL) - krb5_cc_close(*context, ccache); + if (ccache != NULL) + krb5_cc_close(*context, ccache); if (reply != NULL) krb5_free_ap_rep_enc_part(*context, reply); if (ap.length > 0) |