This mail is with respect to the bug http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25202 marked as resolved fixed. I have downloaded the latest gnu classpath source which includes Added files: gnu/javax/security/auth/login: GnuConfiguration.java ConfigFileTokenizer.java ConfigFileParser.java and Modified files: javax/security/auth/login: AppConfigurationEntry.java Configuration.java from CVS and built the IKVM.GNU.Classpath dll out of it. When I execute the attached Java program on .NET after generating an exe using IKVMC I get a Null Pointer Exception saying. Exception in thread "main" java.lang.NullPointerException at security.BaseLoginModule.login (BaseLoginModule.java:70) at javax.security.auth.login.LoginContext.login (LoginContext.java:141) at security.TestSecurity.<init> (TestSecurity.java:19) at security.TestSecurity.main (TestSecurity.java:29) On Java environment the program executes fine with out any errors. Now on .NET it is able to parse the given auth.login file and finding the configured module for the application. But, the callbackhandler object in the DBLoginModuleTest(LoginModule)->initialize is coming as NULL resulting in the above said Null Pointer Exception. I am attaching the source files and the logs generated on Java and .NET environment and below are the files/commands i have used. Please let me know if i am missing anything. ---auth.login ----------- DBLogin { security.DBLoginModuleTest required; }; ----------------usage ---------------------------- D:\R& D>ikvmc LoginSecurity.jar Note: found main method in class "security.TestSecurity" Note: output file is "LoginSecurity.exe" Note: automatically adding reference to "D:\R& D\IKVM.GNU.Classpath.DLL" D:\R& D>LoginSecurity DEBUG: java.security.auth.login.config = auth.login WARN: Failed opening as URL: auth.login. Will try as File INFO: Using login configuration defined by System property DEBUG: java.security.auth.login.config = auth.login WARN: Failed opening as URL: auth.login. Will try as File INFO: Using login configuration defined by System property DEBUG: DBLogin -> 1 entry(ies) Exception in thread "main" java.lang.NullPointerException at security.BaseLoginModule.login (BaseLoginModule.java:70) at javax.security.auth.login.LoginContext.login (LoginContext.java:141) at security.TestSecurity.<init> (TestSecurity.java:19) at security.TestSecurity.main (TestSecurity.java:29) Thanks in advance for your help.
Created attachment 10854 [details] Attached Zip contains the Program source files, auth.login file and the log files of the program generated on both Java and Dotnet. Attachment contains the program source files, login file used for parsing and the logs generated by the program on Java and dotnet environments.
Rahdika, you have to work with me to solve this one! i don't have a windoors platform, and wasn't able to run ikvm[c] with wine. but first... did you try asking on the IKVM list if this is a known problem? one more point; the line: at security.BaseLoginModule.login (BaseLoginModule.java:70) claims the exception is caused by a statement on line 70 in BaseLoginModule. looking in that file, line #70 is a blank one! is this normal or could it be that the source incl. in the attachment does not match the one you tried this with? cheers; rsn
There is at least one IKVM specific bug. In ikvm/classpath/classpath.security, the following line is missing: security.provider.5=gnu.javax.security.auth.callback.GnuCallbacks I will modify the IKVM.GNU.Classpath.dll build script to use the GNU Classpath version of classpath.security (I don't remember why it doesn't use that at the moment). However, after fixing this, I still get: C:\j\LoginSecurity>\ikvm\bin\ikvm security.TestSecurity Jul 18, 2006 1:17:55 PM security.DBLoginModuleTest initialize INFO: Starting initialize DbLoginModuleTest Jul 18, 2006 1:17:55 PM security.DBLoginModuleTest initialize INFO: callbackhandler is null - initialize - DBLoginModuleTest Jul 18, 2006 1:17:55 PM security.BaseLoginModule initialize INFO: Starting initialize BaseLoginModule Jul 18, 2006 1:17:55 PM security.BaseLoginModule initialize INFO: CallbackHandler is Null - initialize() - BaseLoginModule Jul 18, 2006 1:17:55 PM security.BaseLoginModule initialize INFO: End of initialize BaseLoginModule Jul 18, 2006 1:17:55 PM security.DBLoginModuleTest initialize INFO: End of initialize DbLoginModuleTest Jul 18, 2006 1:17:55 PM security.BaseLoginModule login INFO: Starting login() of BaseLoginModule Exception in thread "main" java.lang.NullPointerException at security.BaseLoginModule.login(BaseLoginModule.java:48) at javax.security.auth.login.LoginContext.login(LoginContext.java:141) at security.TestSecurity.<init>(TestSecurity.java:19) at security.TestSecurity.main(TestSecurity.java:30) Note that callback is null and this causes the NPE. By my (limited) understanding callback is allowed to be null (as I don't see anybody setting the auth.login.defaultCallbackHandler security property), so I'm not sure whether this is a bug in IKVM/Classpath or in the Radhika's code.
Created attachment 11911 [details] Set login context's local fields before initialising login modules
Jeroen, pls. try the attached patch and let me know if this solves the problem. TIA + cheers;
That fixed it! Thanks, Jeroen
Subject: Bug 26302 CVSROOT: /cvsroot/classpath Module name: classpath Changes by: Raif S. Naffah <raif> 06/07/19 09:11:59 Modified files: resource/java/security: classpath.security javax/security/auth/login: LoginContext.java . : ChangeLog Log message: 2006-07-19 Raif S. Naffah <raif@swiftdsl.com.au> PR Classpath/26302 * resource/java/security/classpath.security: Updated copyright year. (auth.login.defaultCallbackHandler): New property; set to our default callback handler. This is needed by the LoginContext when no callback handler was specified. * javax/security/auth/login/LoginContext.java: Updated copyright year. (LoginContext(4)): Assign passed parameters to local fields before invoking lookup method. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/classpath/resource/java/security/classpath.security?cvsroot=classpath&r1=1.6&r2=1.7 http://cvs.savannah.gnu.org/viewcvs/classpath/javax/security/auth/login/LoginContext.java?cvsroot=classpath&r1=1.5&r2=1.6 http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.8162&r2=1.8163
fixed as per (last) patch.