summaryrefslogtreecommitdiff
path: root/auth-krb5.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth-krb5.c')
-rw-r--r--auth-krb5.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/auth-krb5.c b/auth-krb5.c
index d019fe202..821913382 100644
--- a/auth-krb5.c
+++ b/auth-krb5.c
@@ -170,8 +170,13 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
170 170
171 len = strlen(authctxt->krb5_ticket_file) + 6; 171 len = strlen(authctxt->krb5_ticket_file) + 6;
172 authctxt->krb5_ccname = xmalloc(len); 172 authctxt->krb5_ccname = xmalloc(len);
173#ifdef USE_CCAPI
174 snprintf(authctxt->krb5_ccname, len, "API:%s",
175 authctxt->krb5_ticket_file);
176#else
173 snprintf(authctxt->krb5_ccname, len, "FILE:%s", 177 snprintf(authctxt->krb5_ccname, len, "FILE:%s",
174 authctxt->krb5_ticket_file); 178 authctxt->krb5_ticket_file);
179#endif
175 180
176#ifdef USE_PAM 181#ifdef USE_PAM
177 if (options.use_pam) 182 if (options.use_pam)
@@ -226,15 +231,22 @@ krb5_cleanup_proc(Authctxt *authctxt)
226#ifndef HEIMDAL 231#ifndef HEIMDAL
227krb5_error_code 232krb5_error_code
228ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) { 233ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) {
229 int tmpfd, ret; 234 int ret;
230 char ccname[40]; 235 char ccname[40];
231 mode_t old_umask; 236 mode_t old_umask;
237#ifdef USE_CCAPI
238 char cctemplate[] = "API:krb5cc_%d";
239#else
240 char cctemplate[] = "FILE:/tmp/krb5cc_%d_XXXXXXXXXX";
241 int tmpfd;
242#endif
232 243
233 ret = snprintf(ccname, sizeof(ccname), 244 ret = snprintf(ccname, sizeof(ccname),
234 "FILE:/tmp/krb5cc_%d_XXXXXXXXXX", geteuid()); 245 cctemplate, geteuid());
235 if (ret < 0 || (size_t)ret >= sizeof(ccname)) 246 if (ret < 0 || (size_t)ret >= sizeof(ccname))
236 return ENOMEM; 247 return ENOMEM;
237 248
249#ifndef USE_CCAPI
238 old_umask = umask(0177); 250 old_umask = umask(0177);
239 tmpfd = mkstemp(ccname + strlen("FILE:")); 251 tmpfd = mkstemp(ccname + strlen("FILE:"));
240 umask(old_umask); 252 umask(old_umask);
@@ -249,6 +261,7 @@ ssh_krb5_cc_gen(krb5_context ctx, krb5_ccache *ccache) {
249 return errno; 261 return errno;
250 } 262 }
251 close(tmpfd); 263 close(tmpfd);
264#endif
252 265
253 return (krb5_cc_resolve(ctx, ccname, ccache)); 266 return (krb5_cc_resolve(ctx, ccname, ccache));
254} 267}