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

Fix GSSAPI Kerberos Authentication in Debug Mode #372

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

greenlonk
Copy link

@greenlonk greenlonk commented Dec 20, 2024

Problem

When using AuthMethod::IntegratedSecurity on Windows, the library behaves just as you would expect. However, when I tried to run my code on a Linux machine with proper Kerberos authentication set up, I would always get the following panic message when run in debug mode (cargo run --debug):

thread 'tokio-runtime-worker' panicked at library\core\src\panicking.rs:220:5:
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`

Solution

Due to changes in the standard library (see https://stackoverflow.com/a/78504630 ), it is possible for debug assertions in core and std to panic: These assertions now fire when compiled in debug mode, even if the precompiled standard library was compiled in release mode. This caused a panic when I tried to connect using AuthMethod::IntegratedSecurity on Linux when run in debug mode, but not in release mode.

After updating the dependency for libgssapi to the latest version from 0.4.5 to 0.8.1 (and making small adjustments in src/client/connection.rs to reflect the changes with proper initialization), this issue got fixed.

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

Successfully merging this pull request may close these issues.

1 participant