version 1.72.2.4, 2001/05/07 21:09:27 |
version 1.72.2.5, 2001/06/12 22:47:33 |
|
|
/* removes the agent forwarding socket */ |
/* removes the agent forwarding socket */ |
|
|
void |
void |
cleanup_socket(void) |
auth_sock_cleanup_proc(void *_pw) |
{ |
{ |
unlink(channel_forwarded_auth_socket_name); |
struct passwd *pw = _pw; |
rmdir(channel_forwarded_auth_socket_dir); |
|
|
if (channel_forwarded_auth_socket_name) { |
|
temporarily_use_uid(pw); |
|
unlink(channel_forwarded_auth_socket_name); |
|
rmdir(channel_forwarded_auth_socket_dir); |
|
channel_forwarded_auth_socket_name = NULL; |
|
restore_uid(); |
|
} |
} |
} |
|
|
/* |
/* |
|
|
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()); |
|
|
if (atexit(cleanup_socket) < 0) { |
/* delete agent socket on fatal() */ |
int saved = errno; |
fatal_add_cleanup(auth_sock_cleanup_proc, pw); |
cleanup_socket(); |
|
packet_disconnect("socket: %.100s", strerror(saved)); |
|
} |
|
/* Create the socket. */ |
/* Create the socket. */ |
sock = socket(AF_UNIX, SOCK_STREAM, 0); |
sock = socket(AF_UNIX, SOCK_STREAM, 0); |
if (sock < 0) |
if (sock < 0) |