8228659: Record which Java methods are called by native codes in JGSS and JAAS

Reviewed-by: mullan
This commit is contained in:
Weijun Wang 2019-09-25 17:54:21 +08:00
parent 83b11a570a
commit 12c278c3e3
17 changed files with 44 additions and 95 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -61,6 +61,7 @@ public class GSSCredElement implements GSSCredentialSpi {
}
// Construct delegation cred using the actual context mech and srcName
// Warning: called by NativeUtil.c
GSSCredElement(long pCredentials, GSSNameElement srcName, Oid mech)
throws GSSException {
pCred = pCredentials;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -43,7 +43,7 @@ import sun.security.jgss.GSSUtil;
class GSSLibStub {
private Oid mech;
private long pMech;
private long pMech; // Warning: used by NativeUtil.c
/**
* Initialization routine to dynamically load function pointers.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -97,6 +97,7 @@ public class GSSNameElement implements GSSNameSpi {
printableName = "<DEFAULT ACCEPTOR>";
}
// Warning: called by NativeUtil.c
GSSNameElement(long pNativeName, GSSLibStub stub) throws GSSException {
assert(stub != null);
if (pNativeName == 0) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -59,20 +59,22 @@ class NativeGSSContext implements GSSContextSpi {
private static final int NUM_OF_INQUIRE_VALUES = 6;
// Warning: The following 9 fields are used by NativeUtil.c
private long pContext = 0; // Pointer to the gss_ctx_id_t structure
private GSSNameElement srcName;
private GSSNameElement targetName;
private GSSCredElement cred;
private GSSCredElement disposeCred;
private boolean isInitiator;
private boolean isEstablished;
private Oid actualMech; // Assigned during context establishment
private ChannelBinding cb;
private GSSCredElement delegatedCred;
private GSSCredElement disposeDelegatedCred;
private int flags;
private int lifetime = GSSCredential.DEFAULT_LIFETIME;
private Oid actualMech; // Assigned during context establishment
private GSSCredElement cred;
private GSSCredElement disposeCred;
private ChannelBinding cb;
private GSSCredElement disposeDelegatedCred;
private final GSSLibStub cStub;
private boolean skipDelegPermCheck;
@ -231,6 +233,7 @@ class NativeGSSContext implements GSSContextSpi {
}
// Constructor for imported context
// Warning: called by NativeUtil.c
NativeGSSContext(long pCtxt, GSSLibStub stub) throws GSSException {
assert(pContext != 0);
pContext = pCtxt;

View file

@ -88,6 +88,7 @@ public class Credentials {
this.authzData = authzData;
}
// Warning: called by NativeCreds.c and nativeccache.c
public Credentials(Ticket new_ticket,
PrincipalName new_client,
PrincipalName new_client_alias,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -218,8 +218,8 @@ public class EncryptionKey
* credential cache file.
*
*/
// Used in JSSE (KerberosWrapper), Credentials,
// javax.security.auth.kerberos.KeyImpl
// Used in Credentials, and javax.security.auth.kerberos.KeyImpl
// Warning: called by NativeCreds.c and nativeccache.c
public EncryptionKey(int keyType,
byte[] keyValue) {
this(keyValue, keyType, null);

View file

@ -158,7 +158,7 @@ public class PrincipalName implements Cloneable {
this.realmDeduced = false;
}
// This method is called by Windows NativeCred.c
// Warning: called by NativeCreds.c
public PrincipalName(String[] nameParts, String realm) throws RealmException {
this(KRB_NT_UNKNOWN, nameParts, new Realm(realm));
}
@ -484,6 +484,7 @@ public class PrincipalName implements Cloneable {
}
}
// Warning: called by nativeccache.c
public PrincipalName(String name, int type) throws RealmException {
this(name, type, (String)null);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -165,6 +165,8 @@ public class HostAddress implements Cloneable {
/**
* Creates a HostAddress from the specified address and address type.
*
* Warning: called by nativeccache.c.
*
* @param new_addrType the value of the address type which matches the defined
* address family constants in the Berkeley Standard
* Distributions of Unix.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -68,6 +68,7 @@ public class HostAddresses implements Cloneable {
private HostAddress[] addresses = null;
private volatile int hashCode = 0;
// Warning: called by nativeccache.c
public HostAddresses(HostAddress[] new_addresses) throws IOException {
if (new_addresses != null) {
addresses = new HostAddress[new_addresses.length];

View file

@ -88,8 +88,7 @@ public class KerberosTime {
this(time, 0);
}
// This constructor is used in the native code
// src/windows/native/sun/security/krb5/NativeCreds.c
// Warning: called by NativeCreds.c and nativeccache.c
public KerberosTime(String time) throws Asn1Exception {
this(toKerberosTime(time), 0);
}

View file

@ -309,7 +309,7 @@ public class Krb5 {
return errMsgList.get(i);
}
// Warning: used by NativeCreds.c
public static final boolean DEBUG = GetBooleanAction
.privilegedGetProperty("sun.security.krb5.debug");

View file

@ -83,6 +83,7 @@ public class Ticket implements Cloneable {
encPart = new_encPart;
}
// Warning: called by NativeCreds.c and nativeccache.c
public Ticket(byte[] data) throws Asn1Exception,
RealmException, KrbApErrException, IOException {
init(new DerValue(data));

View file

@ -67,6 +67,7 @@ public class TicketFlags extends KerberosFlags {
}
}
// Warning: called by NativeCreds.c and nativeccache.c
public TicketFlags(int size, byte[] data) throws Asn1Exception {
super(size, data);
if ((size > data.length * BITS_PER_UNIT) || (size > Krb5.TKT_OPTS_MAX + 1))