diff options
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 39 |
1 files changed, 12 insertions, 27 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshd.c,v 1.390 2012/04/12 02:42:32 djm Exp $ */ | 1 | /* $OpenBSD: sshd.c,v 1.391 2012/05/13 01:42:32 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -1325,14 +1325,14 @@ main(int ac, char **av) | |||
1325 | int opt, i, j, on = 1; | 1325 | int opt, i, j, on = 1; |
1326 | int sock_in = -1, sock_out = -1, newsock = -1; | 1326 | int sock_in = -1, sock_out = -1, newsock = -1; |
1327 | const char *remote_ip; | 1327 | const char *remote_ip; |
1328 | char *test_user = NULL, *test_host = NULL, *test_addr = NULL; | ||
1329 | int remote_port; | 1328 | int remote_port; |
1330 | char *line, *p, *cp; | 1329 | char *line; |
1331 | int config_s[2] = { -1 , -1 }; | 1330 | int config_s[2] = { -1 , -1 }; |
1332 | u_int64_t ibytes, obytes; | 1331 | u_int64_t ibytes, obytes; |
1333 | mode_t new_umask; | 1332 | mode_t new_umask; |
1334 | Key *key; | 1333 | Key *key; |
1335 | Authctxt *authctxt; | 1334 | Authctxt *authctxt; |
1335 | struct connection_info *connection_info = get_connection_info(0, 0); | ||
1336 | 1336 | ||
1337 | #ifdef HAVE_SECUREWARE | 1337 | #ifdef HAVE_SECUREWARE |
1338 | (void)set_auth_parameters(ac, av); | 1338 | (void)set_auth_parameters(ac, av); |
@@ -1454,20 +1454,9 @@ main(int ac, char **av) | |||
1454 | test_flag = 2; | 1454 | test_flag = 2; |
1455 | break; | 1455 | break; |
1456 | case 'C': | 1456 | case 'C': |
1457 | cp = optarg; | 1457 | if (parse_server_match_testspec(connection_info, |
1458 | while ((p = strsep(&cp, ",")) && *p != '\0') { | 1458 | optarg) == -1) |
1459 | if (strncmp(p, "addr=", 5) == 0) | 1459 | exit(1); |
1460 | test_addr = xstrdup(p + 5); | ||
1461 | else if (strncmp(p, "host=", 5) == 0) | ||
1462 | test_host = xstrdup(p + 5); | ||
1463 | else if (strncmp(p, "user=", 5) == 0) | ||
1464 | test_user = xstrdup(p + 5); | ||
1465 | else { | ||
1466 | fprintf(stderr, "Invalid test " | ||
1467 | "mode specification %s\n", p); | ||
1468 | exit(1); | ||
1469 | } | ||
1470 | } | ||
1471 | break; | 1460 | break; |
1472 | case 'u': | 1461 | case 'u': |
1473 | utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL); | 1462 | utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL); |
@@ -1479,7 +1468,7 @@ main(int ac, char **av) | |||
1479 | case 'o': | 1468 | case 'o': |
1480 | line = xstrdup(optarg); | 1469 | line = xstrdup(optarg); |
1481 | if (process_server_config_line(&options, line, | 1470 | if (process_server_config_line(&options, line, |
1482 | "command-line", 0, NULL, NULL, NULL, NULL) != 0) | 1471 | "command-line", 0, NULL, NULL) != 0) |
1483 | exit(1); | 1472 | exit(1); |
1484 | xfree(line); | 1473 | xfree(line); |
1485 | break; | 1474 | break; |
@@ -1535,13 +1524,10 @@ main(int ac, char **av) | |||
1535 | * the parameters we need. If we're not doing an extended test, | 1524 | * the parameters we need. If we're not doing an extended test, |
1536 | * do not silently ignore connection test params. | 1525 | * do not silently ignore connection test params. |
1537 | */ | 1526 | */ |
1538 | if (test_flag >= 2 && | 1527 | if (test_flag >= 2 && server_match_spec_complete(connection_info) == 0) |
1539 | (test_user != NULL || test_host != NULL || test_addr != NULL) | ||
1540 | && (test_user == NULL || test_host == NULL || test_addr == NULL)) | ||
1541 | fatal("user, host and addr are all required when testing " | 1528 | fatal("user, host and addr are all required when testing " |
1542 | "Match configs"); | 1529 | "Match configs"); |
1543 | if (test_flag < 2 && (test_user != NULL || test_host != NULL || | 1530 | if (test_flag < 2 && server_match_spec_complete(connection_info) >= 0) |
1544 | test_addr != NULL)) | ||
1545 | fatal("Config test connection parameter (-C) provided without " | 1531 | fatal("Config test connection parameter (-C) provided without " |
1546 | "test mode (-T)"); | 1532 | "test mode (-T)"); |
1547 | 1533 | ||
@@ -1553,7 +1539,7 @@ main(int ac, char **av) | |||
1553 | load_server_config(config_file_name, &cfg); | 1539 | load_server_config(config_file_name, &cfg); |
1554 | 1540 | ||
1555 | parse_server_config(&options, rexeced_flag ? "rexec" : config_file_name, | 1541 | parse_server_config(&options, rexeced_flag ? "rexec" : config_file_name, |
1556 | &cfg, NULL, NULL, NULL); | 1542 | &cfg, NULL); |
1557 | 1543 | ||
1558 | seed_rng(); | 1544 | seed_rng(); |
1559 | 1545 | ||
@@ -1715,9 +1701,8 @@ main(int ac, char **av) | |||
1715 | } | 1701 | } |
1716 | 1702 | ||
1717 | if (test_flag > 1) { | 1703 | if (test_flag > 1) { |
1718 | if (test_user != NULL && test_addr != NULL && test_host != NULL) | 1704 | if (server_match_spec_complete(connection_info) == 1) |
1719 | parse_server_match_config(&options, test_user, | 1705 | parse_server_match_config(&options, connection_info); |
1720 | test_host, test_addr); | ||
1721 | dump_config(&options); | 1706 | dump_config(&options); |
1722 | } | 1707 | } |
1723 | 1708 | ||