View | Details | Raw Unified | Return to bug 1809 | Differences between
and this patch

Collapse All | Expand All

(-)misc.c (+17 lines)
Lines 893-895 bandwidth_limit(struct bwlimit *bw, size Link Here
893
	bw->lamt = 0;
893
	bw->lamt = 0;
894
	gettimeofday(&bw->bwstart, NULL);
894
	gettimeofday(&bw->bwstart, NULL);
895
}
895
}
896
897
/* Make a template filename for mk[sd]temp() */
898
void
899
mktemp_proto(char *s, size_t len)
900
{
901
	const char *tmpdir;
902
	int r;
903
904
	if ((tmpdir = getenv("TMPDIR")) != NULL) {
905
		r = snprintf(s, len, "%s/ssh-XXXXXXXXXXXX", tmpdir);
906
		if (r > 0 && (size_t)r < len)
907
			return;
908
	}
909
	r = snprintf(s, len, "/tmp/ssh-XXXXXXXXXXXX");
910
	if (r < 0 || (size_t)r >= len)
911
		fatal("%s: template string too short", __func__);
912
}
(-)misc.h (+1 lines)
Lines 87-92 struct bwlimit { Link Here
87
void bandwidth_limit_init(struct bwlimit *, u_int64_t, size_t);
87
void bandwidth_limit_init(struct bwlimit *, u_int64_t, size_t);
88
void bandwidth_limit(struct bwlimit *, size_t);
88
void bandwidth_limit(struct bwlimit *, size_t);
89
89
90
void mktemp_proto(char *, size_t);
90
91
91
/* readpass.c */
92
/* readpass.c */
92
93
(-)ssh-agent.1 (-2 / +2 lines)
Lines 72-78 Bind the agent to the Link Here
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 .
Lines 192-198 Contains the protocol version 2 DSA auth Link Here
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.
(-)ssh-agent.c (-1 / +1 lines)
Lines 1199-1205 main(int ac, char **av) Link Here
1199
1199
1200
	if (agentsocket == NULL) {
1200
	if (agentsocket == NULL) {
1201
		/* Create private directory for agent socket */
1201
		/* Create private directory for agent socket */
1202
		strlcpy(socket_dir, "/tmp/ssh-XXXXXXXXXX", sizeof socket_dir);
1202
		mktemp_proto(socket_dir, sizeof(socket_dir));
1203
		if (mkdtemp(socket_dir) == NULL) {
1203
		if (mkdtemp(socket_dir) == NULL) {
1204
			perror("mkdtemp: private socket dir");
1204
			perror("mkdtemp: private socket dir");
1205
			exit(1);
1205
			exit(1);
(-)session.c (-1 / +3 lines)
Lines 165-170 auth_input_request_forwarding(struct pas Link Here
165
	Channel *nc;
165
	Channel *nc;
166
	int sock = -1;
166
	int sock = -1;
167
	struct sockaddr_un sunaddr;
167
	struct sockaddr_un sunaddr;
168
	char socket_dir[MAXPATHLEN];
168
169
169
	if (auth_sock_name != NULL) {
170
	if (auth_sock_name != NULL) {
170
		error("authentication forwarding requested twice.");
171
		error("authentication forwarding requested twice.");
Lines 175-181 auth_input_request_forwarding(struct pas Link Here
175
	temporarily_use_uid(pw);
176
	temporarily_use_uid(pw);
176
177
177
	/* Allocate a buffer for the socket name, and format the name. */
178
	/* Allocate a buffer for the socket name, and format the name. */
178
	auth_sock_dir = xstrdup("/tmp/ssh-XXXXXXXXXX");
179
	mktemp_proto(socket_dir, sizeof(socket_dir));
180
	auth_sock_dir = xstrdup(socket_dir);
179
181
180
	/* Create private directory for socket */
182
	/* Create private directory for socket */
181
	if (mkdtemp(auth_sock_dir) == NULL) {
183
	if (mkdtemp(auth_sock_dir) == NULL) {
(-)clientloop.c (-1 / +1 lines)
Lines 317-323 client_x11_get_proto(const char *display Link Here
317
		if (trusted == 0) {
317
		if (trusted == 0) {
318
			xauthdir = xmalloc(MAXPATHLEN);
318
			xauthdir = xmalloc(MAXPATHLEN);
319
			xauthfile = xmalloc(MAXPATHLEN);
319
			xauthfile = xmalloc(MAXPATHLEN);
320
			strlcpy(xauthdir, "/tmp/ssh-XXXXXXXXXX", MAXPATHLEN);
320
			mktemp_proto(xauthdir, MAXPATHLEN);
321
			if (mkdtemp(xauthdir) != NULL) {
321
			if (mkdtemp(xauthdir) != NULL) {
322
				do_unlink = 1;
322
				do_unlink = 1;
323
				snprintf(xauthfile, MAXPATHLEN, "%s/xauthfile",
323
				snprintf(xauthfile, MAXPATHLEN, "%s/xauthfile",

Return to bug 1809