Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

42.4.1 JDK18 GSS compat getCurrentSubject WrongMethodTypeException #2588

Closed
Rob4001 opened this issue Aug 12, 2022 · 14 comments
Closed

42.4.1 JDK18 GSS compat getCurrentSubject WrongMethodTypeException #2588

Rob4001 opened this issue Aug 12, 2022 · 14 comments

Comments

@Rob4001
Copy link

Rob4001 commented Aug 12, 2022

Please read https://stackoverflow.com/help/minimal-reproducible-example

Describe the issue
New compatibility reflection released as part of 42.4.1 breaks for pre JDK18 versions due to a casting error #2535

MakeGSS.java line 104-106

Driver Version?
42.4.1
Java Version?
11
OS Version?
Windows Server 2016
PostgreSQL Version?
CRDB 21.1.13
To Reproduce
Steps to reproduce the behaviour:

  1. Setup JDBC connection using JAAS, and com.sun.security.auth.module.Krb5LoginModule true
  2. Attempt connection to database

Expected behaviour
Should connect to DB using GSSAPI Auth

Throws exception

org.postgresql.util.PSQLException :GSS Authentication failed
at org.postgresql.gss.MakeGSS.authenticate (MakeGSS.java:173
Caused by: java.lang.invoke.WrongMethodTypeException: expected ()Access control context but found ()Object

@davecramer
Copy link
Member

do you happen to have the rest of the stacktrace ?

@davecramer
Copy link
Member

what is CRDB ?

@Rob4001
Copy link
Author

Rob4001 commented Aug 12, 2022

do you happen to have the rest of the stacktrace ?

Sadly due to work policies I cannot share direct

what is CRDB ?

CockroachDB so pgwire 3.0 I think?

@davecramer
Copy link
Member

Well I'd like to know which method is causing the problem

@Rob4001
Copy link
Author

Rob4001 commented Aug 12, 2022

Well I'd like to know which method is causing the problem

return (Subject) SUBJECT_GET_SUBJECT.invoke(
          ACCESS_CONTROLLER_GET_CONTEXT.invokeExact()
      );

Reflective call to this method

@davecramer
Copy link
Member

@Rob4001 is there any way you can test PR #2589 ?

@davecramer
Copy link
Member

@Rob4001 one more time ? #2595

@Rob4001
Copy link
Author

Rob4001 commented Aug 16, 2022

@Rob4001 one more time ? #2595

Looks like that will do the trick, although probably will break java 18 support due to direct reference to removed class.

Locally compiled version works with our usecase.

What is the normal turnaround time for a patch version release once this is merged?

@davecramer
Copy link
Member

Looks like that will do the trick, although probably will break java 18 support due to direct reference to removed class.

ah, yes, so we can change invokeExact to invoke to remove the reference.

@davecramer
Copy link
Member

OK, removed direct reference. Can you test one more time, if it works I will merge and release ASAP

@Rob4001
Copy link
Author

Rob4001 commented Aug 16, 2022

Latest works!

Thanks for the quick turnaround, would have contributed code personally but hands tied by work policies

@davecramer
Copy link
Member

davecramer commented Aug 17, 2022 via email

@Rob4001
Copy link
Author

Rob4001 commented Aug 18, 2022

Tested release, works wonderfully :)

Closing Issue

@Rob4001 Rob4001 closed this as completed Aug 18, 2022
@davecramer
Copy link
Member

Again, thanks so much for your assistance in this matter. GSS is one of the harder things to automate tests for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants