X-Git-Url: http://andersk.mit.edu/gitweb/gssapi-openssh.git/blobdiff_plain/87c01c943f29eba7bd46a00da5c1ee753afa3de6..8d212d56428a6f99849ad239d25a7a0995ca59d8:/openssh/gss-serv-gsi.c diff --git a/openssh/gss-serv-gsi.c b/openssh/gss-serv-gsi.c index c152e79..7eec054 100644 --- a/openssh/gss-serv-gsi.c +++ b/openssh/gss-serv-gsi.c @@ -27,12 +27,19 @@ #ifdef GSSAPI #ifdef GSI -#include "auth.h" -#include "auth-pam.h" +#include + +#include +#include + #include "xmalloc.h" +#include "key.h" +#include "hostfile.h" +#include "auth.h" #include "log.h" #include "servconf.h" +#include "buffer.h" #include "ssh-gss.h" extern ServerOptions options; @@ -192,17 +199,25 @@ ssh_gssapi_gsi_storecreds(ssh_gssapi_client *client) } else { client->store.envvar = strdup((char *)export_cred.value); } + if (access(p, R_OK) == 0) { + if (client->store.filename) { + if (rename(p, client->store.filename) < 0) { + logit("Failed to rename %s to %s: %s", p, + client->store.filename, strerror(errno)); + xfree(client->store.filename); + client->store.filename = strdup(p); + } else { + p = client->store.filename; + } + } else { + client->store.filename = strdup(p); + } + } client->store.envval = strdup(p); #ifdef USE_PAM if (options.use_pam) do_pam_putenv(client->store.envvar, client->store.envval); #endif - if (strncmp(p, "FILE:", 5) == 0) { - p += 5; - } - if (access(p, R_OK) == 0) { - client->store.filename = strdup(p); - } gss_release_buffer(&minor_status, &export_cred); }