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