version 1.187, 2014/07/03 03:11:03 |
version 1.188, 2014/07/15 15:54:14 |
|
|
u_int nalloc; |
u_int nalloc; |
char *shell, *format, *pidstr, *agentsocket = NULL; |
char *shell, *format, *pidstr, *agentsocket = NULL; |
fd_set *readsetp = NULL, *writesetp = NULL; |
fd_set *readsetp = NULL, *writesetp = NULL; |
struct sockaddr_un sunaddr; |
|
struct rlimit rlim; |
struct rlimit rlim; |
extern int optind; |
extern int optind; |
extern char *optarg; |
extern char *optarg; |
|
|
* Create socket early so it will exist before command gets run from |
* Create socket early so it will exist before command gets run from |
* the parent. |
* the parent. |
*/ |
*/ |
sock = socket(AF_UNIX, SOCK_STREAM, 0); |
sock = unix_listener(socket_name, SSH_LISTEN_BACKLOG, 0); |
if (sock < 0) { |
if (sock < 0) { |
perror("socket"); |
/* XXX - unix_listener() calls error() not perror() */ |
*socket_name = '\0'; /* Don't unlink any existing file */ |
*socket_name = '\0'; /* Don't unlink any existing file */ |
cleanup_exit(1); |
|
} |
|
memset(&sunaddr, 0, sizeof(sunaddr)); |
|
sunaddr.sun_family = AF_UNIX; |
|
strlcpy(sunaddr.sun_path, socket_name, sizeof(sunaddr.sun_path)); |
|
if (bind(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0) { |
|
perror("bind"); |
|
*socket_name = '\0'; /* Don't unlink any existing file */ |
|
cleanup_exit(1); |
|
} |
|
if (listen(sock, SSH_LISTEN_BACKLOG) < 0) { |
|
perror("listen"); |
|
cleanup_exit(1); |
cleanup_exit(1); |
} |
} |
|
|