diff options
Diffstat (limited to 'auth-krb5.c')
-rw-r--r-- | auth-krb5.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/auth-krb5.c b/auth-krb5.c index 64d613543..bc37675a2 100644 --- a/auth-krb5.c +++ b/auth-krb5.c | |||
@@ -156,8 +156,13 @@ auth_krb5_password(Authctxt *authctxt, const char *password) | |||
156 | 156 | ||
157 | len = strlen(authctxt->krb5_ticket_file) + 6; | 157 | len = strlen(authctxt->krb5_ticket_file) + 6; |
158 | authctxt->krb5_ccname = xmalloc(len); | 158 | authctxt->krb5_ccname = xmalloc(len); |
159 | #ifdef USE_CCAPI | ||
160 | snprintf(authctxt->krb5_ccname, len, "API:%s", | ||
161 | authctxt->krb5_ticket_file); | ||
162 | #else | ||
159 | snprintf(authctxt->krb5_ccname, len, "FILE:%s", | 163 | snprintf(authctxt->krb5_ccname, len, "FILE:%s", |
160 | authctxt->krb5_ticket_file); | 164 | authctxt->krb5_ticket_file); |
165 | #endif | ||
161 | 166 | ||
162 | #ifdef USE_PAM | 167 | #ifdef USE_PAM |
163 | if (options.use_pam) | 168 | if (options.use_pam) |
@@ -209,15 +214,22 @@ krb5_cleanup_proc(Authctxt *authctxt) | |||
209 | #ifndef HEIMDAL | 214 | #ifndef HEIMDAL |
210 | krb5_error_code | 215 | krb5_error_code |
211 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | 216 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { |
212 | int tmpfd, ret; | 217 | int ret; |
213 | char ccname[40]; | 218 | char ccname[40]; |
214 | mode_t old_umask; | 219 | mode_t old_umask; |
220 | #ifdef USE_CCAPI | ||
221 | char cctemplate[] = "API:krb5cc_%d"; | ||
222 | #else | ||
223 | char cctemplate[] = "FILE:/tmp/krb5cc_%d_XXXXXXXXXX"; | ||
224 | int tmpfd; | ||
225 | #endif | ||
215 | 226 | ||
216 | ret = snprintf(ccname, sizeof(ccname), | 227 | ret = snprintf(ccname, sizeof(ccname), |
217 | "FILE:/tmp/krb5cc_%d_XXXXXXXXXX", geteuid()); | 228 | cctemplate, geteuid()); |
218 | if (ret < 0 || (size_t)ret >= sizeof(ccname)) | 229 | if (ret < 0 || (size_t)ret >= sizeof(ccname)) |
219 | return ENOMEM; | 230 | return ENOMEM; |
220 | 231 | ||
232 | #ifndef USE_CCAPI | ||
221 | old_umask = umask(0177); | 233 | old_umask = umask(0177); |
222 | tmpfd = mkstemp(ccname + strlen("FILE:")); | 234 | tmpfd = mkstemp(ccname + strlen("FILE:")); |
223 | umask(old_umask); | 235 | umask(old_umask); |
@@ -232,6 +244,7 @@ ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | |||
232 | return errno; | 244 | return errno; |
233 | } | 245 | } |
234 | close(tmpfd); | 246 | close(tmpfd); |
247 | #endif | ||
235 | 248 | ||
236 | return (krb5_cc_resolve(ctx, ccname, ccache)); | 249 | return (krb5_cc_resolve(ctx, ccname, ccache)); |
237 | } | 250 | } |