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 868288126..38164fda8 100644 --- a/auth-krb5.c +++ b/auth-krb5.c | |||
@@ -166,8 +166,13 @@ auth_krb5_password(Authctxt *authctxt, const char *password) | |||
166 | 166 | ||
167 | len = strlen(authctxt->krb5_ticket_file) + 6; | 167 | len = strlen(authctxt->krb5_ticket_file) + 6; |
168 | authctxt->krb5_ccname = xmalloc(len); | 168 | authctxt->krb5_ccname = xmalloc(len); |
169 | #ifdef USE_CCAPI | ||
170 | snprintf(authctxt->krb5_ccname, len, "API:%s", | ||
171 | authctxt->krb5_ticket_file); | ||
172 | #else | ||
169 | snprintf(authctxt->krb5_ccname, len, "FILE:%s", | 173 | snprintf(authctxt->krb5_ccname, len, "FILE:%s", |
170 | authctxt->krb5_ticket_file); | 174 | authctxt->krb5_ticket_file); |
175 | #endif | ||
171 | 176 | ||
172 | #ifdef USE_PAM | 177 | #ifdef USE_PAM |
173 | if (options.use_pam) | 178 | if (options.use_pam) |
@@ -219,15 +224,22 @@ krb5_cleanup_proc(Authctxt *authctxt) | |||
219 | #ifndef HEIMDAL | 224 | #ifndef HEIMDAL |
220 | krb5_error_code | 225 | krb5_error_code |
221 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | 226 | ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { |
222 | int tmpfd, ret; | 227 | int ret; |
223 | char ccname[40]; | 228 | char ccname[40]; |
224 | mode_t old_umask; | 229 | mode_t old_umask; |
230 | #ifdef USE_CCAPI | ||
231 | char cctemplate[] = "API:krb5cc_%d"; | ||
232 | #else | ||
233 | char cctemplate[] = "FILE:/tmp/krb5cc_%d_XXXXXXXXXX"; | ||
234 | int tmpfd; | ||
235 | #endif | ||
225 | 236 | ||
226 | ret = snprintf(ccname, sizeof(ccname), | 237 | ret = snprintf(ccname, sizeof(ccname), |
227 | "FILE:/tmp/krb5cc_%d_XXXXXXXXXX", geteuid()); | 238 | cctemplate, geteuid()); |
228 | if (ret < 0 || (size_t)ret >= sizeof(ccname)) | 239 | if (ret < 0 || (size_t)ret >= sizeof(ccname)) |
229 | return ENOMEM; | 240 | return ENOMEM; |
230 | 241 | ||
242 | #ifndef USE_CCAPI | ||
231 | old_umask = umask(0177); | 243 | old_umask = umask(0177); |
232 | tmpfd = mkstemp(ccname + strlen("FILE:")); | 244 | tmpfd = mkstemp(ccname + strlen("FILE:")); |
233 | umask(old_umask); | 245 | umask(old_umask); |
@@ -242,6 +254,7 @@ ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { | |||
242 | return errno; | 254 | return errno; |
243 | } | 255 | } |
244 | close(tmpfd); | 256 | close(tmpfd); |
257 | #endif | ||
245 | 258 | ||
246 | return (krb5_cc_resolve(ctx, ccname, ccache)); | 259 | return (krb5_cc_resolve(ctx, ccname, ccache)); |
247 | } | 260 | } |