ruby-ldap / ruby-net-ldap

Pure Ruby LDAP library
https://rubygems.org/gems/net-ldap
Other
399 stars 253 forks source link

Add controls for modify and add operations #426

Closed zeroSteiner closed 1 month ago

zeroSteiner commented 9 months ago

This builds on the work #411 to allow user-specified controls to be defined for the modify and add operations as well.

I added tests, but they're pretty weak because the controls are in the data sent to the server and I was unable to find a preferred pattern to test that data is sent on the socket. I tried something like the following but didn't have any luck as it'd throw an error that the function was called an incorrect number of times.

@tcp_socket.should_receive(:write).with("0[\x02\x01\x01h0\x04,uid=added-user1,ou=People,dc=rubyldap,dc=com0\x00\xA0$0\"\x04\x161.2.840.113556.1.4.801\x01\x01\xFF\x04\x050\x03\x02\x01\x04".b).once.and_return(89)