<div dir="auto"><div>OK, I think we can agree on that. Please add the changes of KeyTab.java: it should be helpful in future releases. </div><div dir="auto"><br></div><div dir="auto">Thanks, </div><div dir="auto">Peter</div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Wed, Aug 18, 2021, 23:06 Wei-Jun Wang, <<a href="mailto:weijun.wang@oracle.com">weijun.wang@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think the new message in KeyTab.java is enough. The added lines in Krb5LoginModule is a little too long with the try-catch structure.<br>
<br>
—Weijun<br>
<br>
> On Aug 18, 2021, at 1:50 PM, Horváth Péter Gergely <<a href="mailto:horvath.peter.gergely@gmail.com" target="_blank" rel="noreferrer">horvath.peter.gergely@gmail.com</a>> wrote:<br>
> <br>
> Hi Weijun,<br>
> <br>
> Many thanks for your response. I think that indeed it would make sense to log in KeyTab, since the FileNotFoundException there should even have the platform-specific reason message coming from the native layer.<br>
>  <br>
> At the same time, I think it would make sense to emit a log message around the original "Key for the principal ... not available in ..." message as well. It is probably good to have more context when debugging. <br>
> <br>
> I have created a new patch combining the two approaches. Code in Krb5LoginModule now relies on the KeyTab exists() call: it is probably better like that. <br>
> Please take a look and let me know what you think.<br>
> <br>
> Thanks,<br>
> Peter<br>
> <br>
> <br>
> <br>
> <br>
> Wei-Jun Wang <<a href="mailto:weijun.wang@oracle.com" target="_blank" rel="noreferrer">weijun.wang@oracle.com</a>> ezt írta (időpont: 2021. aug. 17., K, 23:33):<br>
> How do you think if we add some debug info at the internal KeyTab creation at [1]?<br>
> <br>
> For the 2 exceptions we can print out a line and the exception.toString(), then you will know if the filename doesn’t exist, or is a directory, or no permission to read.<br>
> <br>
> Of course, you will need to turn on -Dsun.security.krb5.debug=true to see this level of debug info.<br>
> <br>
> Thanks,<br>
> Weijun<br>
> <br>
> [1] <a href="https://github.com/openjdk/jdk/blob/f4af0eadb6eaf9d9614431110ab7fc9c1588966d/src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTab.java#L93" rel="noreferrer noreferrer" target="_blank">https://github.com/openjdk/jdk/blob/f4af0eadb6eaf9d9614431110ab7fc9c1588966d/src/java.security.jgss/share/classes/sun/security/krb5/internal/ktab/KeyTab.java#L93</a><br>
> <br>
> <br>
> > On Aug 17, 2021, at 4:19 PM, Horváth Péter Gergely <<a href="mailto:horvath.peter.gergely@gmail.com" target="_blank" rel="noreferrer">horvath.peter.gergely@gmail.com</a>> wrote:<br>
> > <br>
> > Dear All,<br>
> > <br>
> > I am wondering if someone would be kind enough to sponsor the following small change:<br>
> > <br>
> > When debugging is enabled for com.sun.security.auth.module.Krb5LoginModule and the file specified by "keyTab" is not found, Krb5LoginModule simply emits a generic message, similar to this:<br>
> > "Key for the principal <a href="mailto:foobar@acme.com" target="_blank" rel="noreferrer">foobar@acme.com</a> not available in /home/foobar/foobar.keytab"<br>
> > <br>
> > This message can be quite confusing and counterintuitive if the file is actually not there, because, based on the message, one would think that the JVM probed the file, found it, loaded the data, but still could not use the keytab data for authentication.<br>
> > <br>
> > I would propose adding further debug logging to Krb5LoginModule so as to emit a warning in case the key was not found, due to the file not being present, readable or a being a directory.<br>
> > <br>
> > Please find attached the patch file: it is trivial, and only affects a debug branch of the code.<br>
> > <br>
> > Please let me know what you think.<br>
> > <br>
> > Thanks,<br>
> > Peter<br>
> > <keyTab_file_checks.patch><br>
> <br>
> <keyTab_file_checks2.patch><br>
<br>
</blockquote></div></div></div>