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