-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Add test coverage for DirectoryServices.TransformControls #107201
Add test coverage for DirectoryServices.TransformControls #107201
Conversation
Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014 |
* There are looser rules in OpenLDAP when an octet string exceeds the length of its containing sequence. * Windows 8.1 and below treats trailing 0x80 bytes differently to every other platform. * Added a test which covers an octet string containing invalid Unicode bytes.
Also handle changes to the "a" format string: Winldap in Windows 10 is stricter when a SEQUENCE's contents overflow its length
Thank you @edwardneal looks its covered scenarios well, overall the PR LGTM
Not sure if we should fix it or leave it as is, tag @bartonjs @jay98014 @steveharter @kumarravik78c for opinions about this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @edwardneal
We can fix this later if needed, going to merge this PR to unblock #101512. |
Thanks @buyaa-n; I can see that my tests passed, so I'll merge into the other PR and re-test in the next few days. |
) * Added tests for server response DirectoryControls * Addressing platform inconsistencies * There are looser rules in OpenLDAP when an octet string exceeds the length of its containing sequence. * Windows 8.1 and below treats trailing 0x80 bytes differently to every other platform. * Added a test which covers an octet string containing invalid Unicode bytes. * Handle differing .NET Framework behaviour Also handle changes to the "a" format string: Winldap in Windows 10 is stricter when a SEQUENCE's contents overflow its length * Update SortResponseControlTests.cs
Relates to PR #101512.
This PR introduces test coverage for
DirectoryServices.TransformControls
. The method parses five types of control - AsqResponseControl, DirSyncResponseControl, PageResultResponseControl, SortResponseControl and VlvResponseControl.Each control splits the parsing attempt into three groups:
BerConversionException
.BerConverter
is forgiving.These tests pass on my Windows PC, with different handling for OpenLDAP and earlier versions of Windows. There are a few interesting variations.
Platform variations
a
) it will return null. After Windows 10 and in OpenLDAP, it returns a zero-length string. This is a behavioural difference between .NET and .NET Framework (which always returns an empty string.)Errata
If an OCTET STRING contains a trailing 0x80 byte which is an invalid Unicode character, BerConverter won't handle the DecoderFallbackException - that exception will just bubble up to the caller. There's a test to verify this behaviour, but I'm pretty sure this is a bug.