You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ph...@apache.org on 2018/01/10 01:38:43 UTC

svn commit: r1820718 - in /subversion/trunk: subversion/bindings/javahl/native/Prompter.cpp tools/examples/ExampleAuthn.java

Author: philip
Date: Wed Jan 10 01:38:43 2018
New Revision: 1820718

URL: http://svn.apache.org/viewvc?rev=1820718&view=rev
Log:
Fix a JavaHL bug in the prompting for SSL server trust: attempting to
temporarily accept failures would lead to reject behaviour.

* subversion/bindings/javahl/native/Prompter.cpp
  (Prompter::dispatch_ssl_server_trust_prompt): Always set accepted_failures
   in returned credentials, this matches the behaviour of the standard
   svn_cmdline_auth_ssl_server_trust_prompt().

* tools/examples/ExampleAuthn.java
  (ExampleAuthn.sslServerTrustPrompt): Basic r/t implementation.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp
    subversion/trunk/tools/examples/ExampleAuthn.java

Modified: subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp?rev=1820718&r1=1820717&r2=1820718&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Prompter.cpp Wed Jan 10 01:38:43 2018
@@ -342,8 +342,7 @@ svn_error_t *Prompter::dispatch_ssl_serv
   svn_auth_cred_ssl_server_trust_t *cred =
     static_cast<svn_auth_cred_ssl_server_trust_t*>(apr_pcalloc(pool, sizeof(*cred)));
   cred->may_save = save;
-  if (save)
-    cred->accepted_failures = failures;
+  cred->accepted_failures = failures;
   *cred_p = cred;
 
   return SVN_NO_ERROR;

Modified: subversion/trunk/tools/examples/ExampleAuthn.java
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/examples/ExampleAuthn.java?rev=1820718&r1=1820717&r2=1820718&view=diff
==============================================================================
--- subversion/trunk/tools/examples/ExampleAuthn.java (original)
+++ subversion/trunk/tools/examples/ExampleAuthn.java Wed Jan 10 01:38:43 2018
@@ -68,8 +68,11 @@ public class ExampleAuthn {
                              SSLServerCertFailures failures,
                              SSLServerCertInfo info,
                              boolean maySave) {
-          System.out.println("sslServerTrustPrompt not implemented!");
-          return SSLServerTrustResult.acceptTemporarily();
+          System.out.println("sslServerTrustPrompt");
+          System.out.println("(r)eject or (t)emporary?");
+          String s = System.console().readLine();
+          return s.equals("t") ? SSLServerTrustResult.acceptTemporarily()
+                               : SSLServerTrustResult.reject();
         }
 
         public SSLClientCertResult