2010-03-26 16:29:14 +01:00
|
|
|
Index: ssh-agent.c
|
|
|
|
===================================================================
|
|
|
|
--- ssh-agent.c.orig
|
2007-01-07 17:26:05 +01:00
|
|
|
+++ ssh-agent.c
|
2010-03-26 16:29:14 +01:00
|
|
|
@@ -1174,8 +1174,18 @@ main(int ac, char **av)
|
2007-01-07 17:26:05 +01:00
|
|
|
parent_pid = getpid();
|
|
|
|
|
|
|
|
if (agentsocket == NULL) {
|
|
|
|
+ char *tmp1, *tmp;
|
|
|
|
+ char *tmp2 = "ssh-XXXXXXXXXX";
|
|
|
|
+ size_t len;
|
|
|
|
+
|
|
|
|
+ if ((tmp1 = getenv("TMPDIR")) == NULL)
|
|
|
|
+ tmp1 = "/tmp";
|
|
|
|
+ len = strlen(tmp1) + strlen(tmp2) + 1;
|
|
|
|
+ tmp = malloc(len);
|
|
|
|
+ snprintf(tmp, len, "%s%s%s", tmp1, tmp1 && strlen(tmp1) > 0 ? "/" : "", tmp2);
|
|
|
|
/* Create private directory for agent socket */
|
|
|
|
- strlcpy(socket_dir, "/tmp/ssh-XXXXXXXXXX", sizeof socket_dir);
|
|
|
|
+ strlcpy(socket_dir, tmp, sizeof socket_dir);
|
|
|
|
+ free(tmp);
|
|
|
|
if (mkdtemp(socket_dir) == NULL) {
|
|
|
|
perror("mkdtemp: private socket dir");
|
|
|
|
exit(1);
|