~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
 
174
174
    private void init()
175
175
    {
176
 
        // if not already set, get a usefull value for rootDir
 
176
        String disableCredStore = System.getProperty("test.disablecredstore");
 
177
        if (disableCredStore != null)
 
178
        {
 
179
            try {
 
180
                SVNUtil.disableNativeCredentialsStore();
 
181
            } catch(Throwable ex) {
 
182
                System.err.println("*** ERROR: Could not disable" +
 
183
                                   " the native credentials store");
 
184
            }
 
185
        }
 
186
 
 
187
        // if not already set, get a useful value for rootDir
177
188
        if (rootDirectoryName == null)
178
189
            rootDirectoryName = System.getProperty("test.rootdir");
179
190
        if (rootDirectoryName == null)
246
257
        greekRepos = new File(localTmp, "repos");
247
258
        greekDump = new File(localTmp, "greek_dump");
248
259
        admin.create(greekRepos, true,false, null, this.fsType);
249
 
        addExpectedCommitItem(greekFiles.getAbsolutePath(), null, null,
250
 
                              NodeKind.none, CommitItemStateFlags.Add);
 
260
        addExpectedCommitItem(greekFiles.getAbsolutePath(),
 
261
                              makeReposUrl(greekRepos).toString(), null,
 
262
                              NodeKind.dir, CommitItemStateFlags.Add);
251
263
        client.doImport(greekFiles.getAbsolutePath(),
252
 
                       makeReposUrl(greekRepos).toString(),
 
264
                        makeReposUrl(greekRepos).toString(),
253
265
                        Depth.infinity, false, false, null,
254
266
                        new MyCommitMessage(), null);
255
267
        admin.dump(greekRepos, new FileOutputStream(greekDump),
285
297
    {
286
298
        this.client = new SVNClient();
287
299
        this.client.notification2(new MyNotifier());
288
 
        this.client.setPrompt(new DefaultPromptUserPassword());
 
300
        if (DefaultAuthn.useDeprecated())
 
301
            this.client.setPrompt(DefaultAuthn.getDeprecated());
 
302
        else
 
303
            this.client.setPrompt(DefaultAuthn.getDefault());
289
304
        this.client.username(USERNAME);
290
305
        this.client.setProgressCallback(new DefaultProgressListener());
291
306
        this.client.setConfigDirectory(this.conf.getAbsolutePath());
292
307
        this.expectedCommitItems = new HashMap<String, MyCommitItem>();
293
308
    }
294
309
    /**
295
 
     * the default prompt : never prompts the user, provides defaults answers
 
310
     * the default prompts : never prompt the user, provide default answers
296
311
     */
297
 
    protected static class DefaultPromptUserPassword implements UserPasswordCallback
 
312
    protected static class DefaultAuthn
298
313
    {
299
 
 
300
 
        public int askTrustSSLServer(String info, boolean allowPermanently)
301
 
        {
302
 
            return UserPasswordCallback.AcceptTemporary;
303
 
        }
304
 
 
305
 
        public String askQuestion(String realm, String question, boolean showAnswer)
306
 
        {
307
 
            return "";
308
 
        }
309
 
 
310
 
        public boolean askYesNo(String realm, String question, boolean yesIsDefault)
311
 
        {
312
 
            return yesIsDefault;
313
 
        }
314
 
 
315
 
        public String getPassword()
316
 
        {
317
 
            return PASSWORD;
318
 
        }
319
 
 
320
 
        public String getUsername()
321
 
        {
322
 
            return USERNAME;
323
 
        }
324
 
 
325
 
        public boolean prompt(String realm, String username)
326
 
        {
327
 
            return false;
328
 
        }
329
 
 
330
 
        public boolean prompt(String realm, String username, boolean maySave)
331
 
        {
332
 
            return false;
333
 
        }
334
 
 
335
 
        public String askQuestion(String realm, String question,
336
 
                boolean showAnswer, boolean maySave)
337
 
        {
338
 
            return "";
339
 
        }
340
 
 
341
 
        public boolean userAllowedSave()
342
 
        {
343
 
            return false;
 
314
        public static boolean useDeprecated()
 
315
        {
 
316
            String prop = System.getProperty("test.authn.deprecated");
 
317
            return (prop != null && !prop.isEmpty());
 
318
        }
 
319
 
 
320
        public static AuthnCallback getDefault()
 
321
        {
 
322
            return new DefaultAuthnCallback();
 
323
        }
 
324
 
 
325
        @SuppressWarnings("deprecation")
 
326
        public static UserPasswordCallback getDeprecated()
 
327
        {
 
328
            return new DeprecatedAuthnCallback();
 
329
        }
 
330
 
 
331
        private static class DefaultAuthnCallback
 
332
            implements AuthnCallback
 
333
        {
 
334
            public UsernameResult
 
335
                usernamePrompt(String realm, boolean maySave)
 
336
            {
 
337
                return new UsernameResult(USERNAME);
 
338
            }
 
339
 
 
340
            public UserPasswordResult
 
341
                userPasswordPrompt(String realm, String username,
 
342
                                   boolean maySave)
 
343
            {
 
344
                return new UserPasswordResult(USERNAME, PASSWORD);
 
345
            }
 
346
 
 
347
            public SSLServerTrustResult
 
348
                sslServerTrustPrompt(String realm,
 
349
                                     SSLServerCertFailures failures,
 
350
                                     SSLServerCertInfo info,
 
351
                                     boolean maySave)
 
352
            {
 
353
                return SSLServerTrustResult.acceptTemporarily();
 
354
            }
 
355
 
 
356
            public SSLClientCertResult
 
357
                sslClientCertPrompt(String realm, boolean maySave)
 
358
            {
 
359
                return null;
 
360
            }
 
361
 
 
362
            public SSLClientCertPassphraseResult
 
363
                sslClientCertPassphrasePrompt(String realm, boolean maySave)
 
364
            {
 
365
                return null;
 
366
            }
 
367
 
 
368
            public boolean allowStorePlaintextPassword(String realm)
 
369
            {
 
370
                return false;
 
371
            }
 
372
 
 
373
            public boolean allowStorePlaintextPassphrase(String realm)
 
374
            {
 
375
                return false;
 
376
            }
 
377
        }
 
378
 
 
379
        @SuppressWarnings("deprecation")
 
380
        private static class DeprecatedAuthnCallback
 
381
            implements UserPasswordCallback
 
382
        {
 
383
            public int askTrustSSLServer(String info, boolean allowPermanently)
 
384
            {
 
385
                return UserPasswordCallback.AcceptTemporary;
 
386
            }
 
387
 
 
388
            public String askQuestion(String realm, String question,
 
389
                                      boolean showAnswer)
 
390
            {
 
391
                return "";
 
392
            }
 
393
 
 
394
            public boolean askYesNo(String realm, String question,
 
395
                                    boolean yesIsDefault)
 
396
            {
 
397
                return yesIsDefault;
 
398
            }
 
399
 
 
400
            public String getPassword()
 
401
            {
 
402
                return PASSWORD;
 
403
            }
 
404
 
 
405
            public String getUsername()
 
406
            {
 
407
                return USERNAME;
 
408
            }
 
409
 
 
410
            public boolean prompt(String realm, String username)
 
411
            {
 
412
                return true;
 
413
            }
 
414
 
 
415
            public boolean prompt(String realm, String username, boolean maySave)
 
416
            {
 
417
                return true;
 
418
            }
 
419
 
 
420
            public String askQuestion(String realm, String question,
 
421
                                      boolean showAnswer, boolean maySave)
 
422
            {
 
423
                return "";
 
424
            }
 
425
 
 
426
            public boolean userAllowedSave()
 
427
            {
 
428
                return false;
 
429
            }
344
430
        }
345
431
    }
346
432
 
347
 
    private static class DefaultProgressListener implements ProgressCallback
 
433
    protected static class DefaultProgressListener implements ProgressCallback
348
434
    {
349
435
 
350
436
        public void onProgress(ProgressEvent event)
782
868
        {
783
869
            MyStatusCallback statusCallback = new MyStatusCallback();
784
870
            client.status(workingCopy.getAbsolutePath(), Depth.unknown,
785
 
                          checkRepos, true, true, false, null, statusCallback);
 
871
                          checkRepos, false, true, true, false, false,
 
872
                          null, statusCallback);
786
873
            wc.check(statusCallback.getStatusArray(),
787
874
                    workingCopy.getAbsolutePath(), checkRepos);
788
875
        }
916
1003
 
917
1004
        public Status[] getStatusArray()
918
1005
        {
919
 
            return (Status[]) statuses.toArray(new Status[statuses.size()]);
 
1006
            return statuses.toArray(new Status[statuses.size()]);
920
1007
        }
921
1008
    }
922
1009
}