8200468: Port the native GSS-API bridge to Windows
Reviewed-by: ihse, valeriep
This commit is contained in:
parent
468c1c19bb
commit
0b6fbf50d2
@ -27,25 +27,22 @@ include LibCommon.gmk
|
|||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
ifneq ($(OPENJDK_TARGET_OS), windows)
|
LIBJ2GSS_SRC := $(TOPDIR)/src/java.security.jgss/share/native/libj2gss \
|
||||||
LIBJ2GSS_SRC := $(TOPDIR)/src/java.security.jgss/share/native/libj2gss \
|
#
|
||||||
$(TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_TYPE)/native/libj2gss \
|
|
||||||
#
|
|
||||||
|
|
||||||
$(eval $(call SetupJdkLibrary, BUILD_LIBJ2GSS, \
|
$(eval $(call SetupJdkLibrary, BUILD_LIBJ2GSS, \
|
||||||
NAME := j2gss, \
|
NAME := j2gss, \
|
||||||
SRC := $(LIBJ2GSS_SRC), \
|
SRC := $(LIBJ2GSS_SRC), \
|
||||||
OPTIMIZATION := LOW, \
|
OPTIMIZATION := LOW, \
|
||||||
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2GSS_SRC)) \
|
CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2GSS_SRC)) \
|
||||||
$(LIBJAVA_HEADER_FLAGS) \
|
$(LIBJAVA_HEADER_FLAGS) \
|
||||||
-I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
|
-I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
|
||||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||||
LIBS := $(LIBDL), \
|
LIBS := $(LIBDL), \
|
||||||
))
|
))
|
||||||
|
|
||||||
TARGETS += $(BUILD_LIBJ2GSS)
|
TARGETS += $(BUILD_LIBJ2GSS)
|
||||||
endif
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -46,14 +46,8 @@ public class GSSManagerImpl extends GSSManager {
|
|||||||
USE_NATIVE =
|
USE_NATIVE =
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||||
public Boolean run() {
|
public Boolean run() {
|
||||||
String osname = System.getProperty("os.name");
|
return Boolean.valueOf(System.getProperty
|
||||||
if (osname.startsWith("SunOS") ||
|
(USE_NATIVE_PROP));
|
||||||
osname.contains("OS X") ||
|
|
||||||
osname.startsWith("Linux")) {
|
|
||||||
return Boolean.valueOf(System.getProperty
|
|
||||||
(USE_NATIVE_PROP));
|
|
||||||
}
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -45,6 +45,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_init(JNIEnv *env,
|
|||||||
jstring jlibName,
|
jstring jlibName,
|
||||||
jboolean jDebug) {
|
jboolean jDebug) {
|
||||||
const char *libName;
|
const char *libName;
|
||||||
|
int failed;
|
||||||
char *error = NULL;
|
char *error = NULL;
|
||||||
|
|
||||||
if (!jDebug) {
|
if (!jDebug) {
|
||||||
@ -65,13 +66,38 @@ Java_sun_security_jgss_wrapper_GSSLibStub_init(JNIEnv *env,
|
|||||||
TRACE1("[GSSLibStub_init] libName=%s", libName);
|
TRACE1("[GSSLibStub_init] libName=%s", libName);
|
||||||
|
|
||||||
/* initialize global function table */
|
/* initialize global function table */
|
||||||
error = loadNative(libName);
|
failed = loadNative(libName);
|
||||||
(*env)->ReleaseStringUTFChars(env, jlibName, libName);
|
(*env)->ReleaseStringUTFChars(env, jlibName, libName);
|
||||||
|
|
||||||
if (error == NULL) {
|
if (!failed) {
|
||||||
return JNI_TRUE;
|
return JNI_TRUE;
|
||||||
} else {
|
} else {
|
||||||
TRACE0(error);
|
if (JGSS_DEBUG) {
|
||||||
|
#ifdef WIN32
|
||||||
|
#define MAX_MSG_SIZE 256
|
||||||
|
static CHAR szMsgBuf[MAX_MSG_SIZE];
|
||||||
|
DWORD dwRes;
|
||||||
|
DWORD dwError = GetLastError();
|
||||||
|
dwRes = FormatMessage (
|
||||||
|
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||||
|
NULL,
|
||||||
|
dwError,
|
||||||
|
0,
|
||||||
|
szMsgBuf,
|
||||||
|
MAX_MSG_SIZE,
|
||||||
|
NULL);
|
||||||
|
if (0 == dwRes) {
|
||||||
|
printf("GSS-API: Unknown failure %d\n", dwError);
|
||||||
|
} else {
|
||||||
|
printf("GSS-API: %s\n",szMsgBuf);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
char* error = dlerror();
|
||||||
|
if (error) {
|
||||||
|
TRACE0(error);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
return JNI_FALSE;
|
return JNI_FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,7 +114,6 @@ Java_sun_security_jgss_wrapper_GSSLibStub_getMechPtr(JNIEnv *env,
|
|||||||
gss_OID cOid;
|
gss_OID cOid;
|
||||||
unsigned int i, len;
|
unsigned int i, len;
|
||||||
jbyte* bytes;
|
jbyte* bytes;
|
||||||
jthrowable gssEx;
|
|
||||||
int found;
|
int found;
|
||||||
|
|
||||||
if (jbytes != NULL) {
|
if (jbytes != NULL) {
|
||||||
@ -125,8 +150,6 @@ Java_sun_security_jgss_wrapper_GSSLibStub_getMechPtr(JNIEnv *env,
|
|||||||
* structure.
|
* structure.
|
||||||
*/
|
*/
|
||||||
void deleteGSSCB(gss_channel_bindings_t cb) {
|
void deleteGSSCB(gss_channel_bindings_t cb) {
|
||||||
jobject jinetAddr;
|
|
||||||
jbyteArray value;
|
|
||||||
|
|
||||||
if (cb == GSS_C_NO_CHANNEL_BINDINGS) return;
|
if (cb == GSS_C_NO_CHANNEL_BINDINGS) return;
|
||||||
|
|
||||||
@ -154,7 +177,6 @@ gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) {
|
|||||||
gss_channel_bindings_t cb;
|
gss_channel_bindings_t cb;
|
||||||
jobject jinetAddr;
|
jobject jinetAddr;
|
||||||
jbyteArray value;
|
jbyteArray value;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (jcb == NULL) {
|
if (jcb == NULL) {
|
||||||
return GSS_C_NO_CHANNEL_BINDINGS;
|
return GSS_C_NO_CHANNEL_BINDINGS;
|
||||||
@ -355,7 +377,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_importName(JNIEnv *env,
|
|||||||
GSS_S_BAD_MECH */
|
GSS_S_BAD_MECH */
|
||||||
major = (*ftab->importName)(&minor, &nameVal, nameType, &nameHdl);
|
major = (*ftab->importName)(&minor, &nameVal, nameType, &nameHdl);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_importName] %ld", (long) nameHdl);
|
TRACE1("[GSSLibStub_importName] %" PRIuPTR "", (uintptr_t) nameHdl);
|
||||||
|
|
||||||
/* release intermediate buffers */
|
/* release intermediate buffers */
|
||||||
deleteGSSOID(nameType);
|
deleteGSSOID(nameType);
|
||||||
@ -426,7 +448,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_canonicalizeName(JNIEnv *env,
|
|||||||
GSS_S_BAD_NAME, GSS_S_BAD_MECH */
|
GSS_S_BAD_NAME, GSS_S_BAD_MECH */
|
||||||
major = (*ftab->canonicalizeName)(&minor, nameHdl, mech, &mnNameHdl);
|
major = (*ftab->canonicalizeName)(&minor, nameHdl, mech, &mnNameHdl);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_canonicalizeName] MN=%ld", (long)mnNameHdl);
|
TRACE1("[GSSLibStub_canonicalizeName] MN=%" PRIuPTR "", (uintptr_t)mnNameHdl);
|
||||||
|
|
||||||
checkStatus(env, jobj, major, minor, "[GSSLibStub_canonicalizeName]");
|
checkStatus(env, jobj, major, minor, "[GSSLibStub_canonicalizeName]");
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
if ((*env)->ExceptionCheck(env)) {
|
||||||
@ -596,7 +618,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_acquireCred(JNIEnv *env,
|
|||||||
/* release intermediate buffers */
|
/* release intermediate buffers */
|
||||||
deleteGSSOIDSet(mechs);
|
deleteGSSOIDSet(mechs);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_acquireCred] pCred=%ld", (long) credHdl);
|
TRACE1("[GSSLibStub_acquireCred] pCred=%" PRIuPTR "", (uintptr_t) credHdl);
|
||||||
|
|
||||||
checkStatus(env, jobj, major, minor, "[GSSLibStub_acquireCred]");
|
checkStatus(env, jobj, major, minor, "[GSSLibStub_acquireCred]");
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
if ((*env)->ExceptionCheck(env)) {
|
||||||
@ -645,7 +667,7 @@ void inquireCred(JNIEnv *env, jobject jobj, gss_cred_id_t pCred,
|
|||||||
|
|
||||||
credHdl = pCred;
|
credHdl = pCred;
|
||||||
|
|
||||||
TRACE1("[gss_inquire_cred] %ld", (long) pCred);
|
TRACE1("[gss_inquire_cred] %" PRIuPTR "", (uintptr_t) pCred);
|
||||||
|
|
||||||
/* gss_inquire_cred(...) => GSS_S_DEFECTIVE_CREDENTIAL(!),
|
/* gss_inquire_cred(...) => GSS_S_DEFECTIVE_CREDENTIAL(!),
|
||||||
GSS_S_CREDENTIALS_EXPIRED(!), GSS_S_NO_CRED(!) */
|
GSS_S_CREDENTIALS_EXPIRED(!), GSS_S_NO_CRED(!) */
|
||||||
@ -694,7 +716,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_getCredName(JNIEnv *env,
|
|||||||
return jlong_zero;
|
return jlong_zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_getCredName] pName=%ld", (long) nameHdl);
|
TRACE1("[GSSLibStub_getCredName] pName=%" PRIuPTR "", (uintptr_t) nameHdl);
|
||||||
return ptr_to_jlong(nameHdl);
|
return ptr_to_jlong(nameHdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -775,7 +797,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_importContext(JNIEnv *env,
|
|||||||
GSS_S_UNAVAILABLE, GSS_S_UNAUTHORIZED */
|
GSS_S_UNAVAILABLE, GSS_S_UNAUTHORIZED */
|
||||||
major = (*ftab->importSecContext)(&minor, &ctxtToken, &contextHdl);
|
major = (*ftab->importSecContext)(&minor, &ctxtToken, &contextHdl);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_importContext] pContext=%ld", (long) contextHdl);
|
TRACE1("[GSSLibStub_importContext] pContext=%" PRIuPTR "", (uintptr_t) contextHdl);
|
||||||
|
|
||||||
/* release intermediate buffers */
|
/* release intermediate buffers */
|
||||||
resetGSSBuffer(&ctxtToken);
|
resetGSSBuffer(&ctxtToken);
|
||||||
@ -866,8 +888,8 @@ Java_sun_security_jgss_wrapper_GSSLibStub_initContext(JNIEnv *env,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE2( "[GSSLibStub_initContext] before: pCred=%ld, pContext=%ld",
|
TRACE2( "[GSSLibStub_initContext] before: pCred=%" PRIuPTR ", pContext=%" PRIuPTR "",
|
||||||
(long)credHdl, (long)contextHdl);
|
(uintptr_t)credHdl, (uintptr_t)contextHdl);
|
||||||
|
|
||||||
/* gss_init_sec_context(...) => GSS_S_CONTINUE_NEEDED(!),
|
/* gss_init_sec_context(...) => GSS_S_CONTINUE_NEEDED(!),
|
||||||
GSS_S_DEFECTIVE_TOKEN, GSS_S_NO_CRED, GSS_S_DEFECTIVE_CREDENTIAL(!),
|
GSS_S_DEFECTIVE_TOKEN, GSS_S_NO_CRED, GSS_S_DEFECTIVE_CREDENTIAL(!),
|
||||||
@ -879,8 +901,8 @@ Java_sun_security_jgss_wrapper_GSSLibStub_initContext(JNIEnv *env,
|
|||||||
flags, time, cb, &inToken, NULL /*aMech*/,
|
flags, time, cb, &inToken, NULL /*aMech*/,
|
||||||
&outToken, &aFlags, &aTime);
|
&outToken, &aFlags, &aTime);
|
||||||
|
|
||||||
TRACE2("[GSSLibStub_initContext] after: pContext=%ld, outToken len=%ld",
|
TRACE2("[GSSLibStub_initContext] after: pContext=%" PRIuPTR ", outToken len=%ld",
|
||||||
(long)contextHdl, (long)outToken.length);
|
(uintptr_t)contextHdl, (long)outToken.length);
|
||||||
|
|
||||||
// update context handle with the latest value if changed
|
// update context handle with the latest value if changed
|
||||||
// this is to work with both MIT and Solaris. Former deletes half-built
|
// this is to work with both MIT and Solaris. Former deletes half-built
|
||||||
@ -888,7 +910,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_initContext(JNIEnv *env,
|
|||||||
if (contextHdl != contextHdlSave) {
|
if (contextHdl != contextHdlSave) {
|
||||||
(*env)->SetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext,
|
(*env)->SetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext,
|
||||||
ptr_to_jlong(contextHdl));
|
ptr_to_jlong(contextHdl));
|
||||||
TRACE1("[GSSLibStub_initContext] set pContext=%ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_initContext] set pContext=%" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GSS_ERROR(major) == GSS_S_COMPLETE) {
|
if (GSS_ERROR(major) == GSS_S_COMPLETE) {
|
||||||
@ -959,7 +981,6 @@ Java_sun_security_jgss_wrapper_GSSLibStub_acceptContext(JNIEnv *env,
|
|||||||
jobject jsrcName=GSS_C_NO_NAME;
|
jobject jsrcName=GSS_C_NO_NAME;
|
||||||
jobject jdelCred;
|
jobject jdelCred;
|
||||||
jobject jMech;
|
jobject jMech;
|
||||||
jbyteArray jresult;
|
|
||||||
jboolean setTarget;
|
jboolean setTarget;
|
||||||
gss_name_t targetName;
|
gss_name_t targetName;
|
||||||
jobject jtargetName;
|
jobject jtargetName;
|
||||||
@ -983,8 +1004,8 @@ Java_sun_security_jgss_wrapper_GSSLibStub_acceptContext(JNIEnv *env,
|
|||||||
setTarget = (credHdl == GSS_C_NO_CREDENTIAL);
|
setTarget = (credHdl == GSS_C_NO_CREDENTIAL);
|
||||||
aFlags = 0;
|
aFlags = 0;
|
||||||
|
|
||||||
TRACE2( "[GSSLibStub_acceptContext] before: pCred=%ld, pContext=%ld",
|
TRACE2( "[GSSLibStub_acceptContext] before: pCred=%" PRIuPTR ", pContext=%" PRIuPTR "",
|
||||||
(long) credHdl, (long) contextHdl);
|
(uintptr_t) credHdl, (uintptr_t) contextHdl);
|
||||||
|
|
||||||
/* gss_accept_sec_context(...) => GSS_S_CONTINUE_NEEDED(!),
|
/* gss_accept_sec_context(...) => GSS_S_CONTINUE_NEEDED(!),
|
||||||
GSS_S_DEFECTIVE_TOKEN, GSS_S_DEFECTIVE_CREDENTIAL(!),
|
GSS_S_DEFECTIVE_TOKEN, GSS_S_DEFECTIVE_CREDENTIAL(!),
|
||||||
@ -1000,8 +1021,8 @@ Java_sun_security_jgss_wrapper_GSSLibStub_acceptContext(JNIEnv *env,
|
|||||||
deleteGSSCB(cb);
|
deleteGSSCB(cb);
|
||||||
resetGSSBuffer(&inToken);
|
resetGSSBuffer(&inToken);
|
||||||
|
|
||||||
TRACE3("[GSSLibStub_acceptContext] after: pCred=%ld, pContext=%ld, pDelegCred=%ld",
|
TRACE3("[GSSLibStub_acceptContext] after: pCred=%" PRIuPTR ", pContext=%" PRIuPTR ", pDelegCred=%" PRIuPTR "",
|
||||||
(long)credHdl, (long)contextHdl, (long) delCred);
|
(uintptr_t)credHdl, (uintptr_t)contextHdl, (uintptr_t) delCred);
|
||||||
|
|
||||||
// update context handle with the latest value if changed
|
// update context handle with the latest value if changed
|
||||||
// this is to work with both MIT and Solaris. Former deletes half-built
|
// this is to work with both MIT and Solaris. Former deletes half-built
|
||||||
@ -1009,7 +1030,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_acceptContext(JNIEnv *env,
|
|||||||
if (contextHdl != contextHdlSave) {
|
if (contextHdl != contextHdlSave) {
|
||||||
(*env)->SetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext,
|
(*env)->SetLongField(env, jcontextSpi, FID_NativeGSSContext_pContext,
|
||||||
ptr_to_jlong(contextHdl));
|
ptr_to_jlong(contextHdl));
|
||||||
TRACE1("[GSSLibStub_acceptContext] set pContext=%ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_acceptContext] set pContext=%" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GSS_ERROR(major) == GSS_S_COMPLETE) {
|
if (GSS_ERROR(major) == GSS_S_COMPLETE) {
|
||||||
@ -1038,8 +1059,8 @@ Java_sun_security_jgss_wrapper_GSSLibStub_acceptContext(JNIEnv *env,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_acceptContext] set targetName=%ld",
|
TRACE1("[GSSLibStub_acceptContext] set targetName=%" PRIuPTR "",
|
||||||
(long)targetName);
|
(uintptr_t)targetName);
|
||||||
|
|
||||||
(*env)->SetObjectField(env, jcontextSpi, FID_NativeGSSContext_targetName,
|
(*env)->SetObjectField(env, jcontextSpi, FID_NativeGSSContext_targetName,
|
||||||
jtargetName);
|
jtargetName);
|
||||||
@ -1055,7 +1076,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_acceptContext(JNIEnv *env,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_acceptContext] set srcName=%ld", (long)srcName);
|
TRACE1("[GSSLibStub_acceptContext] set srcName=%" PRIuPTR "", (uintptr_t)srcName);
|
||||||
|
|
||||||
(*env)->SetObjectField(env, jcontextSpi, FID_NativeGSSContext_srcName,
|
(*env)->SetObjectField(env, jcontextSpi, FID_NativeGSSContext_srcName,
|
||||||
jsrcName);
|
jsrcName);
|
||||||
@ -1090,8 +1111,8 @@ Java_sun_security_jgss_wrapper_GSSLibStub_acceptContext(JNIEnv *env,
|
|||||||
(*env)->SetObjectField(env, jcontextSpi,
|
(*env)->SetObjectField(env, jcontextSpi,
|
||||||
FID_NativeGSSContext_delegatedCred,
|
FID_NativeGSSContext_delegatedCred,
|
||||||
jdelCred);
|
jdelCred);
|
||||||
TRACE1("[GSSLibStub_acceptContext] set delegatedCred=%ld",
|
TRACE1("[GSSLibStub_acceptContext] set delegatedCred=%" PRIuPTR "",
|
||||||
(long) delCred);
|
(uintptr_t) delCred);
|
||||||
|
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
if ((*env)->ExceptionCheck(env)) {
|
||||||
goto error;
|
goto error;
|
||||||
@ -1144,7 +1165,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_inquireContext(JNIEnv *env,
|
|||||||
|
|
||||||
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_inquireContext] %ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_inquireContext] %" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
|
|
||||||
srcName = targetName = GSS_C_NO_NAME;
|
srcName = targetName = GSS_C_NO_NAME;
|
||||||
time = 0;
|
time = 0;
|
||||||
@ -1155,8 +1176,8 @@ Java_sun_security_jgss_wrapper_GSSLibStub_inquireContext(JNIEnv *env,
|
|||||||
&targetName, &time, NULL, &flags,
|
&targetName, &time, NULL, &flags,
|
||||||
&isInitiator, &isEstablished);
|
&isInitiator, &isEstablished);
|
||||||
/* update member values if needed */
|
/* update member values if needed */
|
||||||
TRACE2("[GSSLibStub_inquireContext] srcName %ld, targetName %ld",
|
TRACE2("[GSSLibStub_inquireContext] srcName %" PRIuPTR ", targetName %" PRIuPTR "",
|
||||||
(long)srcName, (long)targetName);
|
(uintptr_t)srcName, (uintptr_t)targetName);
|
||||||
|
|
||||||
checkStatus(env, jobj, major, minor, "[GSSLibStub_inquireContext]");
|
checkStatus(env, jobj, major, minor, "[GSSLibStub_inquireContext]");
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
if ((*env)->ExceptionCheck(env)) {
|
||||||
@ -1225,8 +1246,8 @@ Java_sun_security_jgss_wrapper_GSSLibStub_getContextName(JNIEnv *env,
|
|||||||
|
|
||||||
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
||||||
|
|
||||||
TRACE2("[GSSLibStub_getContextName] %ld, isSrc=%d",
|
TRACE2("[GSSLibStub_getContextName] %" PRIuPTR ", isSrc=%d",
|
||||||
(long)contextHdl, isSrc);
|
(uintptr_t)contextHdl, isSrc);
|
||||||
|
|
||||||
nameHdl = GSS_C_NO_NAME;
|
nameHdl = GSS_C_NO_NAME;
|
||||||
if (isSrc == JNI_TRUE) {
|
if (isSrc == JNI_TRUE) {
|
||||||
@ -1243,7 +1264,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_getContextName(JNIEnv *env,
|
|||||||
return jlong_zero;
|
return jlong_zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_getContextName] pName=%ld", (long) nameHdl);
|
TRACE1("[GSSLibStub_getContextName] pName=%" PRIuPTR "", (uintptr_t) nameHdl);
|
||||||
|
|
||||||
return ptr_to_jlong(nameHdl);
|
return ptr_to_jlong(nameHdl);
|
||||||
}
|
}
|
||||||
@ -1263,7 +1284,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_getContextTime(JNIEnv *env,
|
|||||||
|
|
||||||
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_getContextTime] %ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_getContextTime] %" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
|
|
||||||
if (contextHdl == GSS_C_NO_CONTEXT) return 0;
|
if (contextHdl == GSS_C_NO_CONTEXT) return 0;
|
||||||
|
|
||||||
@ -1295,7 +1316,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_deleteContext(JNIEnv *env,
|
|||||||
|
|
||||||
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_deleteContext] %ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_deleteContext] %" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
|
|
||||||
if (contextHdl == GSS_C_NO_CONTEXT) return ptr_to_jlong(GSS_C_NO_CONTEXT);
|
if (contextHdl == GSS_C_NO_CONTEXT) return ptr_to_jlong(GSS_C_NO_CONTEXT);
|
||||||
|
|
||||||
@ -1329,7 +1350,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_wrapSizeLimit(JNIEnv *env,
|
|||||||
|
|
||||||
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_wrapSizeLimit] %ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_wrapSizeLimit] %" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
|
|
||||||
if (contextHdl == GSS_C_NO_CONTEXT) {
|
if (contextHdl == GSS_C_NO_CONTEXT) {
|
||||||
// Twik per javadoc
|
// Twik per javadoc
|
||||||
@ -1369,7 +1390,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_exportContext(JNIEnv *env,
|
|||||||
|
|
||||||
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_exportContext] %ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_exportContext] %" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
|
|
||||||
if (contextHdl == GSS_C_NO_CONTEXT) {
|
if (contextHdl == GSS_C_NO_CONTEXT) {
|
||||||
// Twik per javadoc
|
// Twik per javadoc
|
||||||
@ -1413,7 +1434,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_getMic(JNIEnv *env, jobject jobj,
|
|||||||
|
|
||||||
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_getMic] %ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_getMic] %" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
|
|
||||||
if (contextHdl == GSS_C_NO_CONTEXT) {
|
if (contextHdl == GSS_C_NO_CONTEXT) {
|
||||||
// Twik per javadoc
|
// Twik per javadoc
|
||||||
@ -1466,7 +1487,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_verifyMic(JNIEnv *env,
|
|||||||
|
|
||||||
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_verifyMic] %ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_verifyMic] %" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
|
|
||||||
if (contextHdl == GSS_C_NO_CONTEXT) {
|
if (contextHdl == GSS_C_NO_CONTEXT) {
|
||||||
// Twik per javadoc
|
// Twik per javadoc
|
||||||
@ -1537,7 +1558,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_wrap(JNIEnv *env,
|
|||||||
|
|
||||||
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_wrap] %ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_wrap] %" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
|
|
||||||
if (contextHdl == GSS_C_NO_CONTEXT) {
|
if (contextHdl == GSS_C_NO_CONTEXT) {
|
||||||
// Twik per javadoc
|
// Twik per javadoc
|
||||||
@ -1609,7 +1630,7 @@ Java_sun_security_jgss_wrapper_GSSLibStub_unwrap(JNIEnv *env,
|
|||||||
|
|
||||||
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
contextHdl = (gss_ctx_id_t) jlong_to_ptr(pContext);
|
||||||
|
|
||||||
TRACE1("[GSSLibStub_unwrap] %ld", (long)contextHdl);
|
TRACE1("[GSSLibStub_unwrap] %" PRIuPTR "", (uintptr_t)contextHdl);
|
||||||
|
|
||||||
if (contextHdl == GSS_C_NO_CONTEXT) {
|
if (contextHdl == GSS_C_NO_CONTEXT) {
|
||||||
// Twik per javadoc
|
// Twik per javadoc
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <dlfcn.h>
|
|
||||||
#include "NativeFunc.h"
|
#include "NativeFunc.h"
|
||||||
|
|
||||||
/* standard GSS method names (ordering is from mapfile) */
|
/* standard GSS method names (ordering is from mapfile) */
|
||||||
@ -64,18 +63,16 @@ static const char RELEASE_BUFFER[] = "gss_release_buffer";
|
|||||||
/**
|
/**
|
||||||
* Initialize native GSS function pointers
|
* Initialize native GSS function pointers
|
||||||
*/
|
*/
|
||||||
char* loadNative(const char *libName) {
|
int loadNative(const char *libName) {
|
||||||
|
|
||||||
char *error;
|
|
||||||
void *gssLib;
|
void *gssLib;
|
||||||
int failed;
|
int failed;
|
||||||
OM_uint32 minor, major;
|
OM_uint32 minor, major;
|
||||||
|
|
||||||
ftab = NULL;
|
ftab = NULL;
|
||||||
failed = FALSE;
|
failed = FALSE;
|
||||||
error = NULL;
|
|
||||||
|
|
||||||
gssLib = dlopen(libName, RTLD_NOW);
|
gssLib = GETLIB(libName);
|
||||||
if (gssLib == NULL) {
|
if (gssLib == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
@ -88,183 +85,183 @@ char* loadNative(const char *libName) {
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->releaseName = (RELEASE_NAME_FN_PTR)dlsym(gssLib, RELEASE_NAME);
|
ftab->releaseName = (RELEASE_NAME_FN_PTR)GETFUNC(gssLib, RELEASE_NAME);
|
||||||
if (ftab->releaseName == NULL) {
|
if (ftab->releaseName == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->importName = (IMPORT_NAME_FN_PTR)dlsym(gssLib, IMPORT_NAME);
|
ftab->importName = (IMPORT_NAME_FN_PTR)GETFUNC(gssLib, IMPORT_NAME);
|
||||||
if (ftab->importName == NULL) {
|
if (ftab->importName == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->compareName = (COMPARE_NAME_FN_PTR)dlsym(gssLib, COMPARE_NAME);
|
ftab->compareName = (COMPARE_NAME_FN_PTR)GETFUNC(gssLib, COMPARE_NAME);
|
||||||
if (ftab->compareName == NULL) {
|
if (ftab->compareName == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->canonicalizeName = (CANONICALIZE_NAME_FN_PTR)
|
ftab->canonicalizeName = (CANONICALIZE_NAME_FN_PTR)
|
||||||
dlsym(gssLib, CANONICALIZE_NAME);
|
GETFUNC(gssLib, CANONICALIZE_NAME);
|
||||||
if (ftab->canonicalizeName == NULL) {
|
if (ftab->canonicalizeName == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->exportName = (EXPORT_NAME_FN_PTR)dlsym(gssLib, EXPORT_NAME);
|
ftab->exportName = (EXPORT_NAME_FN_PTR)GETFUNC(gssLib, EXPORT_NAME);
|
||||||
if (ftab->exportName == NULL) {
|
if (ftab->exportName == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->displayName = (DISPLAY_NAME_FN_PTR)dlsym(gssLib, DISPLAY_NAME);
|
ftab->displayName = (DISPLAY_NAME_FN_PTR)GETFUNC(gssLib, DISPLAY_NAME);
|
||||||
if (ftab->displayName == NULL) {
|
if (ftab->displayName == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->acquireCred = (ACQUIRE_CRED_FN_PTR)dlsym(gssLib, ACQUIRE_CRED);
|
ftab->acquireCred = (ACQUIRE_CRED_FN_PTR)GETFUNC(gssLib, ACQUIRE_CRED);
|
||||||
if (ftab->acquireCred == NULL) {
|
if (ftab->acquireCred == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->releaseCred = (RELEASE_CRED_FN_PTR)dlsym(gssLib, RELEASE_CRED);
|
ftab->releaseCred = (RELEASE_CRED_FN_PTR)GETFUNC(gssLib, RELEASE_CRED);
|
||||||
if (ftab->releaseCred == NULL) {
|
if (ftab->releaseCred == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->inquireCred = (INQUIRE_CRED_FN_PTR)dlsym(gssLib, INQUIRE_CRED);
|
ftab->inquireCred = (INQUIRE_CRED_FN_PTR)GETFUNC(gssLib, INQUIRE_CRED);
|
||||||
if (ftab->inquireCred == NULL) {
|
if (ftab->inquireCred == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->importSecContext = (IMPORT_SEC_CONTEXT_FN_PTR)
|
ftab->importSecContext = (IMPORT_SEC_CONTEXT_FN_PTR)
|
||||||
dlsym(gssLib, IMPORT_SEC_CONTEXT);
|
GETFUNC(gssLib, IMPORT_SEC_CONTEXT);
|
||||||
if (ftab->importSecContext == NULL) {
|
if (ftab->importSecContext == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->initSecContext = (INIT_SEC_CONTEXT_FN_PTR)
|
ftab->initSecContext = (INIT_SEC_CONTEXT_FN_PTR)
|
||||||
dlsym(gssLib, INIT_SEC_CONTEXT);
|
GETFUNC(gssLib, INIT_SEC_CONTEXT);
|
||||||
if (ftab->initSecContext == NULL) {
|
if (ftab->initSecContext == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->acceptSecContext = (ACCEPT_SEC_CONTEXT_FN_PTR)
|
ftab->acceptSecContext = (ACCEPT_SEC_CONTEXT_FN_PTR)
|
||||||
dlsym(gssLib, ACCEPT_SEC_CONTEXT);
|
GETFUNC(gssLib, ACCEPT_SEC_CONTEXT);
|
||||||
if (ftab->acceptSecContext == NULL) {
|
if (ftab->acceptSecContext == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->inquireContext = (INQUIRE_CONTEXT_FN_PTR)
|
ftab->inquireContext = (INQUIRE_CONTEXT_FN_PTR)
|
||||||
dlsym(gssLib, INQUIRE_CONTEXT);
|
GETFUNC(gssLib, INQUIRE_CONTEXT);
|
||||||
if (ftab->inquireContext == NULL) {
|
if (ftab->inquireContext == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->deleteSecContext = (DELETE_SEC_CONTEXT_FN_PTR)
|
ftab->deleteSecContext = (DELETE_SEC_CONTEXT_FN_PTR)
|
||||||
dlsym(gssLib, DELETE_SEC_CONTEXT);
|
GETFUNC(gssLib, DELETE_SEC_CONTEXT);
|
||||||
if (ftab->deleteSecContext == NULL) {
|
if (ftab->deleteSecContext == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->contextTime = (CONTEXT_TIME_FN_PTR)dlsym(gssLib, CONTEXT_TIME);
|
ftab->contextTime = (CONTEXT_TIME_FN_PTR)GETFUNC(gssLib, CONTEXT_TIME);
|
||||||
if (ftab->contextTime == NULL) {
|
if (ftab->contextTime == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->wrapSizeLimit = (WRAP_SIZE_LIMIT_FN_PTR)
|
ftab->wrapSizeLimit = (WRAP_SIZE_LIMIT_FN_PTR)
|
||||||
dlsym(gssLib, WRAP_SIZE_LIMIT);
|
GETFUNC(gssLib, WRAP_SIZE_LIMIT);
|
||||||
if (ftab->wrapSizeLimit == NULL) {
|
if (ftab->wrapSizeLimit == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->exportSecContext = (EXPORT_SEC_CONTEXT_FN_PTR)
|
ftab->exportSecContext = (EXPORT_SEC_CONTEXT_FN_PTR)
|
||||||
dlsym(gssLib, EXPORT_SEC_CONTEXT);
|
GETFUNC(gssLib, EXPORT_SEC_CONTEXT);
|
||||||
if (ftab->exportSecContext == NULL) {
|
if (ftab->exportSecContext == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->getMic = (GET_MIC_FN_PTR)dlsym(gssLib, GET_MIC);
|
ftab->getMic = (GET_MIC_FN_PTR)GETFUNC(gssLib, GET_MIC);
|
||||||
if (ftab->getMic == NULL) {
|
if (ftab->getMic == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->verifyMic = (VERIFY_MIC_FN_PTR)dlsym(gssLib, VERIFY_MIC);
|
ftab->verifyMic = (VERIFY_MIC_FN_PTR)GETFUNC(gssLib, VERIFY_MIC);
|
||||||
if (ftab->verifyMic == NULL) {
|
if (ftab->verifyMic == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->wrap = (WRAP_FN_PTR)dlsym(gssLib, WRAP);
|
ftab->wrap = (WRAP_FN_PTR)GETFUNC(gssLib, WRAP);
|
||||||
if (ftab->wrap == NULL) {
|
if (ftab->wrap == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->unwrap = (UNWRAP_FN_PTR)dlsym(gssLib, UNWRAP);
|
ftab->unwrap = (UNWRAP_FN_PTR)GETFUNC(gssLib, UNWRAP);
|
||||||
if (ftab->unwrap == NULL) {
|
if (ftab->unwrap == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->indicateMechs = (INDICATE_MECHS_FN_PTR)dlsym(gssLib, INDICATE_MECHS);
|
ftab->indicateMechs = (INDICATE_MECHS_FN_PTR)GETFUNC(gssLib, INDICATE_MECHS);
|
||||||
if (ftab->indicateMechs == NULL) {
|
if (ftab->indicateMechs == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->inquireNamesForMech = (INQUIRE_NAMES_FOR_MECH_FN_PTR)
|
ftab->inquireNamesForMech = (INQUIRE_NAMES_FOR_MECH_FN_PTR)
|
||||||
dlsym(gssLib, INQUIRE_NAMES_FOR_MECH);
|
GETFUNC(gssLib, INQUIRE_NAMES_FOR_MECH);
|
||||||
if (ftab->inquireNamesForMech == NULL) {
|
if (ftab->inquireNamesForMech == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->addOidSetMember = (ADD_OID_SET_MEMBER_FN_PTR)
|
ftab->addOidSetMember = (ADD_OID_SET_MEMBER_FN_PTR)
|
||||||
dlsym(gssLib, ADD_OID_SET_MEMBER);
|
GETFUNC(gssLib, ADD_OID_SET_MEMBER);
|
||||||
if (ftab->addOidSetMember == NULL) {
|
if (ftab->addOidSetMember == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->displayStatus = (DISPLAY_STATUS_FN_PTR)
|
ftab->displayStatus = (DISPLAY_STATUS_FN_PTR)
|
||||||
dlsym(gssLib, DISPLAY_STATUS);
|
GETFUNC(gssLib, DISPLAY_STATUS);
|
||||||
if (ftab->displayStatus == NULL) {
|
if (ftab->displayStatus == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->createEmptyOidSet = (CREATE_EMPTY_OID_SET_FN_PTR)
|
ftab->createEmptyOidSet = (CREATE_EMPTY_OID_SET_FN_PTR)
|
||||||
dlsym(gssLib, CREATE_EMPTY_OID_SET);
|
GETFUNC(gssLib, CREATE_EMPTY_OID_SET);
|
||||||
if (ftab->createEmptyOidSet == NULL) {
|
if (ftab->createEmptyOidSet == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->releaseOidSet = (RELEASE_OID_SET_FN_PTR)
|
ftab->releaseOidSet = (RELEASE_OID_SET_FN_PTR)
|
||||||
dlsym(gssLib, RELEASE_OID_SET);
|
GETFUNC(gssLib, RELEASE_OID_SET);
|
||||||
if (ftab->releaseOidSet == NULL) {
|
if (ftab->releaseOidSet == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ftab->releaseBuffer = (RELEASE_BUFFER_FN_PTR)
|
ftab->releaseBuffer = (RELEASE_BUFFER_FN_PTR)
|
||||||
dlsym(gssLib, RELEASE_BUFFER);
|
GETFUNC(gssLib, RELEASE_BUFFER);
|
||||||
if (ftab->releaseBuffer == NULL) {
|
if (ftab->releaseBuffer == NULL) {
|
||||||
failed = TRUE;
|
failed = TRUE;
|
||||||
goto out;
|
goto out;
|
||||||
@ -280,9 +277,8 @@ char* loadNative(const char *libName) {
|
|||||||
|
|
||||||
out:
|
out:
|
||||||
if (failed == TRUE) {
|
if (failed == TRUE) {
|
||||||
error = dlerror();
|
if (gssLib != NULL) CLOSELIB(gssLib);
|
||||||
if (gssLib != NULL) dlclose(gssLib);
|
|
||||||
if (ftab != NULL) free(ftab);
|
if (ftab != NULL) free(ftab);
|
||||||
}
|
}
|
||||||
return error;
|
return failed;
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -28,6 +28,18 @@
|
|||||||
|
|
||||||
#include "gssapi.h"
|
#include "gssapi.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <windows.h>
|
||||||
|
#define GETLIB(libName) LoadLibrary(libName)
|
||||||
|
#define GETFUNC(lib,name) GetProcAddress(lib,name)
|
||||||
|
#define CLOSELIB(lib) CloseHandle(lib)
|
||||||
|
#else
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#define GETLIB(libName) dlopen(libName, RTLD_NOW)
|
||||||
|
#define GETFUNC(lib,name) dlsym(lib,name)
|
||||||
|
#define CLOSELIB(lib) dlclose(lib)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef TRUE
|
#ifndef TRUE
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#endif
|
#endif
|
||||||
@ -36,7 +48,7 @@
|
|||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char* loadNative(const char *libName);
|
int loadNative(const char *libName);
|
||||||
|
|
||||||
/* function pointer definitions */
|
/* function pointer definitions */
|
||||||
typedef OM_uint32 (*RELEASE_NAME_FN_PTR)
|
typedef OM_uint32 (*RELEASE_NAME_FN_PTR)
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -469,7 +469,7 @@ jstring getJavaString(JNIEnv *env, gss_buffer_t bytes) {
|
|||||||
if (bytes != NULL) {
|
if (bytes != NULL) {
|
||||||
/* constructs the String object with new String(byte[])
|
/* constructs the String object with new String(byte[])
|
||||||
NOTE: do NOT include the trailing NULL */
|
NOTE: do NOT include the trailing NULL */
|
||||||
len = bytes->length;
|
len = (int) bytes->length;
|
||||||
jbytes = (*env)->NewByteArray(env, len);
|
jbytes = (*env)->NewByteArray(env, len);
|
||||||
if (jbytes == NULL) {
|
if (jbytes == NULL) {
|
||||||
goto finish;
|
goto finish;
|
||||||
@ -497,7 +497,6 @@ jstring getMinorMessage(JNIEnv *env, jobject jstub, OM_uint32 statusValue) {
|
|||||||
OM_uint32 messageContext, minor, major;
|
OM_uint32 messageContext, minor, major;
|
||||||
gss_buffer_desc statusString;
|
gss_buffer_desc statusString;
|
||||||
gss_OID mech;
|
gss_OID mech;
|
||||||
jstring msg;
|
|
||||||
|
|
||||||
messageContext = 0;
|
messageContext = 0;
|
||||||
if (jstub != NULL) {
|
if (jstub != NULL) {
|
||||||
@ -636,11 +635,11 @@ jbyteArray getJavaBuffer(JNIEnv *env, gss_buffer_t cbytes) {
|
|||||||
|
|
||||||
if (cbytes != NULL) {
|
if (cbytes != NULL) {
|
||||||
if ((cbytes != GSS_C_NO_BUFFER) && (cbytes->length != 0)) {
|
if ((cbytes != GSS_C_NO_BUFFER) && (cbytes->length != 0)) {
|
||||||
result = (*env)->NewByteArray(env, cbytes->length);
|
result = (*env)->NewByteArray(env, (int) cbytes->length);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
goto finish;
|
goto finish;
|
||||||
}
|
}
|
||||||
(*env)->SetByteArrayRegion(env, result, 0, cbytes->length,
|
(*env)->SetByteArrayRegion(env, result, 0, (int) cbytes->length,
|
||||||
cbytes->value);
|
cbytes->value);
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
if ((*env)->ExceptionCheck(env)) {
|
||||||
result = NULL;
|
result = NULL;
|
||||||
@ -661,7 +660,6 @@ jbyteArray getJavaBuffer(JNIEnv *env, gss_buffer_t cbytes) {
|
|||||||
gss_OID newGSSOID(JNIEnv *env, jobject jOid) {
|
gss_OID newGSSOID(JNIEnv *env, jobject jOid) {
|
||||||
jbyteArray jbytes;
|
jbyteArray jbytes;
|
||||||
gss_OID cOid;
|
gss_OID cOid;
|
||||||
jthrowable gssEx;
|
|
||||||
if (jOid != NULL) {
|
if (jOid != NULL) {
|
||||||
jbytes = (*env)->CallObjectMethod(env, jOid, MID_Oid_getDER);
|
jbytes = (*env)->CallObjectMethod(env, jOid, MID_Oid_getDER);
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
if ((*env)->ExceptionCheck(env)) {
|
||||||
@ -783,10 +781,9 @@ jobjectArray getJavaOIDArray(JNIEnv *env, gss_OID_set cOidSet) {
|
|||||||
jobjectArray jOidSet;
|
jobjectArray jOidSet;
|
||||||
jobject jOid;
|
jobject jOid;
|
||||||
int i;
|
int i;
|
||||||
jthrowable gssEx;
|
|
||||||
|
|
||||||
if (cOidSet != NULL && cOidSet != GSS_C_NO_OID_SET) {
|
if (cOidSet != NULL && cOidSet != GSS_C_NO_OID_SET) {
|
||||||
numOfOids = cOidSet->count;
|
numOfOids = (int) cOidSet->count;
|
||||||
jOidSet = (*env)->NewObjectArray(env, numOfOids, CLS_Oid, NULL);
|
jOidSet = (*env)->NewObjectArray(env, numOfOids, CLS_Oid, NULL);
|
||||||
if ((*env)->ExceptionCheck(env)) {
|
if ((*env)->ExceptionCheck(env)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,6 +26,7 @@
|
|||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include "gssapi.h"
|
#include "gssapi.h"
|
||||||
|
|
||||||
#ifndef _Included_NATIVE_Util
|
#ifndef _Included_NATIVE_Util
|
||||||
|
@ -387,7 +387,7 @@ GSS_DLLIMP extern gss_OID GSS_C_NT_EXPORT_NAME;
|
|||||||
|
|
||||||
/* Function Prototypes */
|
/* Function Prototypes */
|
||||||
|
|
||||||
OM_uint32 gss_acquire_cred(
|
GSS_DLLIMP OM_uint32 gss_acquire_cred(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_name_t, /* desired_name */
|
gss_name_t, /* desired_name */
|
||||||
OM_uint32, /* time_req */
|
OM_uint32, /* time_req */
|
||||||
@ -398,12 +398,12 @@ OM_uint32 gss_acquire_cred(
|
|||||||
OM_uint32 * /* time_rec */
|
OM_uint32 * /* time_rec */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_release_cred(
|
GSS_DLLIMP OM_uint32 gss_release_cred(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_cred_id_t * /* cred_handle */
|
gss_cred_id_t * /* cred_handle */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_init_sec_context(
|
GSS_DLLIMP OM_uint32 gss_init_sec_context(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_cred_id_t, /* claimant_cred_handle */
|
gss_cred_id_t, /* claimant_cred_handle */
|
||||||
gss_ctx_id_t *, /* context_handle */
|
gss_ctx_id_t *, /* context_handle */
|
||||||
@ -419,7 +419,7 @@ OM_uint32 gss_init_sec_context(
|
|||||||
OM_uint32 * /* time_rec */
|
OM_uint32 * /* time_rec */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_accept_sec_context(
|
GSS_DLLIMP OM_uint32 gss_accept_sec_context(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t *, /* context_handle */
|
gss_ctx_id_t *, /* context_handle */
|
||||||
gss_cred_id_t, /* acceptor_cred_handle */
|
gss_cred_id_t, /* acceptor_cred_handle */
|
||||||
@ -433,26 +433,26 @@ OM_uint32 gss_accept_sec_context(
|
|||||||
gss_cred_id_t * /* delegated_cred_handle */
|
gss_cred_id_t * /* delegated_cred_handle */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_process_context_token(
|
GSS_DLLIMP OM_uint32 gss_process_context_token(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t, /* context_handle */
|
gss_ctx_id_t, /* context_handle */
|
||||||
gss_buffer_t /* token_buffer */
|
gss_buffer_t /* token_buffer */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_delete_sec_context(
|
GSS_DLLIMP OM_uint32 gss_delete_sec_context(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t *, /* context_handle */
|
gss_ctx_id_t *, /* context_handle */
|
||||||
gss_buffer_t /* output_token */
|
gss_buffer_t /* output_token */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_context_time(
|
GSS_DLLIMP OM_uint32 gss_context_time(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t, /* context_handle */
|
gss_ctx_id_t, /* context_handle */
|
||||||
OM_uint32 * /* time_rec */
|
OM_uint32 * /* time_rec */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_get_mic(
|
GSS_DLLIMP OM_uint32 gss_get_mic(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t, /* context_handle */
|
gss_ctx_id_t, /* context_handle */
|
||||||
gss_qop_t, /* qop_req */
|
gss_qop_t, /* qop_req */
|
||||||
@ -461,7 +461,7 @@ OM_uint32 gss_get_mic(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_verify_mic(
|
GSS_DLLIMP OM_uint32 gss_verify_mic(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t, /* context_handle */
|
gss_ctx_id_t, /* context_handle */
|
||||||
gss_buffer_t, /* message_buffer */
|
gss_buffer_t, /* message_buffer */
|
||||||
@ -470,7 +470,7 @@ OM_uint32 gss_verify_mic(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_wrap(
|
GSS_DLLIMP OM_uint32 gss_wrap(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t, /* context_handle */
|
gss_ctx_id_t, /* context_handle */
|
||||||
int, /* conf_req_flag */
|
int, /* conf_req_flag */
|
||||||
@ -481,7 +481,7 @@ OM_uint32 gss_wrap(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_unwrap(
|
GSS_DLLIMP OM_uint32 gss_unwrap(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t, /* context_handle */
|
gss_ctx_id_t, /* context_handle */
|
||||||
gss_buffer_t, /* input_message_buffer */
|
gss_buffer_t, /* input_message_buffer */
|
||||||
@ -490,7 +490,7 @@ OM_uint32 gss_unwrap(
|
|||||||
gss_qop_t * /* qop_state */
|
gss_qop_t * /* qop_state */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_display_status(
|
GSS_DLLIMP OM_uint32 gss_display_status(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
OM_uint32, /* status_value */
|
OM_uint32, /* status_value */
|
||||||
int, /* status_type */
|
int, /* status_type */
|
||||||
@ -499,48 +499,48 @@ OM_uint32 gss_display_status(
|
|||||||
gss_buffer_t /* status_string */
|
gss_buffer_t /* status_string */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_indicate_mechs(
|
GSS_DLLIMP OM_uint32 gss_indicate_mechs(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_OID_set * /* mech_set */
|
gss_OID_set * /* mech_set */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_compare_name(
|
GSS_DLLIMP OM_uint32 gss_compare_name(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_name_t, /* name1 */
|
gss_name_t, /* name1 */
|
||||||
gss_name_t, /* name2 */
|
gss_name_t, /* name2 */
|
||||||
int * /* name_equal */
|
int * /* name_equal */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_display_name(
|
GSS_DLLIMP OM_uint32 gss_display_name(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_name_t, /* input_name */
|
gss_name_t, /* input_name */
|
||||||
gss_buffer_t, /* output_name_buffer */
|
gss_buffer_t, /* output_name_buffer */
|
||||||
gss_OID * /* output_name_type */
|
gss_OID * /* output_name_type */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_import_name(
|
GSS_DLLIMP OM_uint32 gss_import_name(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_buffer_t, /* input_name_buffer */
|
gss_buffer_t, /* input_name_buffer */
|
||||||
gss_OID, /* input_name_type(used to be const) */
|
gss_OID, /* input_name_type(used to be const) */
|
||||||
gss_name_t * /* output_name */
|
gss_name_t * /* output_name */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_release_name(
|
GSS_DLLIMP OM_uint32 gss_release_name(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_name_t * /* input_name */
|
gss_name_t * /* input_name */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_release_buffer(
|
GSS_DLLIMP OM_uint32 gss_release_buffer(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_buffer_t /* buffer */
|
gss_buffer_t /* buffer */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_release_oid_set(
|
GSS_DLLIMP OM_uint32 gss_release_oid_set(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_OID_set * /* set */
|
gss_OID_set * /* set */
|
||||||
);
|
);
|
||||||
|
|
||||||
OM_uint32 gss_inquire_cred(
|
GSS_DLLIMP OM_uint32 gss_inquire_cred(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_cred_id_t, /* cred_handle */
|
gss_cred_id_t, /* cred_handle */
|
||||||
gss_name_t *, /* name */
|
gss_name_t *, /* name */
|
||||||
@ -550,7 +550,7 @@ OM_uint32 gss_inquire_cred(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* Last argument new for V2 */
|
/* Last argument new for V2 */
|
||||||
OM_uint32 gss_inquire_context(
|
GSS_DLLIMP OM_uint32 gss_inquire_context(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t, /* context_handle */
|
gss_ctx_id_t, /* context_handle */
|
||||||
gss_name_t *, /* src_name */
|
gss_name_t *, /* src_name */
|
||||||
@ -563,7 +563,7 @@ OM_uint32 gss_inquire_context(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_wrap_size_limit(
|
GSS_DLLIMP OM_uint32 gss_wrap_size_limit(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t, /* context_handle */
|
gss_ctx_id_t, /* context_handle */
|
||||||
int, /* conf_req_flag */
|
int, /* conf_req_flag */
|
||||||
@ -573,7 +573,7 @@ OM_uint32 gss_wrap_size_limit(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_add_cred(
|
GSS_DLLIMP OM_uint32 gss_add_cred(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_cred_id_t, /* input_cred_handle */
|
gss_cred_id_t, /* input_cred_handle */
|
||||||
gss_name_t, /* desired_name */
|
gss_name_t, /* desired_name */
|
||||||
@ -588,7 +588,7 @@ OM_uint32 gss_add_cred(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_inquire_cred_by_mech(
|
GSS_DLLIMP OM_uint32 gss_inquire_cred_by_mech(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_cred_id_t, /* cred_handle */
|
gss_cred_id_t, /* cred_handle */
|
||||||
gss_OID, /* mech_type */
|
gss_OID, /* mech_type */
|
||||||
@ -599,40 +599,40 @@ OM_uint32 gss_inquire_cred_by_mech(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_export_sec_context(
|
GSS_DLLIMP OM_uint32 gss_export_sec_context(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_ctx_id_t *, /* context_handle */
|
gss_ctx_id_t *, /* context_handle */
|
||||||
gss_buffer_t /* interprocess_token */
|
gss_buffer_t /* interprocess_token */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_import_sec_context(
|
GSS_DLLIMP OM_uint32 gss_import_sec_context(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_buffer_t, /* interprocess_token */
|
gss_buffer_t, /* interprocess_token */
|
||||||
gss_ctx_id_t * /* context_handle */
|
gss_ctx_id_t * /* context_handle */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_release_oid(
|
GSS_DLLIMP OM_uint32 gss_release_oid(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_OID * /* oid */
|
gss_OID * /* oid */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_create_empty_oid_set(
|
GSS_DLLIMP OM_uint32 gss_create_empty_oid_set(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_OID_set * /* oid_set */
|
gss_OID_set * /* oid_set */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_add_oid_set_member(
|
GSS_DLLIMP OM_uint32 gss_add_oid_set_member(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_OID, /* member_oid */
|
gss_OID, /* member_oid */
|
||||||
gss_OID_set * /* oid_set */
|
gss_OID_set * /* oid_set */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_test_oid_set_member(
|
GSS_DLLIMP OM_uint32 gss_test_oid_set_member(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_OID, /* member */
|
gss_OID, /* member */
|
||||||
gss_OID_set, /* set */
|
gss_OID_set, /* set */
|
||||||
@ -640,42 +640,42 @@ OM_uint32 gss_test_oid_set_member(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_str_to_oid(
|
GSS_DLLIMP OM_uint32 gss_str_to_oid(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_buffer_t, /* oid_str */
|
gss_buffer_t, /* oid_str */
|
||||||
gss_OID * /* oid */
|
gss_OID * /* oid */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_oid_to_str(
|
GSS_DLLIMP OM_uint32 gss_oid_to_str(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_OID, /* oid */
|
gss_OID, /* oid */
|
||||||
gss_buffer_t /* oid_str */
|
gss_buffer_t /* oid_str */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_inquire_names_for_mech(
|
GSS_DLLIMP OM_uint32 gss_inquire_names_for_mech(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
gss_OID, /* mechanism */
|
gss_OID, /* mechanism */
|
||||||
gss_OID_set * /* name_types */
|
gss_OID_set * /* name_types */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_export_name(
|
GSS_DLLIMP OM_uint32 gss_export_name(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
const gss_name_t, /* input_name */
|
const gss_name_t, /* input_name */
|
||||||
gss_buffer_t /* exported_name */
|
gss_buffer_t /* exported_name */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_duplicate_name(
|
GSS_DLLIMP OM_uint32 gss_duplicate_name(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
const gss_name_t, /* input_name */
|
const gss_name_t, /* input_name */
|
||||||
gss_name_t * /* dest_name */
|
gss_name_t * /* dest_name */
|
||||||
);
|
);
|
||||||
|
|
||||||
/* New for V2 */
|
/* New for V2 */
|
||||||
OM_uint32 gss_canonicalize_name(
|
GSS_DLLIMP OM_uint32 gss_canonicalize_name(
|
||||||
OM_uint32 *, /* minor_status */
|
OM_uint32 *, /* minor_status */
|
||||||
const gss_name_t, /* input_name */
|
const gss_name_t, /* input_name */
|
||||||
const gss_OID, /* mech_type */
|
const gss_OID, /* mech_type */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -297,6 +297,9 @@ public class Proc {
|
|||||||
}
|
}
|
||||||
if (debug != null) {
|
if (debug != null) {
|
||||||
System.out.println("PROC: " + debug + " cmdline: " + cmd);
|
System.out.println("PROC: " + debug + " cmdline: " + cmd);
|
||||||
|
for (String e : env.keySet()) {
|
||||||
|
System.out.print(e + "=" + env.get(e) + " ");
|
||||||
|
}
|
||||||
for (String c : cmd) {
|
for (String c : cmd) {
|
||||||
if (c.indexOf('\\') >= 0 || c.indexOf(' ') > 0) {
|
if (c.indexOf('\\') >= 0 || c.indexOf(' ') > 0) {
|
||||||
System.out.print('\'' + c + '\'');
|
System.out.print('\'' + c + '\'');
|
||||||
|
@ -40,6 +40,7 @@ import java.util.PropertyPermission;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import jdk.test.lib.Platform;
|
||||||
import org.ietf.jgss.Oid;
|
import org.ietf.jgss.Oid;
|
||||||
import sun.security.krb5.Config;
|
import sun.security.krb5.Config;
|
||||||
|
|
||||||
@ -239,10 +240,12 @@ public class BasicProc {
|
|||||||
pc.perm(new PropertyPermission("user.name", "read"));
|
pc.perm(new PropertyPermission("user.name", "read"));
|
||||||
} else {
|
} else {
|
||||||
Files.copy(Paths.get("base.ccache"), Paths.get(label + ".ccache"));
|
Files.copy(Paths.get("base.ccache"), Paths.get(label + ".ccache"));
|
||||||
Files.setPosixFilePermissions(Paths.get(label + ".ccache"),
|
if (!Platform.isWindows()) {
|
||||||
Set.of(PosixFilePermission.OWNER_READ,
|
Files.setPosixFilePermissions(Paths.get(label + ".ccache"),
|
||||||
PosixFilePermission.OWNER_WRITE));
|
Set.of(PosixFilePermission.OWNER_READ,
|
||||||
pc.env("KRB5CCNAME", label + ".ccache");
|
PosixFilePermission.OWNER_WRITE));
|
||||||
|
}
|
||||||
|
pc.env("KRB5CCNAME", "FILE:" + label + ".ccache");
|
||||||
// Do not try system ktab if ccache fails
|
// Do not try system ktab if ccache fails
|
||||||
pc.env("KRB5_KTNAME", "none");
|
pc.env("KRB5_KTNAME", "none");
|
||||||
}
|
}
|
||||||
@ -310,7 +313,7 @@ public class BasicProc {
|
|||||||
.perm(new javax.security.auth.AuthPermission("doAs"));
|
.perm(new javax.security.auth.AuthPermission("doAs"));
|
||||||
if (lib != null) {
|
if (lib != null) {
|
||||||
p.env("KRB5_CONFIG", CONF)
|
p.env("KRB5_CONFIG", CONF)
|
||||||
.env("KRB5_TRACE", "/dev/stderr")
|
.env("KRB5_TRACE", Platform.isWindows() ? "CON" : "/dev/stderr")
|
||||||
.prop("sun.security.jgss.native", "true")
|
.prop("sun.security.jgss.native", "true")
|
||||||
.prop("sun.security.jgss.lib", lib)
|
.prop("sun.security.jgss.lib", lib)
|
||||||
.prop("javax.security.auth.useSubjectCredsOnly", "false")
|
.prop("javax.security.auth.useSubjectCredsOnly", "false")
|
||||||
|
Loading…
Reference in New Issue
Block a user