jgit/org.eclipse.jgit.ssh.apache...
Antoine Musso 7b955048eb Fix all Javadoc warnings and fail on them
This fixes all the javadoc warnings, stops ignoring doclint 'missing'
category and fails the build on javadoc warnings for public and
protected classes and class members.

Since javadoc doesn't allow access specifiers when specifying doclint
configuration we cannot set `-Xdoclint:all,-missing/private`
hence there is no simple way to skip private elements from doclint.
Therefore we check javadoc using the Eclipse Java compiler
(which is used by default) and javadoc configuration in
`.settings/org.eclipse.jdt.core.prefs` files.
This allows more fine grained configuration.

We can reconsider this when javadoc starts supporting access specifiers
in the doclint configuration.

Below are detailled explanations for most modifications.

@inheritDoc
===========
doclint complains about explicits `{@inheritDoc}` when the parent does
not have any documentation. As far as I can tell, javadoc defaults to
inherit comments and should only be used when one wants to append extra
documentation from the parent. Given the parent has no documentation,
remove those usages which doclint complains about.

In some case I have moved up the documentation from the concrete class
up to the abstract class.

Remove `{@inheritDoc}` on overriden methods which don't add additional
documentation since javadoc defaults to inherit javadoc of overridden
methods.

@value to @link
===============
In PackConfig, DEFAULT_SEARCH_FOR_REUSE_TIMEOUT and similar are forged
from Integer.MAX_VALUE and are thus not considered constants (I guess
cause the value would depends on the platform). Replace it with a link
to `Integer.MAX_VALUE`.

In `StringUtils.toBoolean`, @value was used to refer to the
`stringValue` parameter. I have replaced it with `{@code stringValue}`.

{@link <url>} to <a>
====================
@link does not support being given an external URL. Replaces them with
HTML `<a>`.

@since: being invalid
=====================

org.eclipse.jgit/src/org/eclipse/jgit/util/Equality.java has an invalid
tag `@since: ` due to the extra `:`. Javadoc does not complain about it
with version 11.0.18+10 but does with 11.0.19.7. It is invalid
regardless.

invalid HTML syntax
===================

- javadoc doesn't allow <br/>, <p/> and </p> anymore, use <br> and <p>
instead
- replace <tt>code</tt> by {@code code}
- <table> tags don't allow summary attribute, specify caption as
<caption>caption</caption> to fix this

doclint visibility issue
========================

In the private abstract classes `BaseDirCacheEditor` and
`BasePackConnection` links to other methods in the abstract class are
inherited in the public subclasses but doclint gets confused and
considers them unreachable. The HTML documentation for the sub classes
shows the relative links in the sub classes, so it is all correct. It
must be a bug somewhere in javadoc.
Mute those warnings with: @SuppressWarnings("doclint:missing")

Misc
====
Replace `<` and `>` with HTML encoded entities (`&lt; and `&gt;`).
In `SshConstants` I went enclosing a serie of -> arrows in @literal.

Additional tags
===============
Configure maven-javad0c-plugin to allow the following additional tags
defined in https://openjdk.org/jeps/8068562:
- apiNote
- implSpec
- implNote

Missing javadoc
===============
Add missing @params and descriptions

Change-Id: I840056389aa59135cfb360da0d5e40463ce35bd0
Also-By: Matthias Sohn <matthias.sohn@sap.com>
2023-06-16 01:08:13 +02:00
..
.settings Fix all Javadoc warnings and fail on them 2023-06-16 01:08:13 +02:00
META-INF Prepare 6.7.0-SNAPSHOT builds 2023-05-24 17:31:26 +02:00
resources sshd: Connector for the Win32-OpenSSH SSH agent 2022-01-30 17:13:46 +01:00
src/org/eclipse/jgit/internal/transport/sshd/agent/connector Fix all Javadoc warnings and fail on them 2023-06-16 01:08:13 +02:00
.classpath sshd: add support for ssh-agent 2021-11-03 23:46:54 +01:00
.fbprefs sshd: add support for ssh-agent 2021-11-03 23:46:54 +01:00
.gitignore Add missing .gitignore in o.e.j.ssh.apache.agent 2021-11-15 10:37:36 +01:00
.project sshd: add support for ssh-agent 2021-11-03 23:46:54 +01:00
BUILD Bazel: Format build files with buildifier 2022-01-20 00:54:01 -05:00
README.md sshd: Add README.md for SSH agents 2022-01-30 17:13:47 +01:00
about.html sshd: add support for ssh-agent 2021-11-03 23:46:54 +01:00
build.properties sshd: add support for ssh-agent 2021-11-03 23:46:54 +01:00
plugin.properties sshd: add support for ssh-agent 2021-11-03 23:46:54 +01:00
pom.xml Prepare 6.7.0-SNAPSHOT builds 2023-05-24 17:31:26 +02:00

README.md

JGit SSH agent transport support for Apache MINA sshd

This bundle provides optional support for communicating with an SSH agent for SSH or SFTP authentication. It is an OSGi fragment for bundle org.eclipse.jgit.ssh.apache, and it provides transports for local communication with SSH agents.

Supported SSH agent transports

Linux, OS X, BSD

On Linux, OS X, and BSD, the only transport mechanism supported is the usual communication via a Unix domain socket. This is the only protocol the OpenSSH SSH agent supports. A Unix domain socket appears as a special file in the file system; this file name is typically available in the environment variable SSH_AUTH_SOCK.

The SSH config IdentityAgent can be set to this socket filename to specify exactly which Unix domain socket to use, or it can be set to SSH_AUTH_SOCK to use the value from that environment variable. If IdentityAgent is not set at all, JGit uses SSH_AUTH_SOCK by default. If the variable is not set, no SSH agent will be used. IdentityAgent can also be set to none to not use any SSH agent.

Windows

On Windows, two different transports are supported:

  • A transport over a Windows named pipe. This is used by Win32-OpenSSH, and is available for Pageant since version 0.75.
  • A Pageant-specific legacy transport via shared memory; useful for Pageant and GPG's gpg-agent.

Possible settings of IdentityAgent to select a particular transport are

  • //./pipe/openssh-ssh-agent: the Windows named pipe of Win32-OpenSSH.
  • //./pageant: the shared-memory mechanism of Pageant.
  • none: do not use any SSH agent.
  • //./pipe/&lt;any_valid_pipe_name>: use a specific Windows named pipe.

The default transport on Windows if IdentityAgent is not set at all is the Pageant shared-memory transport. Environment variable SSH_AUTH_SOCK needs not be set for Pageant, and must not be set for Win32-OpenSSH.

It is also possible to use a named pipe as transport for Pageant (as of version 0.75). Unfortunately, Pageant unnecessarily cryptographically obfuscates the pipe name, so it is not possible for JGit to determine it automatically. The pipe name is pageant.<user name>.<sha256>, for instance pageant.myself.c5687736ba755a70b000955cb191698aed7db221c2b0710199eb1f5298922ab5. A user can look up the name by starting Pageant and then running the command dir \\.\pipe\\ in a command shell. Once the name is known, setting IdentityAgent to the pipe name as //./pipe/pageant.myself.c5687736ba755a70b000955cb191698aed7db221c2b0710199eb1f5298922ab5 makes JGit use this Windows named pipe for communication with Pageant.

(You can use forward slashes in the ~/.ssh/config file. SSH config file parsing has its own rules about backslashes in config files; which are treated as escape characters in some contexts. With backslashes one would have to write, e.g., \\\\.\pipe\openssh-ssh-agent.)

With these two transport mechanisms, Pageant and Win32-OpenSSH are supported. As for GPG: the gpg-agent can be configured to emulate ssh-agent (presumably via a WinSockets2 "Unix domain socket" on Windows) or to emulate Pageant (using the shared memory mechanism). Running gpg-agent with the enable-ssh-support option is reported not to work on Windows, though. But the PuTTY emulation in gpg-agent (option enable-putty-support) should work, so it should be possible to use gpg-agent instead of Pageant.

Neither Pageant (as of version 0.76) nor Win32-OpenSSH (as of version 8.6) support the confirm or lifetime constraints for AddKeysToAgent. gpg-agent apparently does, even when communicating over the Pageant shared memory mechanism.

The ssh-agent from git bash on Windows is currently not supported. It would need a connector handling Cygwin socket files and the Cygwin handshake over a TCP stream socket bound to the loopback interface. The Cygwin socket file is exposed in the Windows file system at %TEMP%\ssh-XXXXXXXXXX\agent.<number>, but it does not have a fixed name (the X's and the number are variable and change each time ssh-agent is started).

Implementation

The implementation of all transports uses JNA.