summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-09-12 17:48:04 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-09-12 17:48:04 +0000
commit14f31ab947acd4c0b1698195782b904e0d6c7686 (patch)
tree616f6afce0f41100d67abb9564889d00aaaf08ec /ssh.c
parent525a09389e05c2134b41ccee87deae5cff31d66f (diff)
- markus@cvs.openbsd.org 2001/08/28 15:39:48
[ssh.1 ssh.c] allow: ssh -F configfile host
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/ssh.c b/ssh.c
index 09e4ee540..e20758785 100644
--- a/ssh.c
+++ b/ssh.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: ssh.c,v 1.138 2001/08/11 22:51:27 jakob Exp $"); 42RCSID("$OpenBSD: ssh.c,v 1.139 2001/08/28 15:39:48 markus Exp $");
43 43
44#include <openssl/evp.h> 44#include <openssl/evp.h>
45#include <openssl/err.h> 45#include <openssl/err.h>
@@ -118,6 +118,9 @@ int fork_after_authentication_flag = 0;
118 */ 118 */
119Options options; 119Options options;
120 120
121/* optional user configfile */
122char *config = NULL;
123
121/* 124/*
122 * Name of the host we are connecting to. This is the name given on the 125 * Name of the host we are connecting to. This is the name given on the
123 * command line, or the HostName specified for the user-supplied name in a 126 * command line, or the HostName specified for the user-supplied name in a
@@ -160,6 +163,8 @@ usage(void)
160 fprintf(stderr, "Options:\n"); 163 fprintf(stderr, "Options:\n");
161 fprintf(stderr, " -l user Log in using this user name.\n"); 164 fprintf(stderr, " -l user Log in using this user name.\n");
162 fprintf(stderr, " -n Redirect input from " _PATH_DEVNULL ".\n"); 165 fprintf(stderr, " -n Redirect input from " _PATH_DEVNULL ".\n");
166 fprintf(stderr, " -F config Config file (default: ~/%s).\n",
167 _PATH_SSH_USER_CONFFILE);
163 fprintf(stderr, " -A Enable authentication agent forwarding.\n"); 168 fprintf(stderr, " -A Enable authentication agent forwarding.\n");
164 fprintf(stderr, " -a Disable authentication agent forwarding (default).\n"); 169 fprintf(stderr, " -a Disable authentication agent forwarding (default).\n");
165#ifdef AFS 170#ifdef AFS
@@ -315,7 +320,7 @@ main(int ac, char **av)
315 320
316again: 321again:
317 while ((opt = getopt(ac, av, 322 while ((opt = getopt(ac, av,
318 "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:I:L:NPR:TVX")) != -1) { 323 "1246ab:c:e:fgi:kl:m:no:p:qstvxACD:F:I:L:NPR:TVX")) != -1) {
319 switch (opt) { 324 switch (opt) {
320 case '1': 325 case '1':
321 options.protocol = SSH_PROTO_1; 326 options.protocol = SSH_PROTO_1;
@@ -525,6 +530,9 @@ again:
525 case 'b': 530 case 'b':
526 options.bind_address = optarg; 531 options.bind_address = optarg;
527 break; 532 break;
533 case 'F':
534 config = optarg;
535 break;
528 default: 536 default:
529 usage(); 537 usage();
530 } 538 }
@@ -609,12 +617,20 @@ again:
609 log_init(av[0], options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level, 617 log_init(av[0], options.log_level == -1 ? SYSLOG_LEVEL_INFO : options.log_level,
610 SYSLOG_FACILITY_USER, 1); 618 SYSLOG_FACILITY_USER, 1);
611 619
612 /* Read per-user configuration file. */ 620 /*
613 snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir, _PATH_SSH_USER_CONFFILE); 621 * Read per-user configuration file. Ignore the system wide config
614 read_config_file(buf, host, &options); 622 * file if the user specifies a config file on the command line.
615 623 */
616 /* Read systemwide configuration file. */ 624 if (config != NULL) {
617 read_config_file(_PATH_HOST_CONFIG_FILE, host, &options); 625 read_config_file(config, host, &options);
626 } else {
627 snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir,
628 _PATH_SSH_USER_CONFFILE);
629
630 /* Read systemwide configuration file. */
631 read_config_file(_PATH_HOST_CONFIG_FILE, host, &options);
632 read_config_file(buf, host, &options);
633 }
618 634
619 /* Fill configuration defaults. */ 635 /* Fill configuration defaults. */
620 fill_default_options(&options); 636 fill_default_options(&options);