*/
#include "includes.h"
-RCSID("$OpenBSD: authfd.c,v 1.62 2003/09/18 13:02:21 miod Exp $");
+RCSID("$OpenBSD: authfd.c,v 1.65 2005/05/24 17:32:43 avsm Exp $");
#include <openssl/evp.h>
* Wait for response from the agent. First read the length of the
* response packet.
*/
- len = 4;
- while (len > 0) {
- l = read(auth->fd, buf + 4 - len, len);
- if (l == -1 && (errno == EAGAIN || errno == EINTR))
- continue;
- if (l <= 0) {
- error("Error reading response length from authentication socket.");
- return 0;
- }
- len -= l;
+ if (atomicio(read, auth->fd, buf, 4) != 4) {
+ error("Error reading response length from authentication socket.");
+ return 0;
}
/* Extract the length, and check it for sanity. */
l = len;
if (l > sizeof(buf))
l = sizeof(buf);
- l = read(auth->fd, buf, l);
- if (l == -1 && (errno == EAGAIN || errno == EINTR))
- continue;
- if (l <= 0) {
+ if (atomicio(read, auth->fd, buf, l) != l) {
error("Error reading response from authentication socket.");
return 0;
}
}
int
-ssh_update_card(AuthenticationConnection *auth, int add,
+ssh_update_card(AuthenticationConnection *auth, int add,
const char *reader_id, const char *pin, u_int life, u_int confirm)
{
Buffer msg;
buffer_put_char(&msg, type);
buffer_put_cstring(&msg, reader_id);
buffer_put_cstring(&msg, pin);
-
+
if (constrained) {
if (life != 0) {
buffer_put_char(&msg, SSH_AGENT_CONSTRAIN_LIFETIME);