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

Collapse All | Expand All

(-)a/authfd.c (-12 / +28 lines)
Lines 83-103 decode_reply(u_char type) Link Here
83
		return SSH_ERR_INVALID_FORMAT;
83
		return SSH_ERR_INVALID_FORMAT;
84
}
84
}
85
85
86
/* Returns the number of the authentication fd, or -1 if there is none. */
86
static int
87
int
87
get_authentication_socket(const char *authsocket, int *fdp)
88
ssh_get_authentication_socket(int *fdp)
89
{
88
{
90
	const char *authsocket;
91
	int sock, oerrno;
89
	int sock, oerrno;
92
	struct sockaddr_un sunaddr;
90
	struct sockaddr_un sunaddr;
93
91
94
	if (fdp != NULL)
95
		*fdp = -1;
96
97
	authsocket = getenv(SSH_AUTHSOCKET_ENV_NAME);
98
	if (!authsocket)
99
		return SSH_ERR_AGENT_NOT_PRESENT;
100
101
	memset(&sunaddr, 0, sizeof(sunaddr));
92
	memset(&sunaddr, 0, sizeof(sunaddr));
102
	sunaddr.sun_family = AF_UNIX;
93
	sunaddr.sun_family = AF_UNIX;
103
	strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path));
94
	strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path));
Lines 117-123 ssh_get_authentication_socket(int *fdp) Link Here
117
		*fdp = sock;
108
		*fdp = sock;
118
	else
109
	else
119
		close(sock);
110
		close(sock);
120
	return 0;
111
	return SSH_ERR_SUCCESS;
112
}
113
114
/* Returns the number of the authentication fd, or -1 if there is none. */
115
int
116
ssh_get_authentication_socket(int *fdp)
117
{
118
	const char *authsocketlist;
119
	const char *authsocket;
120
	int rc;
121
122
	if (fdp != NULL)
123
		*fdp = -1;
124
125
	authsocketlist = getenv(SSH_AUTHSOCKET_ENV_NAME);
126
	if (!authsocketlist)
127
		return SSH_ERR_AGENT_NOT_PRESENT;
128
129
	authsocket = strtok((char *)authsocketlist, ":");
130
131
	do {
132
		rc = get_authentication_socket(authsocket, fdp);
133
		authsocket = strtok(NULL, ":");
134
	} while (rc != SSH_ERR_SUCCESS && authsocket != NULL);
135
136
	return rc;
121
}
137
}
122
138
123
/* Communicate with agent: send request and read reply */
139
/* Communicate with agent: send request and read reply */
(-)a/ssh-add.1 (-1 / +3 lines)
Lines 79-85 retries the last passphrase if multiple identity files are given. Link Here
79
.Pp
79
.Pp
80
The authentication agent must be running and the
80
The authentication agent must be running and the
81
.Ev SSH_AUTH_SOCK
81
.Ev SSH_AUTH_SOCK
82
environment variable must contain the name of its socket for
82
environment variable must contain the name of its socket
83
.Nm
83
.Nm
84
to work.
84
to work.
85
.Pp
85
.Pp
Lines 171-176 to make this work.) Link Here
171
Identifies the path of a
171
Identifies the path of a
172
.Ux Ns -domain
172
.Ux Ns -domain
173
socket used to communicate with the agent.
173
socket used to communicate with the agent.
174
If the variable contains a list of sockets, the first functional
175
socket will be used.
174
.El
176
.El
175
.Sh FILES
177
.Sh FILES
176
.Bl -tag -width Ds
178
.Bl -tag -width Ds
(-)a/ssh.1 (-1 / +2 lines)
Lines 1389-1394 to make this work.) Link Here
1389
Identifies the path of a
1389
Identifies the path of a
1390
.Ux Ns -domain
1390
.Ux Ns -domain
1391
socket used to communicate with the agent.
1391
socket used to communicate with the agent.
1392
If the variable contains a list of sockets, the first functional
1393
socket will be used.
1392
.It Ev SSH_CONNECTION
1394
.It Ev SSH_CONNECTION
1393
Identifies the client and server ends of the connection.
1395
Identifies the client and server ends of the connection.
1394
The variable contains
1396
The variable contains
1395
- 

Return to bug 2480