summaryrefslogtreecommitdiff
path: root/gss-serv-krb5.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2005-07-07 11:50:20 +1000
committerDarren Tucker <dtucker@zip.com.au>2005-07-07 11:50:20 +1000
commita916d143a16c59a6bc82df5e1d6b046e17d31848 (patch)
treee1d10bb44cf7af70845fbb927f2b8ed92e4f1468 /gss-serv-krb5.c
parentf92c0794ec9162f4e0d5291fe58e4fcb5a00f6d3 (diff)
- [auth-krb5.c auth.h gss-serv-krb5.c] Move KRB5CCNAME generation for the MIT
Kerberos code path into a common function and expand mkstemp template to be consistent with the rest of OpenSSH. From sxw at inf.ed.ac.uk, ok djm@
Diffstat (limited to 'gss-serv-krb5.c')
-rw-r--r--gss-serv-krb5.c32
1 files changed, 4 insertions, 28 deletions
diff --git a/gss-serv-krb5.c b/gss-serv-krb5.c
index 91d87f798..c642a83fe 100644
--- a/gss-serv-krb5.c
+++ b/gss-serv-krb5.c
@@ -131,34 +131,10 @@ ssh_gssapi_krb5_storecreds(ssh_gssapi_client *client)
131 return; 131 return;
132 } 132 }
133#else 133#else
134 { 134 if ((problem = ssh_krb5_cc_gen(krb_context, &ccache))) {
135 int tmpfd; 135 logit("ssh_krb5_cc_gen(): %.100s",
136 char ccname[40]; 136 krb5_get_err_text(krb_context, problem));
137 mode_t old_umask; 137 return;
138
139 snprintf(ccname, sizeof(ccname),
140 "FILE:/tmp/krb5cc_%d_XXXXXX", geteuid());
141
142 old_umask = umask(0177);
143 tmpfd = mkstemp(ccname + strlen("FILE:"));
144 umask(old_umask);
145 if (tmpfd == -1) {
146 logit("mkstemp(): %.100s", strerror(errno));
147 problem = errno;
148 return;
149 }
150 if (fchmod(tmpfd, S_IRUSR | S_IWUSR) == -1) {
151 logit("fchmod(): %.100s", strerror(errno));
152 close(tmpfd);
153 problem = errno;
154 return;
155 }
156 close(tmpfd);
157 if ((problem = krb5_cc_resolve(krb_context, ccname, &ccache))) {
158 logit("krb5_cc_resolve(): %.100s",
159 krb5_get_err_text(krb_context, problem));
160 return;
161 }
162 } 138 }
163#endif /* #ifdef HEIMDAL */ 139#endif /* #ifdef HEIMDAL */
164 140