diff options
Diffstat (limited to 'gss-serv-krb5.c')
-rw-r--r-- | gss-serv-krb5.c | 32 |
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 | ||