subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1616057 - in /subversion/branches/svn-auth-x509/subversion/bindings/javahl: native/ src/org/apache/subversion/javahl/ src/org/apache/subversion/javahl/util/ tests/org/apache/subversion/javahl/
Date Wed, 06 Aug 2014 00:16:47 GMT
Author: brane
Date: Wed Aug  6 00:16:47 2014
New Revision: 1616057

URL: http://svn.apache.org/r1616057
Log:
On the svn-authz-x509 branch: Finalize JavaHL's credentials search API.

[in subversion/bindings/javahl]
* src/org/apache/subversion/javahl/SVNUtil.java,
  src/org/apache/subversion/javahl/util/ConfigLib.java
  (SVNUtil.searchCredentials): Rename subjectPattern to hostnamePattern,
   adjust semantics to match and update the docstring.

* native/org_apache_subversion_javahl_util_ConfigLib.cpp
  (Java_org_apache_subversion_javahl_util_ConfigLib_nativeSearchCredentials):
   Update implementation to match the JavaHL API semantics.

* tests/org/apache/subversion/javahl/UtilTests.java
  (UtilTests.testCredentials): Update testcase and, incidentally, test
   wildcard escaping in search patterns.

Modified:
    subversion/branches/svn-auth-x509/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
    subversion/branches/svn-auth-x509/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java
    subversion/branches/svn-auth-x509/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java
    subversion/branches/svn-auth-x509/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java

Modified: subversion/branches/svn-auth-x509/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp?rev=1616057&r1=1616056&r2=1616057&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
(original)
+++ subversion/branches/svn-auth-x509/subversion/bindings/javahl/native/org_apache_subversion_javahl_util_ConfigLib.cpp
Wed Aug  6 00:16:47 2014
@@ -315,7 +315,7 @@ Java_org_apache_subversion_javahl_util_C
     JNIEnv* jenv, jobject jthis,
     jstring jconfig_dir, jstring jcred_kind,
     jstring jrealm_pattern, jstring jusername_pattern,
-    jstring jsubject_pattern, jstring jtext_pattern)
+    jstring jhostname_pattern, jstring jtext_pattern)
 {
   SVN_JAVAHL_JNI_TRY(ConfigLib, iterateCredentials)
     {
@@ -327,7 +327,7 @@ Java_org_apache_subversion_javahl_util_C
       const Java::String cred_kind(env, jcred_kind);
       const Java::String realm_pattern(env, jrealm_pattern);
       const Java::String username_pattern(env, jusername_pattern);
-      const Java::String subject_pattern(env, jsubject_pattern);
+      const Java::String hostname_pattern(env, jhostname_pattern);
       const Java::String text_pattern(env, jtext_pattern);
 
       // Using a "global" request pool since we don't keep a context
@@ -339,7 +339,7 @@ Java_org_apache_subversion_javahl_util_C
         const char* const m_cred_kind;
         const char* const m_realm_pattern;
         const char* const m_username_pattern;
-        const char* const m_subject_pattern;
+        const char* const m_hostname_pattern;
         const char* const m_text_pattern;
 
         const ::Java::Env m_env;
@@ -363,12 +363,12 @@ Java_org_apache_subversion_javahl_util_C
                           const char* ctor_cred_kind,
                           const char* ctor_realm_pattern,
                           const char* ctor_username_pattern,
-                          const char* ctor_subject_pattern,
+                          const char* ctor_hostname_pattern,
                           const char* ctor_text_pattern)
           : m_cred_kind(ctor_cred_kind),
             m_realm_pattern(ctor_realm_pattern),
             m_username_pattern(ctor_username_pattern),
-            m_subject_pattern(ctor_subject_pattern),
+            m_hostname_pattern(ctor_hostname_pattern),
             m_text_pattern(ctor_text_pattern),
             m_env(ctor_env),
             m_credentials(ctor_env)
@@ -441,14 +441,10 @@ Java_org_apache_subversion_javahl_util_C
                        || (username
                            && !apr_fnmatch(m_username_pattern, username, 0)));
 
-            if (!match && m_subject_pattern)
-              {
-                match = (match
-                         || (subject
-                             && !apr_fnmatch(m_subject_pattern, subject, 0)));
-                if (!match && hostnames)
-                  match = (match || match_array(m_subject_pattern, hostnames));
-              }
+            if (!match && m_hostname_pattern)
+              match = (match
+                       || (hostnames
+                           &&  match_array(m_hostname_pattern, hostnames)));
 
             if (!match && m_text_pattern)
               match = (match
@@ -480,7 +476,7 @@ Java_org_apache_subversion_javahl_util_C
            cred_kind.strdup(pool.getPool()),
            realm_pattern.strdup(pool.getPool()),
            username_pattern.strdup(pool.getPool()),
-           subject_pattern.strdup(pool.getPool()),
+           hostname_pattern.strdup(pool.getPool()),
            text_pattern.strdup(pool.getPool()));
 
       SVN_JAVAHL_CHECK(env,

Modified: subversion/branches/svn-auth-x509/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java?rev=1616057&r1=1616056&r2=1616057&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java
(original)
+++ subversion/branches/svn-auth-x509/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNUtil.java
Wed Aug  6 00:16:47 2014
@@ -466,12 +466,12 @@ public class SVNUtil
      *             otherwise, only those credentials that have a username,
      *             and where the username matches the pattern, will be
      *             returned.
-     * @param subjectPattern A glob pattern for the subject and
-     *             hostnames of a server certificate; if
-     *             <code>null</code>, all credntials will be
-     *             considered; otherwise, only those credentials that
-     *             have a server certificate with a hostname that
-     *             matches the pattern will be returned.
+     * @param hostnamePattern A glob pattern for the hostnames of a
+     *             server certificate; if <code>null</code>, all
+     *             credntials will be considered; otherwise, only
+     *             those credentials that have a server certificate
+     *             with a hostname that matches the pattern will be
+     *             returned.
      * @param textPattern A glob pattern that must match any textual
      *             information in a credential, for example, a realm,
      *             username, certificate details, etc; passwords, passphrases
@@ -483,12 +483,12 @@ public class SVNUtil
                           Credential.Kind kind,
                           String realmPattern,
                           String usernamePattern,
-                          String subjectPattern,
+                          String hostnamePattern,
                           String textPattern)
         throws ClientException, SubversionException
     {
         return configLib.searchCredentials(configDir, kind, realmPattern,
-                                           usernamePattern, subjectPattern,
+                                           usernamePattern, hostnamePattern,
                                            textPattern);
     }
 

Modified: subversion/branches/svn-auth-x509/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java?rev=1616057&r1=1616056&r2=1616057&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java
(original)
+++ subversion/branches/svn-auth-x509/subversion/bindings/javahl/src/org/apache/subversion/javahl/util/ConfigLib.java
Wed Aug  6 00:16:47 2014
@@ -87,14 +87,14 @@ public class ConfigLib
                           SVNUtil.Credential.Kind kind,
                           String realmPattern,
                           String usernamePattern,
-                          String subjectPattern,
+                          String hostnamePattern,
                           String textPattern)
         throws ClientException, SubversionException
     {
         return nativeSearchCredentials(
             configDir,
             (kind != null ? kind.toString() : null),
-            realmPattern, usernamePattern, subjectPattern, textPattern);
+            realmPattern, usernamePattern, hostnamePattern, textPattern);
     }
 
     private native SVNUtil.Credential

Modified: subversion/branches/svn-auth-x509/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/svn-auth-x509/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java?rev=1616057&r1=1616056&r2=1616057&view=diff
==============================================================================
--- subversion/branches/svn-auth-x509/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java
(original)
+++ subversion/branches/svn-auth-x509/subversion/bindings/javahl/tests/org/apache/subversion/javahl/UtilTests.java
Wed Aug  6 00:16:47 2014
@@ -794,7 +794,7 @@ public class UtilTests extends SVNTests
 
         /* search with match on subvject */
         creds = SVNUtil.searchCredentials(configDir, null,
-                                          null, null, "*apache*", null);
+                                          null, null, "\\*.apache.org", null);
         assertNotNull(creds);
         assertEquals(creds.size(), 1);
 



Mime
View raw message