making ldap DNs a bit easier to work with
Howard Chu
hyc at highlandsun.com
Thu Dec 10 18:04:16 MST 2009
tridge at samba.org wrote:
> Hi Simo,
>
> I'm curious what you think about the patch below.
>
> One of the things that has always annoyed me about LDAP is the
> verboseness of the command lines, and the fact that you need to keep
> changing long DNs when talking to different servers. This also affects
> ldif files, test scripts etc. I've typed in long DNs far too often,
> and it gets tiring.
>
> So the patch below makes life easier by allowing a special '@'
> component in any DN which then expands to the base DN of the
> database. This means you can do something like:
>
> ldbsearch -b CN=Users,@
>
> and the '@' would get auto-replaced by the base DN of the database you
> are connecting to. It also works in ldif, so you can do:
>
> dn: CN=testc,CN=Users,@
> objectclass: container
>
> I think this would make life much easier for testing, for sharing
> command lines when helping someone on IRC and when administering lots
> of LDAP servers. The number of times I've mis-typed a very long base
> DN is huge, and it seems to me that computers are supposed to make
> life easier, and remove this sort of drudgery.
>
> So, what do you think?
>
> Cheers, Tridge
>
> PS: I've CCd Howard as he may have comments :-)
Oh boy... I'm skeptical about its usefulness, especially in LDIF - you need to
have complete schema knowledge in the client to know that an attribute has DN
syntax and thus needs to be scanned for this meta-character.
Since your premise is to make things easier to deal with in shells and in test
scripts, I think the right thing to do is solve this in the shell. E.g., just
set BASE="<the baseDN>" and use $BASE on your commandlines and in LDIFs that
you feed thru shell heredocs etc. No code patching required...
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/
More information about the samba-technical
mailing list