|
From: Andreas H. <aha...@te...> - 2007-06-05 21:12:52
|
I have been having fun with controls. Today I tried to use the Pre-Read control together with the modify+increment extension, so that modify+increment becomes actually useful. I first added the encoding part to the ldap.so module, but later got a response from the pyasn1 mailing list and tried again in pure python. The result is attached. It's not complete yet, just a test. The script uses mod_increment to increment uidNumber and gidNumber by one. Attached to the modify operation is the preread control, so the response includes the value prior to the modification. Here is the output of two consecutive runs. Both attributes started at 1000 in LDAP: $ ./preread-asn1.py res: (103, [], 2, [PreReadControl(1.3.6.1.1.13.1,1.3.6.1.1.13.1,'0M\x04\x1fcn=unixIdPool,dc=example,dc=com0*0\x13\x04\tgidNumber1\x06\x04\x0410000\x13\x04\tuidNumber1\x06\x04\x041000')]) $ ./preread-asn1.py res: (103, [], 2, [PreReadControl(1.3.6.1.1.13.1,1.3.6.1.1.13.1,'0M\x04\x1fcn=unixIdPool,dc=example,dc=com0*0\x13\x04\tgidNumber1\x06\x04\x0410010\x13\x04\tuidNumber1\x06\x04\x041001')]) First one returns "1000", and the second one "1001" for both attributes. Now it's at 1002. The decoding part will probably be more difficult... As the control response is a SearchResultEntry which is a bit more complex to decode. |