Add test coverage for DirectoryServices.TransformControls#107201
Add test coverage for DirectoryServices.TransformControls#107201buyaa-n merged 4 commits intodotnet:mainfrom
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 |
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.BerConverteris 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.