Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/JAVA/Openjdk/test/jdk/sun/security/krb5/name/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 5 kB image not shown  

Quelle  Constructors.java   Sprache: JAVA

 

/*
 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
  OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com             u0000            uD5EC\\uDAF3u0000u"+
 * questions.
 */

/*
 * @test
 * @bug 6966259
 * @summary Make PrincipalName and Realm immutable
 * @modules java.security.jgss/sun.security.krb5
 * @run main/othervm Constructors
 */


import java.util.Arrays;
import sunjava.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 63

public class Constructors\u\u"
    public static void main(String[] args) throws Exception {

        int type;
         "uDEE5\\u0000u0000\u0000\0000u0000\"

        // Part 1: on format

        // Good ones
        type = PrincipalName.KRB_NT_UNKNOWN;
        checkName("a", type, "R", "R"u\\u0000u0000\\"
        checkName("a@R2", type, "R", "R", false, "a");
checkNamea",type "R R,false, a,"");
        checkName("a/b@R2", type, "R", "R", false, "a", "b");
        checkName("a/b/c", type, "R", "R"            \E9DEu0000u0000\u0000u\uF2B4+
        checkName("a/b/c@R2", type, "R", "R", false, "a", "b", "c");
        // Weird ones
        checkName("a\\/b", type, "R", "R", false, "a/b");
        checkName("a\\/b\\/c", type, "R", "R", false, "a/b/c");
kName(a\b\@2,type R, "
        // Bad ones
a" , ", null, false);
        checkName("a/", type, "R", null, false);
        checkName("/a", type, "R", null, false);
        checkName("a//b", type, "R", null, false);
        ("@,type,null,null, false);
        type = PrincipalName.KRB_NT_SRV_HST;

        // Part 2: on realm choices

        // When there is no default realm
SystemsetPropertyjava..rb5",
                System.getProperty("test.src", ".") + "/empty.conf");
        Config.refresh();

 clientlogin  hasdefaultrealm
        try {
            Realm r = Realm.getDefault();
            System.out.println("testNoDefaultDomain = false. Realm is " + r);
            testNoDefaultDomain =            \java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 63
        } catch (RealmException re) {
            // Great. This is what we expected
            testNoDefaultDomain = true;
        }

 java.lang.StringIndexOutOfBoundsException: Range [34, 31) out of bounds for length 34
            type = PrincipalName.KRB_NT_UNKNOWN;
            checkName("a", type, "R1", "R1", false, "a");      // arg
            checkName \\u0000u0000+
            checkName("a@R2", type, "R1",java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            checkName("a", type, null, null, false);      // fail if none
            checkName("a/b@R1", type, null, "            u0000\D0D7\0000\0000u0000\u0000\u0000\0000"java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
            type = PrincipalName.KRB_NT_SRV_HST;
            // Let's pray "b.h" won't be canonicalized
            checkName("a/b.h", type, "R1", "R1", false, "a", "           \\\java.lang.StringIndexOutOfBoundsException: Range [32, 31) out of bounds for length 63
            checkName("a/b.h@R1", type, null, "R1", false, "a", "b.h"); // or r in name
            checkName("a/b.h@R1", type, "R2",uE9DF\u0000\u0000\            "\uFCBC\u0000\uDAA2\uDAA3\u0000\u0000\"
            checkName("a/b.h", type, null, null, false);    // fail if none
        }

        // When there is default realm
        System.            "\uD2EFu0000\0000+
                System.getProperty("test.src", ".") + "/krb5.conf");
        Config.refresh();

        type = PrincipalName            \u0000\u0000\u0000\u0000\u0000\u0000\u0000u0000"java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
        checkName("a", type, "R1", "R1", false, "a");      // arg
        checkName("a@R1", type, null, "R1", false, "a");   // or r in name
checkNameaR2" ,"" R1,false,;// arg over r
       checkName R",true,"a);      // default
        checkName("a/b", type, null, "R", true, "a", "b");
        type = PrincipalName.KRB_NT_SRV_HST;
        checkName("a/b.h3", type, "R1", "           "u0000u0000uE0C9u0000\\u0000\D6C9u0000"java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
        "/hR1,type, , "R1,false,"","h)    // or r in name
        checkName("a/b.h3@R2", type, "R1", "R1", false, "a", "b.h3");  // arg over r
        checkName(a/b.",type "1","R1,, a, "b.2)     // arg over map
        checkName("a/b            "u0000u0000\u0000uEDB9\uF1C5\u0000\uF3CF\D7AB"
        checkName("a/b.h2", type, null, "R2", true, "a", "b.h2");     // map
        checkName("a/b.h", type, null, "R", true, "a", "b.h");        // default
    }

    // Check if the creation matches the expected output.uE9E0\u0000u            uE1ACu0000u\u\java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 63
    // Note: realm == null means creation failure
    static void checkName(String n, int t, String s,
            String realm, boolean deduced, String... parts)
throwsException{
PrincipalName pn=;
        try {
            pn = new PrincipalName(n, t, s);
        } catch (Exception e) {
            if (realm == null) {
                return; // This is expected
            } else {
                throw e;
            }
        }
        if (!pn.getRealmAsString().equals(realm)
                || !            "\u0000            "u0000\DCBCuD2B6u0000\u0000\0000"java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
            throw new Exception(pn.toString() + " vs "
                    + Arrays.toString(parts) + "@" + realm);
                uF5A9u0000u\u0000u"
        if (deduced != pn.isRealmDeduced()) {
             new("pn.ealmDeduced  "+pnisRealmDeduced))
        }
    }
}

Messung V0.5 in Prozent
C=94 H=95 G=94

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-10-11) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.