making ldap DNs a bit easier to work with

Stefan (metze) Metzmacher metze at samba.org
Fri Dec 11 00:29:07 MST 2009


simo schrieb:
> 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.

I agree with simo.

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20091211/a9bdac7d/attachment.pgp>


More information about the samba-technical mailing list