version 1.357, 2008/05/08 12:02:23 |
version 1.358, 2008/06/10 04:50:25 |
|
|
int opt, i, on = 1; |
int opt, i, on = 1; |
int sock_in = -1, sock_out = -1, newsock = -1; |
int sock_in = -1, sock_out = -1, newsock = -1; |
const char *remote_ip; |
const char *remote_ip; |
|
char *test_user = NULL, *test_host = NULL, *test_addr = NULL; |
int remote_port; |
int remote_port; |
char *line; |
char *line, *p, *cp; |
int config_s[2] = { -1 , -1 }; |
int config_s[2] = { -1 , -1 }; |
Key *key; |
Key *key; |
Authctxt *authctxt; |
Authctxt *authctxt; |
|
|
initialize_server_options(&options); |
initialize_server_options(&options); |
|
|
/* Parse command-line arguments. */ |
/* Parse command-line arguments. */ |
while ((opt = getopt(ac, av, "f:p:b:k:h:g:u:o:dDeiqrtQR46")) != -1) { |
while ((opt = getopt(ac, av, "f:p:b:k:h:g:u:o:C:dDeiqrtQRT46")) != -1) { |
switch (opt) { |
switch (opt) { |
case '4': |
case '4': |
options.address_family = AF_INET; |
options.address_family = AF_INET; |
|
|
case 't': |
case 't': |
test_flag = 1; |
test_flag = 1; |
break; |
break; |
|
case 'T': |
|
test_flag = 2; |
|
break; |
|
case 'C': |
|
cp = optarg; |
|
while ((p = strsep(&cp, ",")) && *p != '\0') { |
|
if (strncmp(p, "addr=", 5) == 0) |
|
test_addr = xstrdup(p + 5); |
|
else if (strncmp(p, "host=", 5) == 0) |
|
test_host = xstrdup(p + 5); |
|
else if (strncmp(p, "user=", 5) == 0) |
|
test_user = xstrdup(p + 5); |
|
else { |
|
fprintf(stderr, "Invalid test " |
|
"mode specification %s\n", p); |
|
exit(1); |
|
} |
|
} |
|
break; |
case 'u': |
case 'u': |
utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL); |
utmp_len = (u_int)strtonum(optarg, 0, MAXHOSTNAMELEN+1, NULL); |
if (utmp_len > MAXHOSTNAMELEN) { |
if (utmp_len > MAXHOSTNAMELEN) { |
|
|
sensitive_data.have_ssh1_key = 0; |
sensitive_data.have_ssh1_key = 0; |
sensitive_data.have_ssh2_key = 0; |
sensitive_data.have_ssh2_key = 0; |
|
|
|
/* |
|
* If we're doing an extended config test, make sure we have all of |
|
* the parameters we need. If we're not doing an extended test, |
|
* do not silently ignore connection test params. |
|
*/ |
|
if (test_flag >= 2 && (test_user != NULL || test_host != NULL || test_addr != NULL) |
|
&& (test_user == NULL || test_host == NULL || test_addr == NULL)) |
|
fatal("user, host and addr are all required when testing " |
|
"Match configs"); |
|
if (test_flag < 2 && (test_user != NULL || test_host != NULL || |
|
test_addr != NULL)) |
|
fatal("Config test connection parameter (-C) provided without " |
|
"test mode (-T)"); |
|
|
/* Fetch our configuration */ |
/* Fetch our configuration */ |
buffer_init(&cfg); |
buffer_init(&cfg); |
if (rexeced_flag) |
if (rexeced_flag) |
|
|
if (st.st_uid != 0 || (st.st_mode & (S_IWGRP|S_IWOTH)) != 0) |
if (st.st_uid != 0 || (st.st_mode & (S_IWGRP|S_IWOTH)) != 0) |
fatal("%s must be owned by root and not group or " |
fatal("%s must be owned by root and not group or " |
"world-writable.", _PATH_PRIVSEP_CHROOT_DIR); |
"world-writable.", _PATH_PRIVSEP_CHROOT_DIR); |
|
} |
|
|
|
if (test_flag > 1) { |
|
if (test_user != NULL && test_addr != NULL && test_host != NULL) |
|
parse_server_match_config(&options, test_user, |
|
test_host, test_addr); |
|
dump_config(&options); |
} |
} |
|
|
/* Configuration looks good, so exit if in test mode. */ |
/* Configuration looks good, so exit if in test mode. */ |