Skip to content
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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();
}
}
}
}