summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-05-14 19:23:56 +1000
committerDamien Miller <djm@mindrot.org>2003-05-14 19:23:56 +1000
commit4d995195354696ae0ab6dea7dfa3367fc144ce89 (patch)
tree40f9d059cad3709c748f2923b62c2f08f1574fe9
parent9d507dac1f78d87f2808ab247a44cd3860146375 (diff)
- (djm) Avoid KrbV leak for MIT Kerberos
-rw-r--r--ChangeLog3
-rw-r--r--sshconnect2.c20
2 files changed, 13 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index a4e47e09a..67bf74e78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -72,6 +72,7 @@
72 over usage of PAM. This allows non-root use of sshd when built with 72 over usage of PAM. This allows non-root use of sshd when built with
73 --with-pam 73 --with-pam
74 - (djm) Die screaming if start_pam() is called when UsePAM=no 74 - (djm) Die screaming if start_pam() is called when UsePAM=no
75 - (djm) Avoid KrbV leak for MIT Kerberos
75 76
7620030512 7720030512
77 - (djm) Redhat spec: Don't install profile.d scripts when not 78 - (djm) Redhat spec: Don't install profile.d scripts when not
@@ -1459,4 +1460,4 @@
1459 save auth method before monitor_reset_key_state(); bugzilla bug #284; 1460 save auth method before monitor_reset_key_state(); bugzilla bug #284;
1460 ok provos@ 1461 ok provos@
1461 1462
1462$Id: ChangeLog,v 1.2695 2003/05/14 05:31:12 djm Exp $ 1463$Id: ChangeLog,v 1.2696 2003/05/14 09:23:56 djm Exp $
diff --git a/sshconnect2.c b/sshconnect2.c
index f91f5b274..36d592b42 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -1130,12 +1130,10 @@ userauth_hostbased(Authctxt *authctxt)
1130 1130
1131#if KRB5 1131#if KRB5
1132static int 1132static int
1133ssh_krb5_helper(krb5_data *ap) 1133ssh_krb5_helper(krb5_data *ap, krb5_context *context)
1134{ 1134{
1135 krb5_context xcontext = NULL; /* XXX share with ssh1 */ 1135 krb5_context xcontext = NULL; /* XXX share with ssh1 */
1136 krb5_auth_context xauth_context = NULL; 1136 krb5_auth_context xauth_context = NULL;
1137
1138 krb5_context *context;
1139 krb5_auth_context *auth_context; 1137 krb5_auth_context *auth_context;
1140 krb5_error_code problem; 1138 krb5_error_code problem;
1141 const char *tkfile; 1139 const char *tkfile;
@@ -1191,8 +1189,6 @@ ssh_krb5_helper(krb5_data *ap)
1191 krb5_cc_close(*context, ccache); 1189 krb5_cc_close(*context, ccache);
1192 if (*auth_context) 1190 if (*auth_context)
1193 krb5_auth_con_free(*context, *auth_context); 1191 krb5_auth_con_free(*context, *auth_context);
1194 if (*context)
1195 krb5_free_context(*context);
1196 return (ret); 1192 return (ret);
1197} 1193}
1198 1194
@@ -1200,9 +1196,11 @@ int
1200userauth_kerberos(Authctxt *authctxt) 1196userauth_kerberos(Authctxt *authctxt)
1201{ 1197{
1202 krb5_data ap; 1198 krb5_data ap;
1199 krb5_context *context;
1200 int ret = 0;
1203 1201
1204 if (ssh_krb5_helper(&ap) == 0) 1202 if (ssh_krb5_helper(&ap, context) == 0)
1205 return (0); 1203 goto out;
1206 1204
1207 packet_start(SSH2_MSG_USERAUTH_REQUEST); 1205 packet_start(SSH2_MSG_USERAUTH_REQUEST);
1208 packet_put_cstring(authctxt->server_user); 1206 packet_put_cstring(authctxt->server_user);
@@ -1214,10 +1212,14 @@ userauth_kerberos(Authctxt *authctxt)
1214#ifdef HEIMDAL 1212#ifdef HEIMDAL
1215 krb5_data_free(&ap); 1213 krb5_data_free(&ap);
1216#else 1214#else
1217# warning "XXX - leaks ap data on MIT kerberos" 1215 krb5_free_data_contents(*context, &ap);
1218#endif 1216#endif
1217 ret = 1;
1219 1218
1220 return (1); 1219out:
1220 if (*context)
1221 krb5_free_context(*context);
1222 return ret;
1221} 1223}
1222#endif 1224#endif
1223 1225