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 | Adds support for Shim gss api on Linux to delay loading libgssapi_krb… #65469

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ internal static partial void ReleaseGssBuffer(
IntPtr bufferPtr,
ulong length);

[DllImport(Interop.Libraries.NetSecurityNative, EntryPoint = "NetSecurityNative_EnsureGssInitialized")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to use 'GeneratedDllImport' like the others in the file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JRahnama for context, this is new in 7.0. So you will need to use the new form in this change, and the back port will use the form you have here.

private static extern int EnsureGssInitialized();

[GeneratedDllImport(Interop.Libraries.NetSecurityNative, EntryPoint="NetSecurityNative_DisplayMinorStatus")]
internal static partial Status DisplayMinorStatus(
out Status minorStatus,
Expand Down Expand Up @@ -169,5 +172,17 @@ internal static Status UnwrapBuffer(

return Unwrap(out minorStatus, contextHandle, inputBytes, offset, count, ref outBuffer);
}

// This constructor is added to address the issue with net6 regarding
// Shim gss api on Linux to delay loading libgssapi_krb5.so
// issue https://github.com/dotnet/SqlClient/issues/1390
// dotnet runtime issue https://github.com/dotnet/runtime/pull/55037
static NetSecurityNative()
{
if (Environment.Version.Major >= 6)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is only included in .NET 7+ binaries in this repo, so this check is unnecessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the EnsureGssInitialized calls are already being done in the main branch:

. It is why you are getting the build breaks.

Perhaps you meant to create a PR against one of the servicing branches?

{
EnsureGssInitialized();
}
}
}
}