in reply to tcp proxy?

Is it possible? Yes.

Is it easy? I'm afraid not.

Since you want to modify the content of the bind request, you will need to get the ASN1 encoded data from the bind request packet from the app, convert it (using Convert::ASN1) into a usable form, change the "uid" to "cn", convert back to ASN1, and forward the packet on.

ASN1 encoded data contains a checksum, so you almost certainly won't be able to modify the packet without converting it.

I would recommend exploring the perldocs & source code of Convert::ASN1 and Net::LDAP. I have a block of code that receives a bind request on an open port and decodes it which might give you a starting point. I will post it on this thread when I've removed company specifics from it. In the meantime take a look at the modules above - the source code of both of them is reasonably straightforward to follow.

Update: You might also want to post this question to the perl-ldap mailing list http://lists.perl.org/showlist.cgi?name=perl-ldap.

Update: The code in the link posted by mtve does the same as the code I intended to post.

--------------------------------------------------------------

g0n, backpropagated monk