|
Lines 1444-1449
prepare_proctitle(int ac, char **av)
Link Here
|
| 1444 |
return ret; |
1444 |
return ret; |
| 1445 |
} |
1445 |
} |
| 1446 |
|
1446 |
|
|
|
1447 |
static void |
| 1448 |
print_config(struct ssh *ssh, struct connection_info *connection_info) |
| 1449 |
{ |
| 1450 |
/* |
| 1451 |
* If no connection info was provided by -C then use |
| 1452 |
* use a blank one that will cause no predicate to match. |
| 1453 |
*/ |
| 1454 |
if (connection_info == NULL) |
| 1455 |
connection_info = get_connection_info(ssh, 0, 0); |
| 1456 |
connection_info->test = 1; |
| 1457 |
parse_server_match_config(&options, &includes, connection_info); |
| 1458 |
dump_config(&options); |
| 1459 |
exit(0); |
| 1460 |
} |
| 1461 |
|
| 1447 |
/* |
1462 |
/* |
| 1448 |
* Main program for the daemon. |
1463 |
* Main program for the daemon. |
| 1449 |
*/ |
1464 |
*/ |
|
Lines 1453-1459
main(int ac, char **av)
Link Here
|
| 1453 |
struct ssh *ssh = NULL; |
1468 |
struct ssh *ssh = NULL; |
| 1454 |
extern char *optarg; |
1469 |
extern char *optarg; |
| 1455 |
extern int optind; |
1470 |
extern int optind; |
| 1456 |
int r, opt, on = 1, already_daemon, remote_port; |
1471 |
int r, opt, on = 1, do_dump_cfg = 0, already_daemon, remote_port; |
| 1457 |
int sock_in = -1, sock_out = -1, newsock = -1; |
1472 |
int sock_in = -1, sock_out = -1, newsock = -1; |
| 1458 |
const char *remote_ip, *rdomain; |
1473 |
const char *remote_ip, *rdomain; |
| 1459 |
char *fp, *line, *laddr, *logfile = NULL; |
1474 |
char *fp, *line, *laddr, *logfile = NULL; |
|
Lines 1483-1489
main(int ac, char **av)
Link Here
|
| 1483 |
|
1498 |
|
| 1484 |
/* Parse command-line arguments. */ |
1499 |
/* Parse command-line arguments. */ |
| 1485 |
while ((opt = getopt(ac, av, |
1500 |
while ((opt = getopt(ac, av, |
| 1486 |
"C:E:b:c:f:g:h:k:o:p:u:46DQRTdeiqrtV")) != -1) { |
1501 |
"C:E:b:c:f:g:h:k:o:p:u:46DGQRTdeiqrtV")) != -1) { |
| 1487 |
switch (opt) { |
1502 |
switch (opt) { |
| 1488 |
case '4': |
1503 |
case '4': |
| 1489 |
options.address_family = AF_INET; |
1504 |
options.address_family = AF_INET; |
|
Lines 1508-1513
main(int ac, char **av)
Link Here
|
| 1508 |
case 'D': |
1523 |
case 'D': |
| 1509 |
no_daemon_flag = 1; |
1524 |
no_daemon_flag = 1; |
| 1510 |
break; |
1525 |
break; |
|
|
1526 |
case 'G': |
| 1527 |
do_dump_cfg = 1; |
| 1528 |
break; |
| 1511 |
case 'E': |
1529 |
case 'E': |
| 1512 |
logfile = optarg; |
1530 |
logfile = optarg; |
| 1513 |
/* FALLTHROUGH */ |
1531 |
/* FALLTHROUGH */ |
|
Lines 1595-1601
main(int ac, char **av)
Link Here
|
| 1595 |
} |
1613 |
} |
| 1596 |
if (rexeced_flag || inetd_flag) |
1614 |
if (rexeced_flag || inetd_flag) |
| 1597 |
rexec_flag = 0; |
1615 |
rexec_flag = 0; |
| 1598 |
if (!test_flag && rexec_flag && !path_absolute(av[0])) |
1616 |
if (!test_flag && !do_dump_cfg && rexec_flag && !path_absolute(av[0])) |
| 1599 |
fatal("sshd re-exec requires execution with an absolute path"); |
1617 |
fatal("sshd re-exec requires execution with an absolute path"); |
| 1600 |
if (rexeced_flag) |
1618 |
if (rexeced_flag) |
| 1601 |
closefrom(REEXEC_MIN_FREE_FD); |
1619 |
closefrom(REEXEC_MIN_FREE_FD); |
|
Lines 1696-1701
main(int ac, char **av)
Link Here
|
| 1696 |
|
1714 |
|
| 1697 |
debug("sshd version %s, %s", SSH_VERSION, SSH_OPENSSL_VERSION); |
1715 |
debug("sshd version %s, %s", SSH_VERSION, SSH_OPENSSL_VERSION); |
| 1698 |
|
1716 |
|
|
|
1717 |
if (do_dump_cfg) |
| 1718 |
print_config(ssh, connection_info); |
| 1719 |
|
| 1699 |
/* load host keys */ |
1720 |
/* load host keys */ |
| 1700 |
sensitive_data.host_keys = xcalloc(options.num_host_key_files, |
1721 |
sensitive_data.host_keys = xcalloc(options.num_host_key_files, |
| 1701 |
sizeof(struct sshkey *)); |
1722 |
sizeof(struct sshkey *)); |
|
Lines 1862-1878
main(int ac, char **av)
Link Here
|
| 1862 |
"world-writable.", _PATH_PRIVSEP_CHROOT_DIR); |
1883 |
"world-writable.", _PATH_PRIVSEP_CHROOT_DIR); |
| 1863 |
} |
1884 |
} |
| 1864 |
|
1885 |
|
| 1865 |
if (test_flag > 1) { |
1886 |
if (test_flag > 1) |
| 1866 |
/* |
1887 |
print_config(ssh, connection_info); |
| 1867 |
* If no connection info was provided by -C then use |
|
|
| 1868 |
* use a blank one that will cause no predicate to match. |
| 1869 |
*/ |
| 1870 |
if (connection_info == NULL) |
| 1871 |
connection_info = get_connection_info(ssh, 0, 0); |
| 1872 |
connection_info->test = 1; |
| 1873 |
parse_server_match_config(&options, &includes, connection_info); |
| 1874 |
dump_config(&options); |
| 1875 |
} |
| 1876 |
|
1888 |
|
| 1877 |
/* Configuration looks good, so exit if in test mode. */ |
1889 |
/* Configuration looks good, so exit if in test mode. */ |
| 1878 |
if (test_flag) |
1890 |
if (test_flag) |