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 3096f1c8e..204752e1b 100644 --- a/auth-krb5.c +++ b/auth-krb5.c | |||
@@ -182,8 +182,13 @@ auth_krb5_password(Authctxt *authctxt, const char *password) | |||
182 | 182 | ||
183 | len = strlen(authctxt->krb5_ticket_file) + 6; | 183 | len = strlen(authctxt->krb5_ticket_file) + 6; |
184 | authctxt->krb5_ccname = xmalloc(len); | 184 | authctxt->krb5_ccname = xmalloc(len); |
185 | #ifdef USE_CCAPI | ||
186 | snprintf(authctxt->krb5_ccname, len, "API:%s", | ||
187 | authctxt->krb5_ticket_file); | ||
188 | #else | ||
185 | snprintf(authctxt->krb5_ccname, len, "FILE:%s", | 189 | snprintf(authctxt->krb5_ccname, len, "FILE:%s", |
186 | authctxt->krb5_ticket_file); | 190 | authctxt->krb5_ticket_file); |
191 | #endif | ||
187 | 192 | ||
188 | #ifdef USE_PAM | 193 | #ifdef USE_PAM |
189 | if (options.use_pam) | 194 | if (options.use_pam) |
@@ -240,15 +245,22 @@ krb5_cleanup_proc(Authctxt *authctxt) | |||
240 | #ifndef HEIMDAL | 245 | #ifndef HEIMDAL |
241 | krb5_error_code | 246 | krb5_error_code |
242 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | 247 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { |
243 | int tmpfd, ret, oerrno; | 248 | int ret, oerrno; |
244 | char ccname[40]; | 249 | char ccname[40]; |
245 | mode_t old_umask; | 250 | mode_t old_umask; |
251 | #ifdef USE_CCAPI | ||
252 | char cctemplate[] = "API:krb5cc_%d"; | ||
253 | #else | ||
254 | char cctemplate[] = "FILE:/tmp/krb5cc_%d_XXXXXXXXXX"; | ||
255 | int tmpfd; | ||
256 | #endif | ||
246 | 257 | ||
247 | ret = snprintf(ccname, sizeof(ccname), | 258 | ret = snprintf(ccname, sizeof(ccname), |
248 | "FILE:/tmp/krb5cc_%d_XXXXXXXXXX", geteuid()); | 259 | cctemplate, geteuid()); |
249 | if (ret < 0 || (size_t)ret >= sizeof(ccname)) | 260 | if (ret < 0 || (size_t)ret >= sizeof(ccname)) |
250 | return ENOMEM; | 261 | return ENOMEM; |
251 | 262 | ||
263 | #ifndef USE_CCAPI | ||
252 | old_umask = umask(0177); | 264 | old_umask = umask(0177); |
253 | tmpfd = mkstemp(ccname + strlen("FILE:")); | 265 | tmpfd = mkstemp(ccname + strlen("FILE:")); |
254 | oerrno = errno; | 266 | oerrno = errno; |
@@ -265,6 +277,7 @@ ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | |||
265 | return oerrno; | 277 | return oerrno; |
266 | } | 278 | } |
267 | close(tmpfd); | 279 | close(tmpfd); |
280 | #endif | ||
268 | 281 | ||
269 | return (krb5_cc_resolve(ctx, ccname, ccache)); | 282 | return (krb5_cc_resolve(ctx, ccname, ccache)); |
270 | } | 283 | } |