Nmap Development mailing list archives
Re: LDAP library and scripts
From: Patrik Karlsson <patrik () cqure net>
Date: Tue, 2 Feb 2010 23:02:51 +0100
On 2 feb 2010, at 17.56, David Fifield wrote:
On Tue, Feb 02, 2010 at 04:22:08PM +0100, Patrik Karlsson wrote:I was hoping to do a clean split between asn1, ldap and snmp. Unfortunately the solution I chose sucks as once the libraries start registering their encoders, they do it, as you pointed out, in a global table. This wouldn't be an enormous problem IF there was NO overlap. But I wanted to split the ldap and snmp decoding/encoding into ldap.lua and snmp.lua and keep only the basic encoding in asn1.lua instead of mixing them together in the table decoder in asn1.lua. In order to achieve this, in the current design, they both need to register a decoder for the same tag. This is also the case for eg. the snmp library that encodes booleans as asn null values. So while the idea might have been OK to start with, the result obviously isn't, so we're kind of back to square 1 where I'll be needing to duplicate a lot of code from snmp.lua into ldap.lua in order to get it working.I still think making a clean split is a good design. There are other ways to do it without mutating global state. For example, the encoding functions could take an additional argument that is a table of custom encoding functions. Or, you could instantiate individual encoder objects, and each one of them could have its own table of custom encoders. snmp would create one encoder, and ldap would create another. David Fifield
I went for the OO approach and once I'm done with some more testing I'll send you the code. //Patrik -- Patrik Karlsson http://www.cqure.net _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- LDAP library and scripts Patrik Karlsson (Jan 12)
- Re: LDAP library and scripts David Fifield (Jan 25)
- Re: LDAP library and scripts Patrik Karlsson (Jan 28)
- Re: LDAP library and scripts David Fifield (Feb 01)
- Re: LDAP library and scripts Patrik Karlsson (Feb 02)
- Re: LDAP library and scripts David Fifield (Feb 02)
- Re: LDAP library and scripts David Fifield (Feb 02)
- Re: LDAP library and scripts Patrik Karlsson (Feb 03)
- Re: LDAP library and scripts David Fifield (Feb 14)
- Re: LDAP library and scripts Patrik Karlsson (Jan 28)
- Re: LDAP library and scripts Patrik Karlsson (Feb 02)
- Re: LDAP library and scripts David Fifield (Jan 25)