version 1.57, 2000/05/08 17:42:24 |
version 1.57.2.1, 2000/06/12 02:37:32 |
|
|
return c; |
return c; |
} |
} |
|
|
void |
|
set_nonblock(int fd) |
|
{ |
|
int val; |
|
val = fcntl(fd, F_GETFL, 0); |
|
if (val < 0) { |
|
error("fcntl(%d, F_GETFL, 0): %s", fd, strerror(errno)); |
|
return; |
|
} |
|
if (val & O_NONBLOCK) |
|
return; |
|
debug("fd %d setting O_NONBLOCK", fd); |
|
val |= O_NONBLOCK; |
|
if (fcntl(fd, F_SETFL, val) == -1) |
|
error("fcntl(%d, F_SETFL, O_NONBLOCK): %s", fd, strerror(errno)); |
|
} |
|
|
|
/* |
/* |
* Register filedescriptors for a channel, used when allocating a channel or |
* Register filedescriptors for a channel, used when allocating a channel or |
* when the channel consumer/producer is ready, e.g. shell exec'd |
* when the channel consumer/producer is ready, e.g. shell exec'd |
|
|
} |
} |
|
|
/* |
/* |
* This if called to process SSH_CMSG_AGENT_REQUEST_FORWARDING on the server. |
* This is called to process SSH_CMSG_AGENT_REQUEST_FORWARDING on the server. |
* This starts forwarding authentication requests. |
* This starts forwarding authentication requests. |
*/ |
*/ |
|
|
void |
int |
auth_input_request_forwarding(struct passwd * pw) |
auth_input_request_forwarding(struct passwd * pw) |
{ |
{ |
int sock, newch; |
int sock, newch; |
|
|
strlcpy(channel_forwarded_auth_socket_dir, "/tmp/ssh-XXXXXXXX", MAX_SOCKET_NAME); |
strlcpy(channel_forwarded_auth_socket_dir, "/tmp/ssh-XXXXXXXX", MAX_SOCKET_NAME); |
|
|
/* Create private directory for socket */ |
/* Create private directory for socket */ |
if (mkdtemp(channel_forwarded_auth_socket_dir) == NULL) |
if (mkdtemp(channel_forwarded_auth_socket_dir) == NULL) { |
packet_disconnect("mkdtemp: %.100s", strerror(errno)); |
packet_send_debug("Agent forwarding disabled: mkdtemp() failed: %.100s", |
|
strerror(errno)); |
|
restore_uid(); |
|
xfree(channel_forwarded_auth_socket_name); |
|
xfree(channel_forwarded_auth_socket_dir); |
|
channel_forwarded_auth_socket_name = NULL; |
|
channel_forwarded_auth_socket_dir = NULL; |
|
return 0; |
|
} |
snprintf(channel_forwarded_auth_socket_name, MAX_SOCKET_NAME, "%s/agent.%d", |
snprintf(channel_forwarded_auth_socket_name, MAX_SOCKET_NAME, "%s/agent.%d", |
channel_forwarded_auth_socket_dir, (int) getpid()); |
channel_forwarded_auth_socket_dir, (int) getpid()); |
|
|
|
|
xstrdup("auth socket")); |
xstrdup("auth socket")); |
strlcpy(channels[newch].path, channel_forwarded_auth_socket_name, |
strlcpy(channels[newch].path, channel_forwarded_auth_socket_name, |
sizeof(channels[newch].path)); |
sizeof(channels[newch].path)); |
|
return 1; |
} |
} |
|
|
/* This is called to process an SSH_SMSG_AGENT_OPEN message. */ |
/* This is called to process an SSH_SMSG_AGENT_OPEN message. */ |