summaryrefslogtreecommitdiff
path: root/readconf.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2000-04-29 23:57:08 +1000
committerDamien Miller <djm@mindrot.org>2000-04-29 23:57:08 +1000
commiteba71bab9bf01c0d688f829a8971f902732558df (patch)
treea9d5b50568bfc10cc50291fd3604debfaf3e3783 /readconf.c
parent8117111a3c1360727e3c54aad31aa045e7a7871b (diff)
- Merge big update to OpenSSH-2.0 from OpenBSD CVS
[README.openssh2] - interop w/ F-secure windows client - sync documentation - ssh_host_dsa_key not ssh_dsa_key [auth-rsa.c] - missing fclose [auth.c authfile.c compat.c dsa.c dsa.h hostfile.c key.c key.h radix.c] [readconf.c readconf.h ssh-add.c ssh-keygen.c ssh.c ssh.h sshconnect.c] [sshd.c uuencode.c uuencode.h authfile.h] - add DSA pubkey auth and other SSH2 fixes. use ssh-keygen -[xX] for trading keys with the real and the original SSH, directly from the people who invented the SSH protocol. [auth.c auth.h authfile.c sshconnect.c auth1.c auth2.c sshconnect.h] [sshconnect1.c sshconnect2.c] - split auth/sshconnect in one file per protocol version [sshconnect2.c] - remove debug [uuencode.c] - add trailing = [version.h] - OpenSSH-2.0 [ssh-keygen.1 ssh-keygen.c] - add -R flag: exit code indicates if RSA is alive [sshd.c] - remove unused silent if -Q is specified [ssh.h] - host key becomes /etc/ssh_host_dsa_key [readconf.c servconf.c ] - ssh/sshd default to proto 1 and 2 [uuencode.c] - remove debug [auth2.c ssh-keygen.c sshconnect2.c sshd.c] - xfree DSA blobs [auth2.c serverloop.c session.c] - cleanup logging for sshd/2, respect PasswordAuth no [sshconnect2.c] - less debug, respect .ssh/config [README.openssh2 channels.c channels.h] - clientloop.c session.c ssh.c - support for x11-fwding, client+server
Diffstat (limited to 'readconf.c')
-rw-r--r--readconf.c45
1 files changed, 40 insertions, 5 deletions
diff --git a/readconf.c b/readconf.c
index 3b75290f3..529f8039b 100644
--- a/readconf.c
+++ b/readconf.c
@@ -14,7 +14,7 @@
14 */ 14 */
15 15
16#include "includes.h" 16#include "includes.h"
17RCSID("$Id: readconf.c,v 1.11 2000/04/16 01:18:44 damien Exp $"); 17RCSID("$Id: readconf.c,v 1.12 2000/04/29 13:57:11 damien Exp $");
18 18
19#include "ssh.h" 19#include "ssh.h"
20#include "cipher.h" 20#include "cipher.h"
@@ -104,7 +104,8 @@ typedef enum {
104 oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts, 104 oGlobalKnownHostsFile, oUserKnownHostsFile, oConnectionAttempts,
105 oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression, 105 oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression,
106 oCompressionLevel, oKeepAlives, oNumberOfPasswordPrompts, oTISAuthentication, 106 oCompressionLevel, oKeepAlives, oNumberOfPasswordPrompts, oTISAuthentication,
107 oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol 107 oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oIdentityFile2,
108 oGlobalKnownHostsFile2, oUserKnownHostsFile2
108} OpCodes; 109} OpCodes;
109 110
110/* Textual representations of the tokens. */ 111/* Textual representations of the tokens. */
@@ -131,6 +132,7 @@ static struct {
131 { "fallbacktorsh", oFallBackToRsh }, 132 { "fallbacktorsh", oFallBackToRsh },
132 { "usersh", oUseRsh }, 133 { "usersh", oUseRsh },
133 { "identityfile", oIdentityFile }, 134 { "identityfile", oIdentityFile },
135 { "identityfile2", oIdentityFile2 },
134 { "hostname", oHostName }, 136 { "hostname", oHostName },
135 { "proxycommand", oProxyCommand }, 137 { "proxycommand", oProxyCommand },
136 { "port", oPort }, 138 { "port", oPort },
@@ -145,6 +147,8 @@ static struct {
145 { "rhostsrsaauthentication", oRhostsRSAAuthentication }, 147 { "rhostsrsaauthentication", oRhostsRSAAuthentication },
146 { "globalknownhostsfile", oGlobalKnownHostsFile }, 148 { "globalknownhostsfile", oGlobalKnownHostsFile },
147 { "userknownhostsfile", oUserKnownHostsFile }, 149 { "userknownhostsfile", oUserKnownHostsFile },
150 { "globalknownhostsfile2", oGlobalKnownHostsFile2 },
151 { "userknownhostsfile2", oUserKnownHostsFile2 },
148 { "connectionattempts", oConnectionAttempts }, 152 { "connectionattempts", oConnectionAttempts },
149 { "batchmode", oBatchMode }, 153 { "batchmode", oBatchMode },
150 { "checkhostip", oCheckHostIP }, 154 { "checkhostip", oCheckHostIP },
@@ -368,14 +372,22 @@ parse_flag:
368 goto parse_int; 372 goto parse_int;
369 373
370 case oIdentityFile: 374 case oIdentityFile:
375 case oIdentityFile2:
371 cp = strtok(NULL, WHITESPACE); 376 cp = strtok(NULL, WHITESPACE);
372 if (!cp) 377 if (!cp)
373 fatal("%.200s line %d: Missing argument.", filename, linenum); 378 fatal("%.200s line %d: Missing argument.", filename, linenum);
374 if (*activep) { 379 if (*activep) {
375 if (options->num_identity_files >= SSH_MAX_IDENTITY_FILES) 380 intptr = (opcode == oIdentityFile) ?
381 &options->num_identity_files :
382 &options->num_identity_files2;
383 if (*intptr >= SSH_MAX_IDENTITY_FILES)
376 fatal("%.200s line %d: Too many identity files specified (max %d).", 384 fatal("%.200s line %d: Too many identity files specified (max %d).",
377 filename, linenum, SSH_MAX_IDENTITY_FILES); 385 filename, linenum, SSH_MAX_IDENTITY_FILES);
378 options->identity_files[options->num_identity_files++] = xstrdup(cp); 386 charptr = (opcode == oIdentityFile) ?
387 &options->identity_files[*intptr] :
388 &options->identity_files2[*intptr];
389 *charptr = xstrdup(cp);
390 *intptr = *intptr + 1;
379 } 391 }
380 break; 392 break;
381 393
@@ -397,6 +409,14 @@ parse_string:
397 charptr = &options->user_hostfile; 409 charptr = &options->user_hostfile;
398 goto parse_string; 410 goto parse_string;
399 411
412 case oGlobalKnownHostsFile2:
413 charptr = &options->system_hostfile2;
414 goto parse_string;
415
416 case oUserKnownHostsFile2:
417 charptr = &options->user_hostfile2;
418 goto parse_string;
419
400 case oHostName: 420 case oHostName:
401 charptr = &options->hostname; 421 charptr = &options->hostname;
402 goto parse_string; 422 goto parse_string;
@@ -642,12 +662,15 @@ initialize_options(Options * options)
642 options->ciphers = NULL; 662 options->ciphers = NULL;
643 options->protocol = SSH_PROTO_UNKNOWN; 663 options->protocol = SSH_PROTO_UNKNOWN;
644 options->num_identity_files = 0; 664 options->num_identity_files = 0;
665 options->num_identity_files2 = 0;
645 options->hostname = NULL; 666 options->hostname = NULL;
646 options->proxy_command = NULL; 667 options->proxy_command = NULL;
647 options->user = NULL; 668 options->user = NULL;
648 options->escape_char = -1; 669 options->escape_char = -1;
649 options->system_hostfile = NULL; 670 options->system_hostfile = NULL;
650 options->user_hostfile = NULL; 671 options->user_hostfile = NULL;
672 options->system_hostfile2 = NULL;
673 options->user_hostfile2 = NULL;
651 options->num_local_forwards = 0; 674 options->num_local_forwards = 0;
652 options->num_remote_forwards = 0; 675 options->num_remote_forwards = 0;
653 options->log_level = (LogLevel) - 1; 676 options->log_level = (LogLevel) - 1;
@@ -715,19 +738,31 @@ fill_default_options(Options * options)
715 if (options->cipher == -1) 738 if (options->cipher == -1)
716 options->cipher = SSH_CIPHER_NOT_SET; 739 options->cipher = SSH_CIPHER_NOT_SET;
717 if (options->protocol == SSH_PROTO_UNKNOWN) 740 if (options->protocol == SSH_PROTO_UNKNOWN)
718 options->protocol = SSH_PROTO_1; 741 options->protocol = SSH_PROTO_1|SSH_PROTO_2|SSH_PROTO_1_PREFERRED;
719 if (options->num_identity_files == 0) { 742 if (options->num_identity_files == 0) {
720 options->identity_files[0] = 743 options->identity_files[0] =
721 xmalloc(2 + strlen(SSH_CLIENT_IDENTITY) + 1); 744 xmalloc(2 + strlen(SSH_CLIENT_IDENTITY) + 1);
722 sprintf(options->identity_files[0], "~/%.100s", SSH_CLIENT_IDENTITY); 745 sprintf(options->identity_files[0], "~/%.100s", SSH_CLIENT_IDENTITY);
723 options->num_identity_files = 1; 746 options->num_identity_files = 1;
724 } 747 }
748#if 0
749 if (options->num_identity_files2 == 0) {
750 options->identity_files2[0] =
751 xmalloc(2 + strlen(SSH2_CLIENT_IDENTITY) + 1);
752 sprintf(options->identity_files2[0], "~/%.100s", SSH2_CLIENT_IDENTITY);
753 options->num_identity_files2 = 1;
754 }
755#endif
725 if (options->escape_char == -1) 756 if (options->escape_char == -1)
726 options->escape_char = '~'; 757 options->escape_char = '~';
727 if (options->system_hostfile == NULL) 758 if (options->system_hostfile == NULL)
728 options->system_hostfile = SSH_SYSTEM_HOSTFILE; 759 options->system_hostfile = SSH_SYSTEM_HOSTFILE;
729 if (options->user_hostfile == NULL) 760 if (options->user_hostfile == NULL)
730 options->user_hostfile = SSH_USER_HOSTFILE; 761 options->user_hostfile = SSH_USER_HOSTFILE;
762 if (options->system_hostfile2 == NULL)
763 options->system_hostfile2 = SSH_SYSTEM_HOSTFILE2;
764 if (options->user_hostfile2 == NULL)
765 options->user_hostfile2 = SSH_USER_HOSTFILE2;
731 if (options->log_level == (LogLevel) - 1) 766 if (options->log_level == (LogLevel) - 1)
732 options->log_level = SYSLOG_LEVEL_INFO; 767 options->log_level = SYSLOG_LEVEL_INFO;
733 /* options->proxy_command should not be set by default */ 768 /* options->proxy_command should not be set by default */