Bugzilla – Attachment 2252 Details for
Bug 866
ssh(1) is too picky about unknown options in ~/.ssh/config
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
add ability to selectively ignore unknown options
ignoreunknown.diff (text/plain), 4.38 KB, created by
Damien Miller
on 2013-04-19 13:20:17 AEST
(
hide
)
Description:
add ability to selectively ignore unknown options
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2013-04-19 13:20:17 AEST
Size:
4.38 KB
patch
obsolete
>Index: readconf.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/readconf.c,v >retrieving revision 1.197 >diff -u -p -r1.197 readconf.c >--- readconf.c 6 Mar 2013 23:36:53 -0000 1.197 >+++ readconf.c 19 Apr 2013 03:19:09 -0000 >@@ -131,8 +131,8 @@ typedef enum { > oHashKnownHosts, > oTunnel, oTunnelDevice, oLocalCommand, oPermitLocalCommand, > oVisualHostKey, oUseRoaming, oZeroKnowledgePasswordAuthentication, >- oKexAlgorithms, oIPQoS, oRequestTTY, >- oDeprecated, oUnsupported >+ oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, >+ oIgnoredUnknownOption, oDeprecated, oUnsupported > } OpCodes; > > /* Textual representations of the tokens. */ >@@ -243,6 +243,7 @@ static struct { > { "kexalgorithms", oKexAlgorithms }, > { "ipqos", oIPQoS }, > { "requesttty", oRequestTTY }, >+ { "ignoreunknown", oIgnoreUnknown }, > > { NULL, oBadOption } > }; >@@ -347,14 +348,17 @@ add_identity_file(Options *options, cons > */ > > static OpCodes >-parse_token(const char *cp, const char *filename, int linenum) >+parse_token(const char *cp, const char *filename, int linenum, >+ const char *ignored_unknown) > { >- u_int i; >+ int i; > > for (i = 0; keywords[i].name; i++) >- if (strcasecmp(cp, keywords[i].name) == 0) >+ if (strcmp(cp, keywords[i].name) == 0) > return keywords[i].opcode; >- >+ if (ignored_unknown != NULL && match_pattern_list(cp, ignored_unknown, >+ strlen(ignored_unknown), 1) == 1) >+ return oIgnoredUnknownOption; > error("%s: line %d: Bad configuration option: %s", > filename, linenum, cp); > return oBadOption; >@@ -373,7 +377,7 @@ process_config_line(Options *options, co > { > char *s, **charptr, *endofnumber, *keyword, *arg, *arg2; > char **cpptr, fwdarg[256]; >- u_int *uintptr, max_entries = 0; >+ u_int i, *uintptr, max_entries = 0; > int negated, opcode, *intptr, value, value2, scale; > LogLevel *log_level_ptr; > long long orig, val64; >@@ -396,14 +400,22 @@ process_config_line(Options *options, co > keyword = strdelim(&s); > if (keyword == NULL || !*keyword || *keyword == '\n' || *keyword == '#') > return 0; >+ /* Match lowercase keyword */ >+ for (i = 0; i < strlen(keyword); i++) >+ keyword[i] = tolower(keyword[i]); > >- opcode = parse_token(keyword, filename, linenum); >+ opcode = parse_token(keyword, filename, linenum, >+ options->ignored_unknown); > > switch (opcode) { > case oBadOption: > /* don't panic, but count bad options */ > return -1; > /* NOTREACHED */ >+ case oIgnoredUnknownOption: >+ debug("%s line %d: Ignored unknown option \"%s\"", >+ filename, linenum, keyword); >+ return 0; > case oConnectTimeout: > intptr = &options->connection_timeout; > parse_time: >@@ -1058,6 +1070,10 @@ parse_int: > *intptr = value; > break; > >+ case oIgnoreUnknown: >+ charptr = &options->ignored_unknown; >+ goto parse_string; >+ > case oDeprecated: > debug("%s line %d: Deprecated option \"%s\"", > filename, linenum, keyword); >@@ -1218,6 +1234,7 @@ initialize_options(Options * options) > options->ip_qos_interactive = -1; > options->ip_qos_bulk = -1; > options->request_tty = -1; >+ options->ignored_unknown = NULL; > } > > /* >Index: readconf.h >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/readconf.h,v >retrieving revision 1.93 >diff -u -p -r1.93 readconf.h >--- readconf.h 22 Feb 2013 04:45:09 -0000 1.93 >+++ readconf.h 19 Apr 2013 03:19:09 -0000 >@@ -136,6 +136,8 @@ typedef struct { > int use_roaming; > > int request_tty; >+ >+ char *ignored_unknown; /* Pattern list of unknown tokens to ignore */ > } Options; > > #define SSHCTL_MASTER_NO 0 >Index: ssh_config.5 >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/ssh_config.5,v >retrieving revision 1.161 >diff -u -p -r1.161 ssh_config.5 >--- ssh_config.5 8 Jan 2013 18:49:04 -0000 1.161 >+++ ssh_config.5 19 Apr 2013 03:19:09 -0000 >@@ -597,6 +597,17 @@ The default is the name given on the com > Numeric IP addresses are also permitted (both on the command line and in > .Cm HostName > specifications). >+.It Cm IgnoreUnknown >+Specifies a pattern-list of unknown options to be ignored if they are >+encountered in configuration parsing. >+This may be used to suppress errors if >+.Nm >+contains options that are unrecognised by >+.Xr ssh 1 . >+It is recommended that >+.Cm IgnoreUnknown >+be listed early in the configuration file as it will not be applied >+to unknown options that appear before it. > .It Cm IdentitiesOnly > Specifies that > .Xr ssh 1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 866
:
1610
| 2252