making ldap DNs a bit easier to work with

simo idra at samba.org
Thu Dec 10 19:37:51 MST 2009


On Fri, 2009-12-11 at 11:46 +1100, 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?

To be honest I am not sure.
As a command-line shortcut (resolved by the caller before ldb_dn is
formed) I wouldn't be opposed, but putting it into ldb_dn looks a bit
dirty to me.

Especially if you consider that ldb_get_default_basedn(ldb) will return
something useful only in case the rootdse module is loaded and that's
not the case for standalone ldb.
With standalone ldb I think you'll get this code to crash.

But the problem is that I do not want to encourage people to create non
standard ldif files. If this get widespread we will do just the same bad
stuff MS does with their proprietary and incompatible extensions.

> Cheers, Tridge
> 
> PS: I've CCd Howard as he may have comments :-)

Oh, I just see Howard is not amused either :)

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>



More information about the samba-technical mailing list