diff options
author | Damien Miller <djm@mindrot.org> | 2010-12-01 11:50:35 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2010-12-01 11:50:35 +1100 |
commit | 2cd629349d9fc4067985fec04b23bfb5ff7aa8d8 (patch) | |
tree | 7bd99191479f0805ba73623baa7ef47b4189e673 | |
parent | 188ea814b10e39a399178af1fb18a79ea406f9bb (diff) |
- djm@cvs.openbsd.org 2010/11/21 01:01:13
[clientloop.c misc.c misc.h ssh-agent.1 ssh-agent.c]
honour $TMPDIR for client xauth and ssh-agent temporary directories;
feedback and ok markus@
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | clientloop.c | 4 | ||||
-rw-r--r-- | misc.c | 19 | ||||
-rw-r--r-- | misc.h | 3 | ||||
-rw-r--r-- | ssh-agent.1 | 8 | ||||
-rw-r--r-- | ssh-agent.c | 4 |
6 files changed, 32 insertions, 10 deletions
@@ -3,6 +3,10 @@ | |||
3 | - deraadt@cvs.openbsd.org 2010/11/20 05:12:38 | 3 | - deraadt@cvs.openbsd.org 2010/11/20 05:12:38 |
4 | [auth2-pubkey.c] | 4 | [auth2-pubkey.c] |
5 | clean up cases of ;; | 5 | clean up cases of ;; |
6 | - djm@cvs.openbsd.org 2010/11/21 01:01:13 | ||
7 | [clientloop.c misc.c misc.h ssh-agent.1 ssh-agent.c] | ||
8 | honour $TMPDIR for client xauth and ssh-agent temporary directories; | ||
9 | feedback and ok markus@ | ||
6 | 10 | ||
7 | 20101124 | 11 | 20101124 |
8 | - (dtucker) [platform.c session.c] Move the getluid call out of session.c and | 12 | - (dtucker) [platform.c session.c] Move the getluid call out of session.c and |
diff --git a/clientloop.c b/clientloop.c index 52dcb4c04..076386cc2 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.224 2010/11/13 23:27:50 djm Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.225 2010/11/21 01:01:13 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -325,7 +325,7 @@ client_x11_get_proto(const char *display, const char *xauth_path, | |||
325 | if (trusted == 0) { | 325 | if (trusted == 0) { |
326 | xauthdir = xmalloc(MAXPATHLEN); | 326 | xauthdir = xmalloc(MAXPATHLEN); |
327 | xauthfile = xmalloc(MAXPATHLEN); | 327 | xauthfile = xmalloc(MAXPATHLEN); |
328 | strlcpy(xauthdir, "/tmp/ssh-XXXXXXXXXX", MAXPATHLEN); | 328 | mktemp_proto(xauthdir, MAXPATHLEN); |
329 | if (mkdtemp(xauthdir) != NULL) { | 329 | if (mkdtemp(xauthdir) != NULL) { |
330 | do_unlink = 1; | 330 | do_unlink = 1; |
331 | snprintf(xauthfile, MAXPATHLEN, "%s/xauthfile", | 331 | snprintf(xauthfile, MAXPATHLEN, "%s/xauthfile", |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.c,v 1.83 2010/11/13 23:27:50 djm Exp $ */ | 1 | /* $OpenBSD: misc.c,v 1.84 2010/11/21 01:01:13 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2005,2006 Damien Miller. All rights reserved. |
@@ -916,6 +916,23 @@ bandwidth_limit(struct bwlimit *bw, size_t read_len) | |||
916 | gettimeofday(&bw->bwstart, NULL); | 916 | gettimeofday(&bw->bwstart, NULL); |
917 | } | 917 | } |
918 | 918 | ||
919 | /* Make a template filename for mk[sd]temp() */ | ||
920 | void | ||
921 | mktemp_proto(char *s, size_t len) | ||
922 | { | ||
923 | const char *tmpdir; | ||
924 | int r; | ||
925 | |||
926 | if ((tmpdir = getenv("TMPDIR")) != NULL) { | ||
927 | r = snprintf(s, len, "%s/ssh-XXXXXXXXXXXX", tmpdir); | ||
928 | if (r > 0 && (size_t)r < len) | ||
929 | return; | ||
930 | } | ||
931 | r = snprintf(s, len, "/tmp/ssh-XXXXXXXXXXXX"); | ||
932 | if (r < 0 || (size_t)r >= len) | ||
933 | fatal("%s: template string too short", __func__); | ||
934 | } | ||
935 | |||
919 | static const struct { | 936 | static const struct { |
920 | const char *name; | 937 | const char *name; |
921 | int value; | 938 | int value; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: misc.h,v 1.46 2010/11/13 23:27:50 djm Exp $ */ | 1 | /* $OpenBSD: misc.h,v 1.47 2010/11/21 01:01:13 djm Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -89,6 +89,7 @@ void bandwidth_limit_init(struct bwlimit *, u_int64_t, size_t); | |||
89 | void bandwidth_limit(struct bwlimit *, size_t); | 89 | void bandwidth_limit(struct bwlimit *, size_t); |
90 | 90 | ||
91 | int parse_ipqos(const char *); | 91 | int parse_ipqos(const char *); |
92 | void mktemp_proto(char *, size_t); | ||
92 | 93 | ||
93 | /* readpass.c */ | 94 | /* readpass.c */ |
94 | 95 | ||
diff --git a/ssh-agent.1 b/ssh-agent.1 index 134b93ae9..bb801c902 100644 --- a/ssh-agent.1 +++ b/ssh-agent.1 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: ssh-agent.1,v 1.52 2010/08/31 17:40:54 jmc Exp $ | 1 | .\" $OpenBSD: ssh-agent.1,v 1.53 2010/11/21 01:01:13 djm Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | .\" Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | .\" Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -34,7 +34,7 @@ | |||
34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 34 | .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 35 | .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
36 | .\" | 36 | .\" |
37 | .Dd $Mdocdate: August 31 2010 $ | 37 | .Dd $Mdocdate: November 21 2010 $ |
38 | .Dt SSH-AGENT 1 | 38 | .Dt SSH-AGENT 1 |
39 | .Os | 39 | .Os |
40 | .Sh NAME | 40 | .Sh NAME |
@@ -72,7 +72,7 @@ Bind the agent to the | |||
72 | socket | 72 | socket |
73 | .Ar bind_address . | 73 | .Ar bind_address . |
74 | The default is | 74 | The default is |
75 | .Pa /tmp/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt . | 75 | .Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt . |
76 | .It Fl c | 76 | .It Fl c |
77 | Generate C-shell commands on | 77 | Generate C-shell commands on |
78 | .Dv stdout . | 78 | .Dv stdout . |
@@ -192,7 +192,7 @@ Contains the protocol version 2 DSA authentication identity of the user. | |||
192 | Contains the protocol version 2 ECDSA authentication identity of the user. | 192 | Contains the protocol version 2 ECDSA authentication identity of the user. |
193 | .It Pa ~/.ssh/id_rsa | 193 | .It Pa ~/.ssh/id_rsa |
194 | Contains the protocol version 2 RSA authentication identity of the user. | 194 | Contains the protocol version 2 RSA authentication identity of the user. |
195 | .It Pa /tmp/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt | 195 | .It Pa $TMPDIR/ssh-XXXXXXXXXX/agent.\*(Ltppid\*(Gt |
196 | .Ux Ns -domain | 196 | .Ux Ns -domain |
197 | sockets used to contain the connection to the authentication agent. | 197 | sockets used to contain the connection to the authentication agent. |
198 | These sockets should only be readable by the owner. | 198 | These sockets should only be readable by the owner. |
diff --git a/ssh-agent.c b/ssh-agent.c index a978d293b..afba413d7 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-agent.c,v 1.170 2010/08/31 12:33:38 djm Exp $ */ | 1 | /* $OpenBSD: ssh-agent.c,v 1.171 2010/11/21 01:01:13 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -1232,7 +1232,7 @@ main(int ac, char **av) | |||
1232 | 1232 | ||
1233 | if (agentsocket == NULL) { | 1233 | if (agentsocket == NULL) { |
1234 | /* Create private directory for agent socket */ | 1234 | /* Create private directory for agent socket */ |
1235 | strlcpy(socket_dir, "/tmp/ssh-XXXXXXXXXX", sizeof socket_dir); | 1235 | mktemp_proto(socket_dir, sizeof(socket_dir)); |
1236 | if (mkdtemp(socket_dir) == NULL) { | 1236 | if (mkdtemp(socket_dir) == NULL) { |
1237 | perror("mkdtemp: private socket dir"); | 1237 | perror("mkdtemp: private socket dir"); |
1238 | exit(1); | 1238 | exit(1); |