summaryrefslogtreecommitdiff
path: root/gss-serv-krb5.c
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 /gss-serv-krb5.c
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@
Diffstat (limited to 'gss-serv-krb5.c')
-rw-r--r--gss-serv-krb5.c44
1 files changed, 25 insertions, 19 deletions
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;