diff --git a/src/JAVA/classes/org/openafs/jafs/Token.java b/src/JAVA/classes/org/openafs/jafs/Token.java index ae7b7dabb0..d8f7dfa9e3 100644 --- a/src/JAVA/classes/org/openafs/jafs/Token.java +++ b/src/JAVA/classes/org/openafs/jafs/Token.java @@ -143,6 +143,20 @@ public class Token implements Serializable, Comparable if (automaticallyLogin) login(); } + /** + * Constructs a new Token object instance given the + * name of the AFS cell it represents; the token for administrative + * access will be extracted from the kernel cache manager if possible. + * + * @param cellName the name of the cell to Token into + * @exception AFSException If an error occurs in the native code + */ + public Token(String cellName) + throws AFSException + { + this(null, null, cellName); + } + /** * Constructs a new Token object instance given * the name of the AFS cell it represents and the username and password diff --git a/src/JAVA/libjafs/AdminToken.c b/src/JAVA/libjafs/AdminToken.c index 80c85dcb89..a91abade1e 100644 --- a/src/JAVA/libjafs/AdminToken.c +++ b/src/JAVA/libjafs/AdminToken.c @@ -30,6 +30,7 @@ #include #include #include +#include /** * Static function used to initialize the client library and the @@ -71,6 +72,7 @@ Java_org_openafs_jafs_Token_getToken const char *password; void *tokenHandle; int rc; + int err; // convert java strings if( jcellName != NULL ) { @@ -101,8 +103,11 @@ Java_org_openafs_jafs_Token_getToken password = NULL; } - if ( !(afsclient_TokenGetNew( cellName, userName, password, &tokenHandle, - &ast) ) ) { + err = (password==NULL || userName==NULL) + ? afsclient_TokenGetExisting( cellName, &tokenHandle, &ast) + : afsclient_TokenGetNew( cellName, userName, password, &tokenHandle, &ast); + + if ( !err ) { // release converted strings if( cellName != NULL ) { (*env)->ReleaseStringUTFChars(env, jcellName, cellName); diff --git a/src/JAVA/libjafs/Makefile.in b/src/JAVA/libjafs/Makefile.in index f67227775a..843fe8d2a0 100644 --- a/src/JAVA/libjafs/Makefile.in +++ b/src/JAVA/libjafs/Makefile.in @@ -13,7 +13,7 @@ TOP_SRCDIR=@TOP_SRCDIR@ TOP_INCDIR=@TOP_INCDIR@ TOP_LIBDIR=@TOP_LIBDIR@ TOP_JLIBDIR=@TOP_SRCDIR@/JAVA/libjafs -JNI_INC=${JAVA_HOME}/include +JNI_INC=-I ${JAVA_HOME}/include -I `dirname ${JAVA_HOME}/include/*/jni_md.h` prefix=@prefix@ exec_prefix=@exec_prefix@ datarootdir=@datarootdir@ @@ -36,10 +36,10 @@ SHARED_FLAGS = -shared -Xlinker -Bsymbolic OBJECT_FLAGS = -fPIC -c ifeq "$(BUILD_TYPE)" "admin" - INC := -I${TOP_INCDIR} -I${TOP_INCDIR}/afs/ -I${JAVA_HOME}/include -I ${JNI_INC} + INC := -I${TOP_INCDIR} -I${TOP_INCDIR}/afs/ ${JNI_INC} CFLAGS := ${INC} ${DBG} ${OPTMZ} -I${TOP_SRCDIR}/config ${MT_CFLAGS} else - INC := -I${TOP_SRCDIR}/libuafs -I${TOP_INCDIR} -I${JAVA_HOME}/include -I ${JNI_INC} + INC := -I${TOP_SRCDIR}/libuafs -I${TOP_INCDIR} ${JNI_INC} CFLAGS := ${INC} ${DBG} ${OPTMZ} ${FSINCLUDES} -D_REENTRANT -DLIBJUAFS ${MT_CFLAGS} endif @@ -51,7 +51,7 @@ PACKAGEDIR = ${ROOTPACKAGEDIR}/${RELPACKAGEDIR} JAVADOCSDIR = javadocs/ JAVAH = ${JAVA_HOME}/bin/javah -classpath ${ROOTPACKAGEDIR} -jni -d ${LIBJAFSADMDIR} -JAVAC = ${JAVA_HOME}/bin/javac -classpath ${ROOTPACKAGEDIR} +JAVAC = ${JAVA_HOME}/bin/javac -source 1.4 -classpath ${ROOTPACKAGEDIR} J_NATIVE_PREFIX = org.openafs.jafs. C_NATIVE_PREFIX = org_openafs_jafs_ @@ -154,6 +154,7 @@ CLIENTADMINLIB = ${TOP_LIBDIR}/libclientadmin.a LIBJAFS_LIBS =\ ${TOP_LIBDIR}/libjuafs.a \ + ${TOP_LIBDIR}/libafsutil.a \ ${TOP_LIBDIR}/libdes.a \ -lresolv \ -lpthread