diff options
author | Damien Miller <djm@mindrot.org> | 2013-10-15 12:13:05 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2013-10-15 12:13:05 +1100 |
commit | 194fd904d8597a274b93e075b2047afdf5a175d4 (patch) | |
tree | e8bd17b8455a41b3dc493b2b69933b8ef0cbfff7 /ssh.c | |
parent | 71df752de2a04f423b1cd18d961a79f4fbccbcee (diff) | |
download | openssh-git-194fd904d8597a274b93e075b2047afdf5a175d4.tar.gz |
- djm@cvs.openbsd.org 2013/10/14 22:22:05
[readconf.c readconf.h ssh-keysign.c ssh.c ssh_config.5]
add a "Match" keyword to ssh_config that allows matching on hostname,
user and result of arbitrary commands. "nice work" markus@
Diffstat (limited to 'ssh.c')
-rw-r--r-- | ssh.c | 22 |
1 files changed, 10 insertions, 12 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: ssh.c,v 1.381 2013/07/25 00:29:10 djm Exp $ */ +/* $OpenBSD: ssh.c,v 1.382 2013/10/14 22:22:04 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -242,7 +242,7 @@ main(int ac, char **av) char thishost[NI_MAXHOST], shorthost[NI_MAXHOST], portstr[NI_MAXSERV]; struct stat st; struct passwd *pw; - int dummy, timeout_ms; + int timeout_ms; extern int optind, optreset; extern char *optarg; @@ -595,10 +595,9 @@ main(int ac, char **av) options.request_tty = REQUEST_TTY_NO; break; case 'o': - dummy = 1; line = xstrdup(optarg); - if (process_config_line(&options, host ? host : "", - line, "command-line", 0, &dummy, SSHCONF_USERCONF) + if (process_config_line(&options, pw, host ? host : "", + line, "command-line", 0, NULL, SSHCONF_USERCONF) != 0) exit(255); free(line); @@ -703,18 +702,19 @@ main(int ac, char **av) */ if (config != NULL) { if (strcasecmp(config, "none") != 0 && - !read_config_file(config, host, &options, SSHCONF_USERCONF)) + !read_config_file(config, pw, host, &options, + SSHCONF_USERCONF)) fatal("Can't open user config file %.100s: " "%.100s", config, strerror(errno)); } else { r = snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, _PATH_SSH_USER_CONFFILE); if (r > 0 && (size_t)r < sizeof(buf)) - (void)read_config_file(buf, host, &options, + (void)read_config_file(buf, pw, host, &options, SSHCONF_CHECKPERM|SSHCONF_USERCONF); /* Read systemwide configuration file after user config. */ - (void)read_config_file(_PATH_HOST_CONFIG_FILE, host, + (void)read_config_file(_PATH_HOST_CONFIG_FILE, pw, host, &options, 0); } @@ -752,10 +752,8 @@ main(int ac, char **av) options.user = xstrdup(pw->pw_name); /* Get default port if port has not been set. */ - if (options.port == 0) { - sp = getservbyname(SSH_SERVICE_NAME, "tcp"); - options.port = sp ? ntohs(sp->s_port) : SSH_DEFAULT_PORT; - } + if (options.port == 0) + options.port = default_ssh_port(); /* preserve host name given on command line for %n expansion */ host_arg = host; |