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

Switch DirectoryControl to use AsnWriter, AsnDecoder #101512

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Commits on Apr 21, 2024

  1. Removed BerConverter.Decode usage

    Replaced this with the managed AsnDecoder, removing PInvoke from a potential hot path.
    edwardneal committed Apr 21, 2024
    Configuration menu
    Copy the full SHA
    9b87b4e View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2024

  1. Removed BerConverter.Encode usage

    Also removed the manual API calls to ldap_create_sort_control - this is now built in managed code.
    This then has knock-on effects to eliminate the SortKeyInterop classes.
    edwardneal committed Apr 23, 2024
    Configuration menu
    Copy the full SHA
    31600a4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    a152c84 View commit details
    Browse the repository at this point in the history
  3. Correcting test values

    Most of the Control tests were hardcoded to the output of BerConverter, which uses four-byte lengths in all cases.
    This behaviour is now different: the same output is returned across all platforms for .NET, and remains unchanged for .NET Framework.
    This should also close issue 34679.
    edwardneal committed Apr 23, 2024
    Configuration menu
    Copy the full SHA
    9461057 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    cb07eb4 View commit details
    Browse the repository at this point in the history
  5. Small optimisations

    Reduce number of copies required in TransformControls, and enable these copies to take advantage of newer intrinsics where available.
    edwardneal committed Apr 23, 2024
    Configuration menu
    Copy the full SHA
    73dd1bc View commit details
    Browse the repository at this point in the history

Commits on Apr 24, 2024

  1. AD compatibility test corrections

    Windows domain controllers may return a distinguished name starting with OU=, rather than ou=.
    edwardneal committed Apr 24, 2024
    Configuration menu
    Copy the full SHA
    c5c9598 View commit details
    Browse the repository at this point in the history

Commits on Apr 27, 2024

  1. Performance improvement, bugfix

    Preallocating space for AsnWriter buffers to reduce memory usage.
    Correctly handling attribute names in SortControls.
    edwardneal committed Apr 27, 2024
    Configuration menu
    Copy the full SHA
    33e4f25 View commit details
    Browse the repository at this point in the history

Commits on May 11, 2024

  1. Following code review

    Corrected off-by-one error in stack allocation comparison.
    Made some stackallocs constant (unless a meaningful constant size would be >256 bytes) and reviewed these constant values based on real-world attribute lengths/server names.
    edwardneal committed May 11, 2024
    Configuration menu
    Copy the full SHA
    6b487c2 View commit details
    Browse the repository at this point in the history

Commits on May 24, 2024

  1. Implemented further code review comments

    * Added limited caching of AsnWriters, as small/medium/large buckets.
    * Replaced several Debug.Asserts with BerExceptions.
    * Changed the type of raised exception to retain backwards-compatibility.
    * Added extra checks on BER content lengths to match BerConverter.
    edwardneal committed May 24, 2024
    Configuration menu
    Copy the full SHA
    b4bbdc7 View commit details
    Browse the repository at this point in the history

Commits on May 25, 2024

  1. Remainder of code review feedback

    DirectoryControl payload parsing is stricter, throwing exception when invalid sequences are discovered instead of optional OCTET STRINGs.
    edwardneal committed May 25, 2024
    Configuration menu
    Copy the full SHA
    e12d447 View commit details
    Browse the repository at this point in the history

Commits on Jul 24, 2024

  1. First response to code review feedback

    * Ensured that all references to DirectoryControl names in comments are accurate.
    * Specified the name of the ASN.1 structure which is being parsed in the comments.
    * Added explanatory comment stating that BER INTEGER values are being interpreted as 32-bit signed integers.
    edwardneal committed Jul 24, 2024
    Configuration menu
    Copy the full SHA
    57fc5f6 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2024

  1. Further code review changes

    * Refactored LDAP string writing logic into a separate WriteLdapString method in AsnWriterExtensions.
    * Replaced separate AsnWriter instances with a single one (reduced memory usage when compared to multiple instances being active, even with varying buffer sizes.)
    * Resolved backwards-compatibility issue when attempting to process an attribute name which contains invalid UTF-8 characters.
    * Correcting expected ASN tag when parsing an attribute name in a sort result.
    edwardneal committed Jul 26, 2024
    Configuration menu
    Copy the full SHA
    f1aca42 View commit details
    Browse the repository at this point in the history