aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
AgeCommit message (Collapse)AuthorFilesLines
2021-01-28config: Support more identity files in configurationJakub Jelen1-0/+1
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2020-11-03New API for parsing configuration from stringStanislav Zidek1-0/+54
Fixes T248 Signed-off-by: Stanislav Zidek <szidek@redhat.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2020-04-20config: Check null derefJakub Jelen1-0/+3
As reported by LGTM Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2019-12-09config: Ignore empty lines to avoid OOB array accessJakub Jelen1-0/+5
Fixes T187 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-10-01config: Implement match exec keywordJakub Jelen1-7/+136
The implementation does not work on Windows, where it still reports unsupported configuration option. On windows, separate code invoking subprocess needs to be implemented. Fixes T169 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2019-09-18config: Support match localuserJakub Jelen1-1/+23
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2019-09-18config: Make the matching case sensitive as documented in ssh_config manual ↵Jakub Jelen1-4/+1
pages > note that keywords are case-insensitive and arguments are case-sensitive Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2019-07-04config: Increase debug level for unkown and unsupported optionsAndreas Schneider1-4/+4
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
2019-06-14config: Replace long long with int64_tAnderson Toshiyuki Sasaki1-1/+1
Do not use long long as equivalent as int64_t. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-06-14config: Skip the rest of the line for Match execJakub Jelen1-0/+16
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-06-13config: Remove bogus trailing newlines in log messagesJakub Jelen1-3/+3
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-05-28config: Add missing NULL checkAndreas Schneider1-0/+4
CID 1398303 Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-05-14config: Add support for PubkeyAcceptedKeyTypesAnderson Toshiyuki Sasaki1-0/+1
The added option is an alias for the previously existing option PubkeyAcceptedTypes. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-04-01config: Move common parser functions to config_parser.cAnderson Toshiyuki Sasaki1-215/+1
This will allow the moved functions to be used in the server side configuration parser implementation. Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-03-25config: Use size_t instead of u_intAndreas Schneider1-1/+1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2019-02-22config: Avoid buffer overflowJakub Jelen1-0/+1
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24config: Add new Match final keyword from OpenSSH 8.0Jakub Jelen1-5/+16
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-24config: Fail if there is missing argument for some of the match keywordsJakub Jelen1-7/+16
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2019-01-09config: Parse rekey limits and apply themJakub Jelen1-1/+138
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Daiki Ueno <dueno@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-12-10config: Parse ProxyJump configuration option and implement it using ↵Jakub Jelen1-3/+223
ProxyCommand with OpenSSH Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-12-07config: Get rid of the dynamic seen arrayJakub Jelen1-65/+15
* This makes the array constant in the session structure, avoiding allocations and frees while parsing the file * It also drops passing the seen array to all the functions, because it is already part of the passed session * The test cases are adjusted to match these changes Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-12-07config: Reformat local_parse_fileJakub Jelen1-19/+25
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-12-07config: Reformat ssh_config_parse_fileJakub Jelen1-31/+39
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-11-30src: Fix multiple typosTilo Eckert1-1/+1
Signed-off-by: Tilo Eckert <tilo.eckert@flam.de> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-11-23config: Drop bogus newline in logJakub Jelen1-2/+2
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-11-02config: Avoid potential file descriptor leakJakub Jelen1-0/+1
Found by csbuild runner. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-11-02config: Preserve the seen array among invocationsJakub Jelen1-6/+23
This follows the OpenSSH behavior of parsing subseqent configuration files, while applying only the first option. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-25config: Fix building without globbing supportAndreas Schneider1-1/+1
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-17cmake: Correctly detect if glob has gl_flags memberAndreas Schneider1-2/+2
Thanks to Baruch Siach. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-06config: Fix size typeAndreas Schneider1-2/+3
src/config.c:562:12: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow] if (args < 1) { ^ Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-05config: Parse Match keywordJakub Jelen1-1/+164
Amends f818e63f8, which introduced the constants and matching of this configuration option, but did not implement the handling of the values which was causing the configuration parser failing for certain configurations. This commit exposes match_pattern_list() from match.c Red Hat Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1624425 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-09-05config: Do not overwrite previously matched result in Host blocksJakub Jelen1-5/+8
The match_hostname() expects comma separated list, while the Host config keyword in openssh uses spaces separated list by default. Therefore any subseqent match or negated match in space separated list will overwrite the previous matches. This also adjusts the tests to make sure both of the versions work. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-31config: Accept the PubkeyAcceptedTypes configuration optionJakub Jelen1-1/+8
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2018-08-16config: Do not access negative indexes of seen arrayJakub Jelen1-1/+2
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
2018-06-30config: Initialize glob_t with C99 initializerAndreas Schneider1-1/+3
Should fix a build warning on FreeBSD. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
2018-06-29Rest in Peace SSHv1Andreas Schneider1-3/+0
Signed-off-by: Andreas Schneider <asn@cryptomilk.org> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
2017-12-28config: Avoid long -> int -> long casting for timeout configuration optionJakub Jelen1-5/+6
Fixes: T80 Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-12-21config: Add CMake check for glob()Jakub Jelen1-1/+9
2017-12-21config: glob support for include with testNoName1151-1/+29
Signed-off-by: NoName115 <robert.kolcun@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-12-15config: support for MACsJakub Jelen1-0/+9
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-12-15config: Set global log level from configuration fileJakub Jelen1-5/+10
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-12-15config: Remove MAC option (SSHv1)Jakub Jelen1-9/+1
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-12-15config: Add configuration options from current OpenSSH 7.5 (and fix typos)Jakub Jelen1-13/+17
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-12-15Add new optionsAris Adamantiadis1-9/+185
Pair-Programmed-With: Jakub Jelen <jjelen@redhat.com> Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be> Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-09-11config: fix memory leak with repeated opcodesJon Simons1-0/+1
Fix a memory leak in the path where parsing returns early due to seeing a repeated opcode. A testcase is added which demonstrates the leak and fix with valgrind. Resolves CID 1374267. Signed-off-by: Jon Simons <jon@jonsimons.org>
2017-08-24config: add support for recursive including of filesNikos Mavrogiannopoulos1-2/+40
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-06-08config: fix buffer underflow with unrecognized opcodesAris Adamantiadis1-1/+1
2017-06-06config: Bugfix: Don't skip unseen opcodesArtyom V. Poptsov1-1/+1
libssh fails to read the configuration from a config file due to a wrong check in 'ssh_config_parse_line' procedure in 'config.c'; it's effectively skipping every opcode (and therefore every option) from the file. The change fixes that behaviour. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-04-13config: Only use first occurence of each parameterAlex Hermann1-2/+11
ssh_config's manpage says: "For each parameter, the first obtained value will be used." Make libssh adhere to this rule. BUG: https://red.libssh.org/issues/256 Signed-off-by: Alex Hermann <alex@hexla.nl> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
2017-04-13config: Don't expand Host variableAlex Hermann1-7/+1
Tokens are not allowed (according to the manpage). Expansion was introduced by a wrong fix for #127. This commit reverts part of 6eea08a9ef Signed-off-by: Alex Hermann <alex@hexla.nl> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>