summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-07-20 13:35:45 +1000
committerDamien Miller <djm@mindrot.org>2013-07-20 13:35:45 +1000
commit63ddc899d28cf60045b560891894b9fbf6f822e9 (patch)
treec6d54f7405a993cc6774d5abe0c0398192ddf008
parent1f0e86f23fcebb026371c0888402a981df2a61c4 (diff)
- djm@cvs.openbsd.org 2013/07/20 01:55:13
[auth-krb5.c gss-serv-krb5.c gss-serv.c] fix kerberos/GSSAPI deprecation warnings and linking; "looks okay" millert@
-rw-r--r--ChangeLog3
-rw-r--r--auth-krb5.c21
-rw-r--r--gss-serv-krb5.c44
-rw-r--r--gss-serv.c4
4 files changed, 43 insertions, 29 deletions
diff --git a/ChangeLog b/ChangeLog
index dc6ea90ef..dc2f73bd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,9 @@
16 [ssh-agent.c] 16 [ssh-agent.c]
17 call cleanup_handler on SIGINT when in debug mode to ensure sockets 17 call cleanup_handler on SIGINT when in debug mode to ensure sockets
18 are cleaned up on manual exit; bz#2120 18 are cleaned up on manual exit; bz#2120
19 - djm@cvs.openbsd.org 2013/07/20 01:55:13
20 [auth-krb5.c gss-serv-krb5.c gss-serv.c]
21 fix kerberos/GSSAPI deprecation warnings and linking; "looks okay" millert@
19 22
2020130718 2320130718
21 - (djm) OpenBSD CVS Sync 24 - (djm) OpenBSD CVS Sync
diff --git a/auth-krb5.c b/auth-krb5.c
index ff1462ad1..43ee9272f 100644
--- a/auth-krb5.c
+++ b/auth-krb5.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: auth-krb5.c,v 1.19 2006/08/03 03:34:41 deraadt Exp $ */ 1/* $OpenBSD: auth-krb5.c,v 1.20 2013/07/20 01:55:13 djm Exp $ */
2/* 2/*
3 * Kerberos v5 authentication and ticket-passing routines. 3 * Kerberos v5 authentication and ticket-passing routines.
4 * 4 *
@@ -79,6 +79,7 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
79 krb5_ccache ccache = NULL; 79 krb5_ccache ccache = NULL;
80 int len; 80 int len;
81 char *client, *platform_client; 81 char *client, *platform_client;
82 const char *errmsg;
82 83
83 /* get platform-specific kerberos client principal name (if it exists) */ 84 /* get platform-specific kerberos client principal name (if it exists) */
84 platform_client = platform_krb5_get_principal_name(authctxt->pw->pw_name); 85 platform_client = platform_krb5_get_principal_name(authctxt->pw->pw_name);
@@ -96,7 +97,8 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
96 goto out; 97 goto out;
97 98
98#ifdef HEIMDAL 99#ifdef HEIMDAL
99 problem = krb5_cc_gen_new(authctxt->krb5_ctx, &krb5_mcc_ops, &ccache); 100 problem = krb5_cc_new_unique(authctxt->krb5_ctx,
101 krb5_mcc_ops.prefix, NULL, &ccache);
100 if (problem) 102 if (problem)
101 goto out; 103 goto out;
102 104
@@ -115,8 +117,8 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
115 if (problem) 117 if (problem)
116 goto out; 118 goto out;
117 119
118 problem = krb5_cc_gen_new(authctxt->krb5_ctx, &krb5_fcc_ops, 120 problem = krb5_cc_new_unique(authctxt->krb5_ctx,
119 &authctxt->krb5_fwd_ccache); 121 krb5_fcc_ops.prefix, NULL, &authctxt->krb5_fwd_ccache);
120 if (problem) 122 if (problem)
121 goto out; 123 goto out;
122 124
@@ -187,10 +189,13 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
187 if (ccache) 189 if (ccache)
188 krb5_cc_destroy(authctxt->krb5_ctx, ccache); 190 krb5_cc_destroy(authctxt->krb5_ctx, ccache);
189 191
190 if (authctxt->krb5_ctx != NULL && problem!=-1) 192 if (authctxt->krb5_ctx != NULL && problem!=-1) {
191 debug("Kerberos password authentication failed: %s", 193 errmsg = krb5_get_error_message(authctxt->krb5_ctx,
192 krb5_get_err_text(authctxt->krb5_ctx, problem)); 194 problem);
193 else 195 debug("Kerberos password authentication failed: %s",
196 errmsg);
197 krb5_free_error_message(authctxt->krb5_ctx, errmsg);
198 } else
194 debug("Kerberos password authentication failed: %d", 199 debug("Kerberos password authentication failed: %d",
195 problem); 200 problem);
196 201
diff --git a/gss-serv-krb5.c b/gss-serv-krb5.c
index 5a625acb8..87f26831a 100644
--- a/gss-serv-krb5.c
+++ b/gss-serv-krb5.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gss-serv-krb5.c,v 1.7 2006/08/03 03:34:42 deraadt Exp $ */ 1/* $OpenBSD: gss-serv-krb5.c,v 1.8 2013/07/20 01:55:13 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -48,12 +48,11 @@ extern ServerOptions options;
48 48
49#ifdef HEIMDAL 49#ifdef HEIMDAL
50# include <krb5.h> 50# include <krb5.h>
51#else 51#endif
52# ifdef HAVE_GSSAPI_KRB5_H 52#ifdef HAVE_GSSAPI_KRB5_H
53# include <gssapi_krb5.h> 53# include <gssapi_krb5.h>
54# elif HAVE_GSSAPI_GSSAPI_KRB5_H 54#elif HAVE_GSSAPI_GSSAPI_KRB5_H
55# include <gssapi/gssapi_krb5.h> 55# include <gssapi/gssapi_krb5.h>
56# endif
57#endif 56#endif
58 57
59static krb5_context krb_context = NULL; 58static krb5_context krb_context = NULL;
@@ -87,14 +86,16 @@ ssh_gssapi_krb5_userok(ssh_gssapi_client *client, char *name)
87{ 86{
88 krb5_principal princ; 87 krb5_principal princ;
89 int retval; 88 int retval;
89 const char *errmsg;
90 90
91 if (ssh_gssapi_krb5_init() == 0) 91 if (ssh_gssapi_krb5_init() == 0)
92 return 0; 92 return 0;
93 93
94 if ((retval = krb5_parse_name(krb_context, client->exportedname.value, 94 if ((retval = krb5_parse_name(krb_context, client->exportedname.value,
95 &princ))) { 95 &princ))) {
96 logit("krb5_parse_name(): %.100s", 96 errmsg = krb5_get_error_message(krb_context, retval);
97 krb5_get_err_text(krb_context, retval)); 97 logit("krb5_parse_name(): %.100s", errmsg);
98 krb5_free_error_message(krb_context, errmsg);
98 return 0; 99 return 0;
99 } 100 }
100 if (krb5_kuserok(krb_context, princ, name)) { 101 if (krb5_kuserok(krb_context, princ, name)) {
@@ -120,6 +121,7 @@ ssh_gssapi_krb5_storecreds(ssh_gssapi_client *client)
120 krb5_principal princ; 121 krb5_principal princ;
121 OM_uint32 maj_status, min_status; 122 OM_uint32 maj_status, min_status;
122 int len; 123 int len;
124 const char *errmsg;
123 125
124 if (client->creds == NULL) { 126 if (client->creds == NULL) {
125 debug("No credentials stored"); 127 debug("No credentials stored");
@@ -130,30 +132,34 @@ ssh_gssapi_krb5_storecreds(ssh_gssapi_client *client)
130 return; 132 return;
131 133
132#ifdef HEIMDAL 134#ifdef HEIMDAL
133 if ((problem = krb5_cc_gen_new(krb_context, &krb5_fcc_ops, &ccache))) { 135 if ((problem = krb5_cc_new_unique(krb_context, krb5_fcc_ops.prefix,
134 logit("krb5_cc_gen_new(): %.100s", 136 NULL, &ccache)) != 0) {
135 krb5_get_err_text(krb_context, problem)); 137 errmsg = krb5_get_error_message(krb_context, problem);
138 logit("krb5_cc_new_unique(): %.100s", errmsg);
139 krb5_free_error_message(krb_context, errmsg);
136 return; 140 return;
137 } 141 }
138#else 142#else
139 if ((problem = ssh_krb5_cc_gen(krb_context, &ccache))) { 143 if ((problem = ssh_krb5_cc_gen(krb_context, &ccache))) {
140 logit("ssh_krb5_cc_gen(): %.100s", 144 errmsg = krb5_get_error_message(krb_context, problem);
141 krb5_get_err_text(krb_context, problem)); 145 logit("ssh_krb5_cc_gen(): %.100s", errmsg);
146 krb5_free_error_message(krb_context, errmsg);
142 return; 147 return;
143 } 148 }
144#endif /* #ifdef HEIMDAL */ 149#endif /* #ifdef HEIMDAL */
145 150
146 if ((problem = krb5_parse_name(krb_context, 151 if ((problem = krb5_parse_name(krb_context,
147 client->exportedname.value, &princ))) { 152 client->exportedname.value, &princ))) {
148 logit("krb5_parse_name(): %.100s", 153 errmsg = krb5_get_error_message(krb_context, problem);
149 krb5_get_err_text(krb_context, problem)); 154 logit("krb5_parse_name(): %.100s", errmsg);
150 krb5_cc_destroy(krb_context, ccache); 155 krb5_free_error_message(krb_context, errmsg);
151 return; 156 return;
152 } 157 }
153 158
154 if ((problem = krb5_cc_initialize(krb_context, ccache, princ))) { 159 if ((problem = krb5_cc_initialize(krb_context, ccache, princ))) {
155 logit("krb5_cc_initialize(): %.100s", 160 errmsg = krb5_get_error_message(krb_context, problem);
156 krb5_get_err_text(krb_context, problem)); 161 logit("krb5_cc_initialize(): %.100s", errmsg);
162 krb5_free_error_message(krb_context, errmsg);
157 krb5_free_principal(krb_context, princ); 163 krb5_free_principal(krb_context, princ);
158 krb5_cc_destroy(krb_context, ccache); 164 krb5_cc_destroy(krb_context, ccache);
159 return; 165 return;
diff --git a/gss-serv.c b/gss-serv.c
index c719c1306..95348e251 100644
--- a/gss-serv.c
+++ b/gss-serv.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: gss-serv.c,v 1.23 2011/08/01 19:18:15 markus Exp $ */ 1/* $OpenBSD: gss-serv.c,v 1.24 2013/07/20 01:55:13 djm Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. 4 * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved.
@@ -50,7 +50,7 @@
50 50
51static ssh_gssapi_client gssapi_client = 51static ssh_gssapi_client gssapi_client =
52 { GSS_C_EMPTY_BUFFER, GSS_C_EMPTY_BUFFER, 52 { GSS_C_EMPTY_BUFFER, GSS_C_EMPTY_BUFFER,
53 GSS_C_NO_CREDENTIAL, NULL, {NULL, NULL, NULL}}; 53 GSS_C_NO_CREDENTIAL, NULL, {NULL, NULL, NULL, NULL}};
54 54
55ssh_gssapi_mech gssapi_null_mech = 55ssh_gssapi_mech gssapi_null_mech =
56 { NULL, NULL, {0, NULL}, NULL, NULL, NULL, NULL}; 56 { NULL, NULL, {0, NULL}, NULL, NULL, NULL, NULL};