Completed the Authtoken Validate Service changes.
This commit is contained in:
@@ -40,9 +40,8 @@ ROOT = ../../../..
|
||||
|
||||
LIBDIR = $(ROOT)/$(LIB)
|
||||
BINDIR = $(ROOT)/$(BIN)
|
||||
#JAVA_LIBDIR = /usr/lib/jvm/java-1.5.0-sun-1.5.0_07/jre/lib/i386/server
|
||||
JAVA_LIBDIR = /usr/lib/jvm/jre-1.5.0-sun/lib/$(HOSTTYPE)/server
|
||||
JAVA_INCDIR = /usr/lib/jvm/java-1.5.0-sun/include
|
||||
JAVA_LIBDIR = /usr/lib/jvm/java-1.5.0-ibm/jre/bin
|
||||
JAVA_INCDIR = /usr/lib/jvm/java-1.5.0-ibm/include
|
||||
|
||||
# handle Mono secondary dependencies
|
||||
export MONO_PATH := $(MONO_PATH)
|
||||
@@ -54,13 +53,13 @@ CFILES =
|
||||
CPPFILES = server.cpp
|
||||
|
||||
CSFILES_CSC :=
|
||||
INCLUDES = -I. -I$(ROOT)/include -I$(JAVA_INCDIR) -I$(JAVA_INCDIR)/linux
|
||||
INCLUDES = -I. -I$(ROOT)/include -I$(JAVA_INCDIR)
|
||||
RESOURCES =
|
||||
DEFINES += -Wno-format-extra-args -fno-strict-aliasing -fshort-wchar
|
||||
DEFINES += -fno-strict-aliasing -fshort-wchar
|
||||
CFLAGS += $(INCLUDES) $(DEFINES)
|
||||
CPPFLAGS += -fPIC $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
|
||||
LIBS = -lpthread -lcasa_s_ipc -ljvm
|
||||
LDFLAGS = -L$(LIBDIR)/$(TARGET_CFG) -L$(JAVA_LIBDIR) -Xlinker -rpath -Xlinker $(JAVA_LIBDIR)
|
||||
LIBS = -lpthread -lcasa_s_ipc -ljvm -ljsig -lj9thr23
|
||||
LDFLAGS = -L$(LIBDIR)/$(TARGET_CFG) -L$(JAVA_LIBDIR) -L$(JAVA_LIBDIR)/classic
|
||||
|
||||
OBJDIR = ./$(TARGET_CFG)/$(LIB)
|
||||
OBJS = $(addprefix $(OBJDIR)/, $(CFILES:%.c=%.o)) $(addprefix $(OBJDIR)/, $(CPPFILES:%.cpp=%.o))
|
||||
@@ -74,8 +73,8 @@ all: $(OBJDIR)/$(MODULE_NAME)
|
||||
#
|
||||
# Pattern based rules.
|
||||
#
|
||||
vpath %.c $(CLIENT) $(COMMON)
|
||||
vpath %.cpp $(CLIENT) $(COMMON)
|
||||
vpath %.c .
|
||||
vpath %.cpp .
|
||||
|
||||
$(OBJDIR)/%.o: %.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
@@ -63,10 +63,10 @@ double numBusyThreads = 0;
|
||||
double numPerishingThreads = 0;
|
||||
|
||||
// Listen Port Number
|
||||
int listenPortNumber = 5000;
|
||||
//int listenPortNumber = 0;
|
||||
//int listenPortNumber = 5000;
|
||||
int listenPortNumber = 0;
|
||||
|
||||
// Parameter indicating whether or not XSrv needs to run
|
||||
// Parameter indicating whether or not the server needs to run
|
||||
// as a daemon.
|
||||
bool daemonize = false;
|
||||
|
||||
@@ -74,7 +74,7 @@ bool daemonize = false;
|
||||
char appName[] = "CasaAuthtokenValidateD";
|
||||
|
||||
// Debug Level
|
||||
int DebugLevel = 3;
|
||||
int DebugLevel = 0;
|
||||
bool UseSyslog = false;
|
||||
|
||||
// Variables for daemon auto-restart after crash feature
|
||||
@@ -92,10 +92,11 @@ bool terminating = false;
|
||||
JavaVM *g_jvm = NULL;
|
||||
JNIEnv *g_env = NULL;
|
||||
|
||||
char classpath[] = "-Djava.class.path=/usr/share/java/CASA/authtoken/CasaAuthToken.jar:/usr/share/java/CASA/authtoken/external/axis.jar:/usr/share/java/CASA/authtoken/external/axis-ant.jar:/usr/share/java/CASA/authtoken/external/commons-discovery-0.2.jar:/usr/share/java/CASA/authtoken/external/commons-logging-1.0.4.jar:/usr/share/java/CASA/authtoken/external/jaxrpc.jar:/usr/share/java/CASA/authtoken/external/log4j-1.2.8.jar:/usr/share/java/CASA/authtoken/external/saaj.jar:/usr/share/java/CASA/authtoken/external/wsdl4j-1.5.1.jar:/usr/share/java/CASA/authtoken/external/wss4j-1.5.0.jar:/usr/share/java/CASA/authtoken/external/xalan.jar:/usr/share/java/CASA/authtoken/external/xercesImpl.jar:/usr/share/java/CASA/authtoken/external/xml-apis.jar:/usr/share/java/CASA/authtoken/external/xmlsec-1.2.1.jar:/usr/share/java/CASA/authtoken/external:/etc/CASA/authtoken.d";
|
||||
// Java AuthenticationToken Class and method name
|
||||
//char authTokenClassName[] = "jtest";
|
||||
//char authTokenClassValidateMethodName[] = "test4";
|
||||
char authTokenClassName[] = "com.novell.casa.authtoksvc.AuthToken";
|
||||
char authTokenClassName[] = "com/novell/casa/authtoksvc/AuthToken";
|
||||
char authTokenClassValidateMethodName[] = "validate";
|
||||
|
||||
|
||||
@@ -249,7 +250,9 @@ WorkerThread(void*)
|
||||
|
||||
// Attach the thread to the JVM
|
||||
JNIEnv *env;
|
||||
if (g_jvm->AttachCurrentThread((void**) &env, NULL) >= 0)
|
||||
JavaVMAttachArgs attachArgs = {0};
|
||||
attachArgs.version = JNI_VERSION_1_4;
|
||||
if (g_jvm->AttachCurrentThread((void**) &env, &attachArgs) >= 0)
|
||||
{
|
||||
// We are now attached to the JVM, find the helper class that
|
||||
// we need.
|
||||
@@ -288,26 +291,36 @@ WorkerThread(void*)
|
||||
{
|
||||
// Invoke our helper method
|
||||
jstring outString = (jstring) env->CallStaticObjectMethod(helperClass, mId, inString);
|
||||
if (outString)
|
||||
|
||||
// Check if an excption occurred
|
||||
if (env->ExceptionCheck() == JNI_TRUE)
|
||||
{
|
||||
// The helper method succeded, complete the request
|
||||
// with the data returned.
|
||||
const char *pOutChars = env->GetStringUTFChars(outString, NULL);
|
||||
if (pOutChars)
|
||||
{
|
||||
IpcServerCompleteRequest(requestId, (char*) pOutChars);
|
||||
env->ReleaseStringUTFChars(outString, pOutChars);
|
||||
}
|
||||
else
|
||||
{
|
||||
DbgTrace(0, "WorkerThread- Unable to get UTF characters\n", 0);
|
||||
IpcServerAbortRequest(requestId);
|
||||
}
|
||||
// There is a pending exception, display the info which in turn clears it.
|
||||
env->ExceptionDescribe();
|
||||
}
|
||||
else
|
||||
{
|
||||
// The helper method failed, just abort the request.
|
||||
IpcServerAbortRequest(requestId);
|
||||
if (outString)
|
||||
{
|
||||
// The helper method succeded, complete the request
|
||||
// with the data returned.
|
||||
const char *pOutChars = env->GetStringUTFChars(outString, NULL);
|
||||
if (pOutChars)
|
||||
{
|
||||
IpcServerCompleteRequest(requestId, (char*) pOutChars);
|
||||
env->ReleaseStringUTFChars(outString, pOutChars);
|
||||
}
|
||||
else
|
||||
{
|
||||
DbgTrace(0, "WorkerThread- Unable to get UTF characters\n", 0);
|
||||
IpcServerAbortRequest(requestId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The helper method failed, just abort the request.
|
||||
IpcServerAbortRequest(requestId);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -433,14 +446,17 @@ InitJavaInvoke(void)
|
||||
|
||||
DbgTrace(1, "InitJavaInvoke- Start\n", 0);
|
||||
|
||||
//JavaVMOption options[1];
|
||||
//options[0].optionString = "-Djava.class.path=.";
|
||||
JavaVMOption options[1];
|
||||
options[0].optionString = "-Djava.class.path=/usr/share/java:/etc/CASA/authtoken";
|
||||
JavaVMOption options[6];
|
||||
options[0].optionString = classpath;
|
||||
options[1].optionString = "-Dorg.xml.sax.driver=org.apache.xerces.parsers.SAXParser";
|
||||
options[2].optionString = "-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl";
|
||||
options[3].optionString = "-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl";
|
||||
//options[4].optionString = "-Xcheck:jni";
|
||||
//options[5].optionString = "-Djaxp.debug=1";
|
||||
JavaVMInitArgs vm_args;
|
||||
vm_args.version = JNI_VERSION_1_4;
|
||||
vm_args.options = options;
|
||||
vm_args.nOptions = 1;
|
||||
vm_args.nOptions = 4;
|
||||
vm_args.ignoreUnrecognized = true;
|
||||
if (JNI_CreateJavaVM(&g_jvm, (void**)&g_env, &vm_args) >= 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user