Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Implementing NegoState.Unix.cs#5773

Merged
stephentoub merged 1 commit into
dotnet:dev/negotiatestreamfrom
shrutigarg:devNegoUnix
Feb 22, 2016
Merged

Implementing NegoState.Unix.cs#5773
stephentoub merged 1 commit into
dotnet:dev/negotiatestreamfrom
shrutigarg:devNegoUnix

Conversation

@shrutigarg
Copy link
Copy Markdown
Contributor

It includes the implementation on NegoState.Unix pal on top of the common refactoring changes( #5581)
Please refer to the Commit 4 of this PR for reviewing.

Includes:
Implementation of NegoState.Unix.cs Methods.
Implementaion of SafeHandles to be used.

Tested locally as Linux client with windows server.

cc: @stephentoub , @bartonjs @vijaykota

@shrutigarg
Copy link
Copy Markdown
Contributor Author

following up #5726

@vijaykota
Copy link
Copy Markdown
Contributor

Adding reference to #2483

@shrutigarg
Copy link
Copy Markdown
Contributor Author

ping @stephentoub @bartonjs @vijaykota

@stephentoub
Copy link
Copy Markdown
Member

Ping

@shrutigarg, I'm confused by all of the PRs. I commented on #5772, but its three commits appear to be completely a part of this one. Then there are this PR (#5773) and the fallback logic PR (#5770) which have those three commits plus one more that appears to be the same, and then they each differ by one commit. What are we actually supposed to be reviewing?

Exception exception = null;
if (message != s_emptyMessage)
{
message = GetOutgoingBlob(message, ref exception);
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.

@shrutigarg Does it mean that in Unix we will use the same NTAuthentication.cs as well to GetOutgoingBlob ?

This NTAuthentication.GetOutgoinBlob essentially what System.Data need to get SSPI message for Integrated feature. Is there any plan to make this available to public ?

Thanks

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.

Yes.. Unix will use same NTAuthentication.cs There is no plan to make GetOutgoingBlob public

@vijaykota
Copy link
Copy Markdown
Contributor

@shrutigarg , till we resolve #5890 add a Debug.Write and GlobalLog.Print to the catch block in EstablishSecurityContext

@shrutigarg
Copy link
Copy Markdown
Contributor Author

@vijaykota added log and marked with a todo statement to keep track on reverting.

@shrutigarg
Copy link
Copy Markdown
Contributor Author

@vijaykota @stephentoub @bartonjs updated this PR after syncing with dev/negotiatestream branch and incorporating all the comments.
Tested locally.

@shrutigarg
Copy link
Copy Markdown
Contributor Author

@dotnet-bot test this please


namespace System.Net.Security
{
internal sealed class SafeFreeNegoCredentials : SafeFreeCredentials
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.

What value is this type providing? It seems like it exists purely to wrap a SafeGssCredHandle... why not just have the caller use a SafeGssCredHandle?

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.

@bartonjs just told me that this exists purely to satisfy the PAL contract... is that true? If so, we can leave it as-is for now, but we should revisit that contract, which sounds flawed.

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.

I'm happy to be wrong about that, but I feel that when I've had similar confusion on other things that was the answer.

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.

Yes.. the platform-agnostic code requires a SafeFreeCredentials object since on Windows it is same for SslStream and NegotiateStream. On Unix this is different. For fallback to NTLM logic, you will actually see more logic inside SafeFreeNegoCredentials.

@shrutigarg
Copy link
Copy Markdown
Contributor Author

rebase done.

@stephentoub
Copy link
Copy Markdown
Member

A few more comments, then LGTM. (Most importantly the DangerousRelease thing needs to be addressed.)

@shrutigarg
Copy link
Copy Markdown
Contributor Author

@dotnet-bot test this please

}
Debug.Write("Exception Caught. - " + ex);
Debug.Assert((null != credential), "Null credential in SafeDeleteContext");
Dispose();
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.

@shrutigarg we need to (implement) and call base.Dispose which should also set _credential to null to prevent double-free

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.

Calling Dispose here is right, but in Dispose implementation below you're calling _sslContext.Dispose, and if the ctor throws in the call to AllocateSslContext, _sslContext will be null, and the call to Dispose will dereference null. You need to check in Dispose that _sslContext is not null before disposing it. Then you should set it back to null.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok .. will add check .. like in other dispose.

@stephentoub
Copy link
Copy Markdown
Member

This can be reviewed again in context as part of a later merge to master. For now, LGTM.

@shrutigarg
Copy link
Copy Markdown
Contributor Author

These checks seem to have stuck ..seeing it since 5-6 hours.. ,, is some known issue? Should I wait for them to finish?

@stephentoub
Copy link
Copy Markdown
Member

@dotnet-bot test this please

@stephentoub
Copy link
Copy Markdown
Member

d:\j\workspace\ubuntu_debug_---bbc18e49\src\Common\src\Interop\Unix\libssl\SecuritySafeHandles.cs(308,21): error CS0191: A readonly field cannot be assigned to (except in a constructor or a variable initializer) [d:\j\workspace\ubuntu_debug_---bbc18e49\src\System.Net.Security\src\System.Net.Security.csproj]

@stephentoub
Copy link
Copy Markdown
Member

With the build break, that implies the latest version of the code wasn't run through tests. Since there aren't automated ones yet in CI, can you please make sure to do so locally before this is merged?

@shrutigarg
Copy link
Copy Markdown
Contributor Author

@stephentoub seems unrelated failure now.. I have fixed the issue and tested.

@stephentoub
Copy link
Copy Markdown
Member

@mmitche, we're hitting these Azure VM disk full conditions fairly often. We can continue to delete them when they occur, but is there nothing more proactive we can do to prevent them in the first place and avoid the random leg failures?

@mmitche
Copy link
Copy Markdown
Member

mmitche commented Feb 22, 2016

@stephentoub That actually wasn't a disk space issue, that was it not making the disk writeable. I am trying to find out why. Let me know if you see another instance.

stephentoub added a commit that referenced this pull request Feb 22, 2016
Implementing NegoState.Unix.cs
@stephentoub stephentoub merged commit 68670f3 into dotnet:dev/negotiatestream Feb 22, 2016
@karelz karelz added this to the 1.0.0-rtm milestone Jan 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants