Home | History | Annotate | Download | only in openssh

Lines Matching refs:sock

241 	c->sock = (rfd == wfd) ? rfd : -1;
376 channel_close_fd(&c->sock);
400 if (c->sock != -1)
401 shutdown(c->sock, SHUT_RDWR);
468 channel_close_fd(&c->sock);
791 FD_SET(c->sock, readset);
799 FD_SET(c->sock, writeset);
806 FD_SET(c->sock, readset);
808 FD_SET(c->sock, writeset);
868 FD_SET(c->sock, writeset);
955 channel_close_fd(&c->sock);
956 c->sock = -1;
1166 FD_SET(c->sock, writeset);
1281 FD_SET(c->sock, readset);
1302 FD_SET(c->sock, readset);
1322 if (FD_ISSET(c->sock, readset)) {
1325 newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen);
1328 channel_close_fd(&c->sock);
1375 char *remote_ipaddr = get_peer_ipaddr(c->sock);
1376 int remote_port = get_peer_port(c->sock);
1454 if (FD_ISSET(c->sock, readset)) {
1473 newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen);
1504 if (FD_ISSET(c->sock, readset)) {
1506 newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen);
1533 int err = 0, sock;
1536 if (FD_ISSET(c->sock, writeset)) {
1537 if (getsockopt(c->sock, SOL_SOCKET, SO_ERROR, &err, &sz) < 0) {
1561 if ((sock = connect_next(&c->connect_ctx)) > 0) {
1562 close(c->sock);
1563 c->sock = c->rfd = c->wfd = sock;
1898 if (!FD_ISSET(c->sock, readset))
1908 if ((newsock = accept(c->sock, (struct sockaddr*)&addr,
1931 nc->self, nc->sock);
1945 if (FD_ISSET(c->sock, writeset) && buffer_len(&c->output) > 0) {
1946 len = write(c->sock, buffer_ptr(&c->output),
2643 int sock, r, success = 0, wildcard = 0, is_client;
2745 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
2746 if (sock < 0) {
2752 channel_set_reuseaddr(sock);
2754 sock_set_v6only(sock);
2760 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
2767 close(sock);
2771 if (listen(sock, SSH_LISTEN_BACKLOG) < 0) {
2773 close(sock);
2784 *allocated_listen_port = get_sock_port(sock, 1);
2790 c = channel_new("port listener", type, sock, sock, -1,
3080 int sock, saved_errno;
3093 if ((sock = socket(cctx->ai->ai_family, cctx->ai->ai_socktype,
3101 if (set_nonblock(sock) == -1)
3102 fatal("%s: set_nonblock(%d)", __func__, sock);
3103 if (connect(sock, cctx->ai->ai_addr,
3109 close(sock);
3114 "in progress, fd=%d", cctx->host, ntop, strport, sock);
3116 set_nodelay(sock);
3117 return sock;
3139 int sock = -1;
3159 if ((sock = connect_next(&cctx)) == -1) {
3165 c = channel_new(ctype, SSH_CHANNEL_CONNECTING, sock, sock, -1,
3255 int display_number, sock;
3280 sock = socket(ai->ai_family, ai->ai_socktype,
3282 if (sock < 0) {
3298 sock_set_v6only(sock);
3300 channel_set_reuseaddr(sock);
3301 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
3303 close(sock);
3311 socks[num_socks++] = sock;
3325 sock = socks[n];
3326 if (listen(sock, SSH_LISTEN_BACKLOG) < 0) {
3328 close(sock);
3336 sock = socks[n];
3338 SSH_CHANNEL_X11_LISTENER, sock, sock, -1,
3354 int sock;
3357 sock = socket(AF_UNIX, SOCK_STREAM, 0);
3358 if (sock < 0)
3363 if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) == 0)
3364 return sock;
3365 close(sock);
3386 int gaierr, sock = 0;
3402 sock = connect_local_xsocket_path(display);
3403 if (sock < 0)
3407 return sock;
3423 sock = connect_local_xsocket(display_number);
3424 if (sock < 0)
3428 return sock;
3460 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
3461 if (sock < 0) {
3466 if (connect(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
3469 close(sock);
3481 set_nodelay(sock);
3482 return sock;
3496 int remote_id, sock = 0;
3511 sock = x11_connect_display();
3512 if (sock != -1) {
3515 SSH_CHANNEL_X11_OPEN, sock, sock, -1, 0, 0, 0,