s4:ldb_ildap: try to pass extended DNs to the server
authorAndrew Bartlett <abartlet@samba.org>
Tue, 16 Dec 2008 07:25:44 +0000 (08:25 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 17 Dec 2008 01:29:24 +0000 (12:29 +1100)
Whenever we pass a DN to the LDAP server, we now use
ldb_dn_get_extended_linearized().  This allows us to send the extended
DN if set, and therefore allows searches of the form
'<GUID=aaa45ea0-94cd-45e9-8753-abe455d9a8f1>'.

We actually use the '0' format (GUID=aaa45ea094cd45e98753abe455d9a8f1)
because it is more widely supported (by Win2k in particular).

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source4/lib/ldb/ldb_ildap/ldb_ildap.c

index 93e81d42449cbb1f35c135f1cf567d7735b9f062..ae79bdfa481a57517146e6766205da47ffc9ba67 100644 (file)
@@ -428,7 +428,7 @@ static int ildb_search(struct ildb_context *ac)
        if (req->op.search.base == NULL) {
                msg->r.SearchRequest.basedn = talloc_strdup(msg, "");
        } else {
-               msg->r.SearchRequest.basedn  = ldb_dn_alloc_linearized(msg, req->op.search.base);
+               msg->r.SearchRequest.basedn  = ldb_dn_get_extended_linearized(msg, req->op.search.base, 0);
        }
        if (msg->r.SearchRequest.basedn == NULL) {
                ldb_set_errstring(ac->module->ldb, "Unable to determine baseDN");
@@ -473,7 +473,7 @@ static int ildb_add(struct ildb_context *ac)
 
        msg->type = LDAP_TAG_AddRequest;
 
-       msg->r.AddRequest.dn = ldb_dn_alloc_linearized(msg, req->op.add.message->dn);
+       msg->r.AddRequest.dn = ldb_dn_get_extended_linearized(msg, req->op.add.message->dn, 0);
        if (msg->r.AddRequest.dn == NULL) {
                talloc_free(msg);
                return LDB_ERR_INVALID_DN_SYNTAX;
@@ -516,7 +516,7 @@ static int ildb_modify(struct ildb_context *ac)
 
        msg->type = LDAP_TAG_ModifyRequest;
 
-       msg->r.ModifyRequest.dn = ldb_dn_alloc_linearized(msg, req->op.mod.message->dn);
+       msg->r.ModifyRequest.dn = ldb_dn_get_extended_linearized(msg, req->op.mod.message->dn, 0);
        if (msg->r.ModifyRequest.dn == NULL) {
                talloc_free(msg);
                return LDB_ERR_INVALID_DN_SYNTAX;
@@ -557,7 +557,7 @@ static int ildb_delete(struct ildb_context *ac)
 
        msg->type = LDAP_TAG_DelRequest;
 
-       msg->r.DelRequest.dn = ldb_dn_alloc_linearized(msg, req->op.del.dn);
+       msg->r.DelRequest.dn = ldb_dn_get_extended_linearized(msg, req->op.del.dn, 0);
        if (msg->r.DelRequest.dn == NULL) {
                talloc_free(msg);
                return LDB_ERR_INVALID_DN_SYNTAX;
@@ -580,7 +580,7 @@ static int ildb_rename(struct ildb_context *ac)
        }
 
        msg->type = LDAP_TAG_ModifyDNRequest;
-       msg->r.ModifyDNRequest.dn = ldb_dn_alloc_linearized(msg, req->op.rename.olddn);
+       msg->r.ModifyDNRequest.dn = ldb_dn_get_extended_linearized(msg, req->op.rename.olddn, 0);
        if (msg->r.ModifyDNRequest.dn == NULL) {
                talloc_free(msg);
                return LDB_ERR_INVALID_DN_SYNTAX;