noirello / bonsai

Simple Python 3 module for LDAP, using libldap2 and winldap C libraries.
MIT License
117 stars 33 forks source link

Question: Persistent Search and Extended Operations #39

Open tck42 opened 4 years ago

tck42 commented 4 years ago

I don't think persistent search is implemented in this library, nor a generic way to expose calling an arbitrary extended operation from python - would you be open to a pull request for those features?

If so, are there any requirements you have before you'd merge that you can think of off the top of your head, or should I take my best guess at the API for each feature, issue the request and just work from there?

noirello commented 4 years ago

I'd be open to it, but I've never figured out what would be the best way to integrate this feature into the module. Do you have a specific API in mind?

tck42 commented 4 years ago

For persistent search I was thinking basically the search API, with the three additional arguments tacked on to the end of the args (change_types, changes_only, return_ecs). Result would be a an ldapsearchiter or something very similar to it; the only question there is how to return the entrychangenotification if it's requested, I was thinking a tuple, (entry,entrychangenotification).

For extended operation, was thinking extendedoperation(req_oid, req_value, decode_resp, encode_req=None). If missing, req would assumed to be bytes, otherwise it'd be called to on req_value before sending to get bytes. decode_resp signature would be decode_resp(oid, resp_bytes).

Though apparently extended ops can be single request multiple response, I'll have to see if I can find a good test case for that, maybe the return from decode_resp can be a tuple of the result and a boolean indicating if there are more messages expected. I'll have to think a bit more on how that would look,

noirello commented 4 years ago

Sounds good. I'd happily see a PR and go from there.