Lines Matching +full:dev +full:- +full:active +full:- +full:grp

39 #include "openbsd-compat/sys-tree.h"
40 #include "openbsd-compat/sys-queue.h"
50 #include <grp.h>
67 #include "openbsd-compat/openssl-compat.h"
103 #include "sk-api.h"
113 /* Re-exec fds */
243 children[i].pipefd = -1; in child_alloc()
244 children[i].pid = -1; in child_alloc()
260 if (children[i].pipefd != -1 || in child_register()
272 child->pipefd = pipefd; in child_register()
273 child->early = 1; in child_register()
274 if ((child->config = sshbuf_fromb(config)) == NULL) in child_register()
278 addr_sa_to_xaddr(sa, addrlen, &child->addr) == 0) in child_register()
279 child->have_addr = 1; in child_register()
285 xasprintf(&child->id, "connection from %s", raddr); in child_register()
289 xasprintf(&child->id, "connection from %s to %s", raddr, laddr); in child_register()
307 if (child->pipefd != -1) in child_finish()
308 close(child->pipefd); in child_finish()
309 sshbuf_free(child->config); in child_finish()
310 sshbuf_free(child->keys); in child_finish()
311 free(child->id); in child_finish()
313 child->pipefd = -1; in child_finish()
314 child->pid = -1; in child_finish()
315 children_active--; in child_finish()
328 if (child->pipefd != -1) { in child_close()
329 close(child->pipefd); in child_close()
330 child->pipefd = -1; in child_close()
332 if (child->pid == -1 || force_final) in child_close()
366 if (child->config) in child_reap()
368 else if (child->keys) in child_reap()
370 else if (child->early) in child_reap()
376 if (WIFSIGNALED(child->status)) { in child_reap()
381 if ((was_crash = signal_is_crash(WTERMSIG(child->status)))) in child_reap()
384 "signal %d%s", (long)child->pid, child->id, in child_reap()
385 WTERMSIG(child->status), child_status); in child_reap()
388 } else if (!WIFEXITED(child->status)) { in child_reap()
391 "status=0x%x%s", (long)child->pid, child->id, child->status, in child_reap()
395 switch (WEXITSTATUS(child->status)) { in child_reap()
398 "normally%s", (long)child->pid, child->id, in child_reap()
404 "pid = %ld%s", child->id, (long)child->pid, in child_reap()
410 (long)child->pid, child->id, child_status); in child_reap()
416 (long)child->pid, child->id, child_status); in child_reap()
422 (long)child->pid, child->id, child_status); in child_reap()
427 "with status %d%s", (long)child->pid, child->id, in child_reap()
428 WEXITSTATUS(child->status), child_status); in child_reap()
433 if (child->have_addr) in child_reap()
434 srclimit_penalise(&child->addr, penalty_type); in child_reap()
436 child->pid = -1; in child_reap()
437 child->have_status = 0; in child_reap()
438 if (child->pipefd == -1) in child_reap()
454 if ((pid = waitpid(-1, &status, WNOHANG)) == 0) in child_reap_all_exited()
456 else if (pid == -1) { in child_reap_all_exited()
481 if (children[i].pipefd != -1) in close_startup_pipes()
496 logit("%d active startups", children_active); in show_info()
498 if (children[i].pipefd == -1 && children[i].pid <= 0) in show_info()
587 p = 100 - options.max_startups_rate; in should_drop_connection()
588 p *= startups - options.max_startups_begin; in should_drop_connection()
589 p /= options.max_startups - options.max_startups_begin; in should_drop_connection()
648 logit("%s logging rate-limited: additional %u connections " in drop_connection()
652 /* best-effort notification to client */ in drop_connection()
653 (void)write(sock, msg, sizeof(msg) - 1); in drop_connection()
669 "usage: sshd [-46DdeGiqTtV] [-C connection_spec] [-c host_cert_file]\n" in usage()
670 " [-E log_file] [-f config_file] [-g login_grace_time]\n" in usage()
671 " [-h host_key_file] [-o option] [-p port] [-u len]\n" in usage()
726 POKE_U32(sshbuf_mutable_ptr(m), len - 4); in pack_hostkeys()
749 if ((r = sshbuf_put_cstring(inc, item->selector)) != 0 || in pack_config()
750 (r = sshbuf_put_cstring(inc, item->filename)) != 0 || in pack_config()
751 (r = sshbuf_put_stringb(inc, item->contents)) != 0) in pack_config()
764 POKE_U32(sshbuf_mutable_ptr(m), len - 4); in pack_config()
805 if ((pid = fork()) == -1) in send_rexec_state()
837 for (ai = la->addrs; ai; ai = ai->ai_next) { in listen_on_addrs()
838 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6) in listen_on_addrs()
843 if ((ret = getnameinfo(ai->ai_addr, ai->ai_addrlen, in listen_on_addrs()
851 listen_sock = socket(ai->ai_family, ai->ai_socktype, in listen_on_addrs()
852 ai->ai_protocol); in listen_on_addrs()
853 if (listen_sock == -1) { in listen_on_addrs()
858 if (set_nonblock(listen_sock) == -1) { in listen_on_addrs()
862 if (fcntl(listen_sock, F_SETFD, FD_CLOEXEC) == -1) { in listen_on_addrs()
869 if (la->rdomain != NULL && in listen_on_addrs()
870 set_rdomain(listen_sock, la->rdomain) == -1) { in listen_on_addrs()
876 if (ai->ai_family == AF_INET6) in listen_on_addrs()
882 if (bind(listen_sock, ai->ai_addr, ai->ai_addrlen) == -1) { in listen_on_addrs()
892 if (listen(listen_sock, SSH_LISTEN_BACKLOG) == -1) in listen_on_addrs()
897 la->rdomain == NULL ? "" : " rdomain ", in listen_on_addrs()
898 la->rdomain == NULL ? "" : la->rdomain); in listen_on_addrs()
907 /* Initialise per-source limit tracking. */ in server_listen()
931 * The main TCP accept loop. Note that, for the non-debug case, returns
940 int oactive = -1, listening = 0, lameduck = 0; in server_accept_loop()
976 /* sized for worst-case */ in server_accept_loop()
1003 setproctitle("%s [listener] %d of %d-%d startups", in server_accept_loop()
1026 startup_pollfd[i] = -1; in server_accept_loop()
1027 if (children[i].pipefd != -1) { in server_accept_loop()
1039 if (ret == -1 && errno != EINTR) { in server_accept_loop()
1045 if (ret == -1) in server_accept_loop()
1049 if (children[i].pipefd == -1 || in server_accept_loop()
1050 startup_pollfd[i] == -1 || in server_accept_loop()
1064 if (ret == -1 && (errno == EINTR || errno == EAGAIN)) in server_accept_loop()
1068 listening--; in server_accept_loop()
1093 if (children[i].pipefd == -1 || in server_accept_loop()
1094 startup_pollfd[i] == -1 || in server_accept_loop()
1098 case -1: in server_accept_loop()
1110 listening--; in server_accept_loop()
1119 listening--; in server_accept_loop()
1128 listening--; in server_accept_loop()
1154 if (*newsock == -1) { in server_accept_loop()
1199 if (unset_nonblock(*newsock) == -1) { in server_accept_loop()
1204 SOCK_STREAM, 0, config_s) == -1) { in server_accept_loop()
1247 if ((child->pid = fork()) == 0) { in server_accept_loop()
1271 platform_post_fork_parent(child->pid); in server_accept_loop()
1272 if (child->pid == -1) in server_accept_loop()
1275 debug("Forked child %ld.", (long)child->pid); in server_accept_loop()
1347 connection_info->test = 1; in print_config()
1364 int sock_in = -1, sock_out = -1, newsock = -1, rexec_argc = 0; in main()
1365 int devnull, config_s[2] = { -1 , -1 }, have_connection_info = 0; in main()
1400 if (geteuid() == 0 && setgroups(0, NULL) == -1) in main()
1403 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ in main()
1409 /* Parse command-line arguments. */ in main()
1412 "C:E:b:c:f:g:h:k:o:p:u:46DGQRTdeiqrtV")) != -1) { in main()
1424 servconf_add_hostcert("[command-line]", 0, in main()
1450 logit("-r option is deprecated"); in main()
1453 fatal("-R not supported here"); in main()
1471 if (options.ports[options.num_ports-1] <= 0) { in main()
1477 if ((options.login_grace_time = convtime(optarg)) == -1) { in main()
1486 servconf_add_hostkey("[command-line]", 0, in main()
1497 optarg) == -1) in main()
1511 "command-line", 0, NULL, NULL, &includes) != 0) in main()
1530 if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1) in main()
1533 if ((devnull = dup(devnull)) == -1) in main()
1577 fatal("Config test connection parameter (-C) provided without " in main()
1578 "test mode (-T)"); in main()
1668 key->sk_flags & SSH_SK_USER_PRESENCE_REQD) { in main()
1671 key->sk_flags &= ~SSH_SK_USER_PRESENCE_REQD; in main()
1710 keytype = pubkey->type; in main()
1712 keytype = key->type; in main()
1743 logit("sshd: no hostkeys available -- exiting."); in main()
1786 debug("host certificate: #%u type %d %s", j, key->type, in main()
1800 if ((stat(_PATH_PRIVSEP_CHROOT_DIR, &sb) == -1) || in main()
1812 "world-writable.", _PATH_PRIVSEP_CHROOT_DIR); in main()
1832 /* Prepare arguments for sshd-session */ in main()
1836 /* Point to the sshd-session binary instead of sshd */ in main()
1842 rexec_argv[rexec_argc++] = "-R"; in main()
1846 debug3("using %s for re-exec", rexec_argv[0]); in main()
1871 * daemonized (eg re-exec via SIGHUP), disconnect from the controlling in main()
1877 if (daemon(0, 0) == -1) in main()
1885 /* Avoid killing the process in high-pressure swapping environments. */ in main()
1893 if (chdir("/") == -1) in main()
1903 /* Send configuration to ancestor sshd-session process */ in main()
1904 if (socketpair(AF_UNIX, SOCK_STREAM, 0, config_s) == -1) in main()
1951 if (!debug_flag && !inetd_flag && setsid() == -1) in main()
1957 if (dup2(newsock, STDIN_FILENO) == -1) in main()
1959 if (dup2(STDIN_FILENO, STDOUT_FILENO) == -1) in main()
1965 if (dup2(config_s[1], REEXEC_CONFIG_PASS_FD) == -1) in main()
1987 * Force GSS-API to parse its configuration and load any in main()