Deleted Added
full compact
readconf.c (98684) readconf.c (98941)
1/*
2 * Author: Tatu Ylonen <ylo@cs.hut.fi>
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved
5 * Functions for reading the configuration files.
6 *
7 * As far as I am concerned, the code I have written for this software
8 * can be used freely for any purpose. Any derived versions of this
9 * software must be clearly marked as such, and if the derived work is
10 * incompatible with the protocol description in the RFC file, it must be
11 * called by a name other than "ssh" or "Secure Shell".
12 */
13
14#include "includes.h"
15RCSID("$OpenBSD: readconf.c,v 1.100 2002/06/19 00:27:55 deraadt Exp $");
1/*
2 * Author: Tatu Ylonen <ylo@cs.hut.fi>
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved
5 * Functions for reading the configuration files.
6 *
7 * As far as I am concerned, the code I have written for this software
8 * can be used freely for any purpose. Any derived versions of this
9 * software must be clearly marked as such, and if the derived work is
10 * incompatible with the protocol description in the RFC file, it must be
11 * called by a name other than "ssh" or "Secure Shell".
12 */
13
14#include "includes.h"
15RCSID("$OpenBSD: readconf.c,v 1.100 2002/06/19 00:27:55 deraadt Exp $");
16RCSID("$FreeBSD: head/crypto/openssh/readconf.c 98684 2002-06-23 16:09:08Z des $");
17
18#include "ssh.h"
19#include "xmalloc.h"
20#include "compat.h"
21#include "cipher.h"
22#include "pathnames.h"
23#include "log.h"
24#include "readconf.h"

--- 85 unchanged lines hidden (view full) ---

110 oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression,
111 oCompressionLevel, oKeepAlives, oNumberOfPasswordPrompts,
112 oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oMacs,
113 oGlobalKnownHostsFile2, oUserKnownHostsFile2, oPubkeyAuthentication,
114 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias,
115 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication,
116 oHostKeyAlgorithms, oBindAddress, oSmartcardDevice,
117 oClearAllForwardings, oNoHostAuthenticationForLocalhost,
16
17#include "ssh.h"
18#include "xmalloc.h"
19#include "compat.h"
20#include "cipher.h"
21#include "pathnames.h"
22#include "log.h"
23#include "readconf.h"

--- 85 unchanged lines hidden (view full) ---

109 oBatchMode, oCheckHostIP, oStrictHostKeyChecking, oCompression,
110 oCompressionLevel, oKeepAlives, oNumberOfPasswordPrompts,
111 oUsePrivilegedPort, oLogLevel, oCiphers, oProtocol, oMacs,
112 oGlobalKnownHostsFile2, oUserKnownHostsFile2, oPubkeyAuthentication,
113 oKbdInteractiveAuthentication, oKbdInteractiveDevices, oHostKeyAlias,
114 oDynamicForward, oPreferredAuthentications, oHostbasedAuthentication,
115 oHostKeyAlgorithms, oBindAddress, oSmartcardDevice,
116 oClearAllForwardings, oNoHostAuthenticationForLocalhost,
118 oVersionAddendum,
119 oDeprecated
120} OpCodes;
121
122/* Textual representations of the tokens. */
123
124static struct {
125 const char *name;
126 OpCodes opcode;

--- 56 unchanged lines hidden (view full) ---

183 { "loglevel", oLogLevel },
184 { "dynamicforward", oDynamicForward },
185 { "preferredauthentications", oPreferredAuthentications },
186 { "hostkeyalgorithms", oHostKeyAlgorithms },
187 { "bindaddress", oBindAddress },
188 { "smartcarddevice", oSmartcardDevice },
189 { "clearallforwardings", oClearAllForwardings },
190 { "nohostauthenticationforlocalhost", oNoHostAuthenticationForLocalhost },
117 oDeprecated
118} OpCodes;
119
120/* Textual representations of the tokens. */
121
122static struct {
123 const char *name;
124 OpCodes opcode;

--- 56 unchanged lines hidden (view full) ---

181 { "loglevel", oLogLevel },
182 { "dynamicforward", oDynamicForward },
183 { "preferredauthentications", oPreferredAuthentications },
184 { "hostkeyalgorithms", oHostKeyAlgorithms },
185 { "bindaddress", oBindAddress },
186 { "smartcarddevice", oSmartcardDevice },
187 { "clearallforwardings", oClearAllForwardings },
188 { "nohostauthenticationforlocalhost", oNoHostAuthenticationForLocalhost },
191 { "versionaddendum", oVersionAddendum },
192 { NULL, oBadOption }
193};
194
195/*
196 * Adds a local TCP/IP port forward to options. Never returns if there is an
197 * error.
198 */
199
200void
201add_local_forward(Options *options, u_short port, const char *host,
202 u_short host_port)
203{
204 Forward *fwd;
189 { NULL, oBadOption }
190};
191
192/*
193 * Adds a local TCP/IP port forward to options. Never returns if there is an
194 * error.
195 */
196
197void
198add_local_forward(Options *options, u_short port, const char *host,
199 u_short host_port)
200{
201 Forward *fwd;
202#ifndef HAVE_CYGWIN
205 extern uid_t original_real_uid;
206 if (port < IPPORT_RESERVED && original_real_uid != 0)
207 fatal("Privileged ports can only be forwarded by root.");
203 extern uid_t original_real_uid;
204 if (port < IPPORT_RESERVED && original_real_uid != 0)
205 fatal("Privileged ports can only be forwarded by root.");
206#endif
208 if (options->num_local_forwards >= SSH_MAX_FORWARDS_PER_DIRECTION)
209 fatal("Too many local forwards (max %d).", SSH_MAX_FORWARDS_PER_DIRECTION);
210 fwd = &options->local_forwards[options->num_local_forwards++];
211 fwd->port = port;
212 fwd->host = xstrdup(host);
213 fwd->host_port = host_port;
214}
215

--- 449 unchanged lines hidden (view full) ---

665 filename, linenum);
666 /* NOTREACHED */
667 value = 0; /* Avoid compiler warning. */
668 }
669 if (*activep && *intptr == -1)
670 *intptr = value;
671 break;
672
207 if (options->num_local_forwards >= SSH_MAX_FORWARDS_PER_DIRECTION)
208 fatal("Too many local forwards (max %d).", SSH_MAX_FORWARDS_PER_DIRECTION);
209 fwd = &options->local_forwards[options->num_local_forwards++];
210 fwd->port = port;
211 fwd->host = xstrdup(host);
212 fwd->host_port = host_port;
213}
214

--- 449 unchanged lines hidden (view full) ---

664 filename, linenum);
665 /* NOTREACHED */
666 value = 0; /* Avoid compiler warning. */
667 }
668 if (*activep && *intptr == -1)
669 *intptr = value;
670 break;
671
673 case oVersionAddendum:
674 ssh_version_set_addendum(strtok(s, "\n"));
675 do {
676 arg = strdelim(&s);
677 } while (arg != NULL && *arg != '\0');
678 break;
679
680 case oDeprecated:
681 debug("%s line %d: Deprecated option \"%s\"",
682 filename, linenum, keyword);
683 return 0;
684
685 default:
686 fatal("process_config_line: Unimplemented opcode %d", opcode);
687 }

--- 161 unchanged lines hidden (view full) ---

849 options->kbd_interactive_authentication = 1;
850 if (options->rhosts_rsa_authentication == -1)
851 options->rhosts_rsa_authentication = 0;
852 if (options->hostbased_authentication == -1)
853 options->hostbased_authentication = 0;
854 if (options->batch_mode == -1)
855 options->batch_mode = 0;
856 if (options->check_host_ip == -1)
672 case oDeprecated:
673 debug("%s line %d: Deprecated option \"%s\"",
674 filename, linenum, keyword);
675 return 0;
676
677 default:
678 fatal("process_config_line: Unimplemented opcode %d", opcode);
679 }

--- 161 unchanged lines hidden (view full) ---

841 options->kbd_interactive_authentication = 1;
842 if (options->rhosts_rsa_authentication == -1)
843 options->rhosts_rsa_authentication = 0;
844 if (options->hostbased_authentication == -1)
845 options->hostbased_authentication = 0;
846 if (options->batch_mode == -1)
847 options->batch_mode = 0;
848 if (options->check_host_ip == -1)
857 options->check_host_ip = 0;
849 options->check_host_ip = 1;
858 if (options->strict_host_key_checking == -1)
859 options->strict_host_key_checking = 2; /* 2 is default */
860 if (options->compression == -1)
861 options->compression = 0;
862 if (options->keepalives == -1)
863 options->keepalives = 1;
864 if (options->compression_level == -1)
865 options->compression_level = 6;

--- 58 unchanged lines hidden ---
850 if (options->strict_host_key_checking == -1)
851 options->strict_host_key_checking = 2; /* 2 is default */
852 if (options->compression == -1)
853 options->compression = 0;
854 if (options->keepalives == -1)
855 options->keepalives = 1;
856 if (options->compression_level == -1)
857 options->compression_level = 6;

--- 58 unchanged lines hidden ---