Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
The support for the .netrc file requires a certain file format, i.e. one line per host with all information on it. This is an unnecessary limitation as the netrc file would also support the format:
machine host
login user
password secret
which is a format used by many users but not supported by the git client plugin. Also the parser breaks easily as it requires exactly one space between the fields.
Additionally, when more than one machine is listed in the netrc file, the credentials from the first one are taken, not the one from the matching host.
Code changed in jenkins
User: Florian Zschocke
Path:
src/main/java/org/jenkinsci/plugins/gitclient/CliGitAPIImpl.java
src/main/java/org/jenkinsci/plugins/gitclient/Netrc.java
src/test/java/org/jenkinsci/plugins/gitclient/NetrcTest.java
src/test/resources/netrc_1.in
src/test/resources/netrc_1a.in
src/test/resources/netrc_2.in
http://jenkins-ci.org/commit/git-client-plugin/3430d9270beeabedfab130e5d987bcf26c336748
Log:
[FIXED JENKINS-20684] Parser for .netrc file format
This path implements a parser for the .netrc file supporting various formats.
It is not restricted to having a machine definition on a single line but can
parse any valid format. The one exception is that it does not cope with
`macdef` definitions.
handle `macdef` definitons in the netrc file to the parser.
Anything following a `macdef` keyword will be ignored up to
the next empty line.