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

Intended handling of UnknownBERTag? #240

Open
AaronAtDuo opened this issue Aug 1, 2022 · 0 comments
Open

Intended handling of UnknownBERTag? #240

AaronAtDuo opened this issue Aug 1, 2022 · 0 comments

Comments

@AaronAtDuo
Copy link

There is a TODO that implies better handling of an unknown BER type was intended:

print(str(UnknownBERTag(i, context))) # TODO

We would like to alter this behavior, since it causes a number of issues for us; but it's not clear what the intended behavior should be. If folks can agree on how this case should be handled, we would be willing to implement and PR a change.

Random thoughts based on an investigation into this:
Simply raising the UnknownBERTag (it is an Exception) would be the simplest way to handle it. However, that might not be the ideal behavior when the unknown tag is in some optional piece of LDAP that we can simply ignore if it's unrecognized.

Returning None can cause issues if we're decoding a multi-part LDAP message with berDecodeMultiple - in that case the unknown tag is simply skipped (

if n is not None:
)
But if we then assume the LDAP message has a certain number of parts (as in
if isinstance(l[2], BEROctetString):
) this causes an IndexError.

This is similar to #137 but the OP there is simply asking what a certain unknown tag is, not how to handle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant