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


In reply to Re: tcp proxy? by g0n
in thread tcp proxy? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.