r19832: better prototypes for the linearization functions:
[kamenim/samba.git] / source4 / lib / ldb / ldb_ildap / ldb_ildap.c
index 5a3ccd6977957cadf7a68636f34c9252d513ddbf..567fe4bd5f8f575612bc6d7f5426867b89ef49c6 100644 (file)
@@ -49,6 +49,7 @@
 #include "libcli/ldap/ldap.h"
 #include "libcli/ldap/ldap_client.h"
 #include "auth/auth.h"
+#include "auth/credentials/credentials.h"
 
 struct ildb_private {
        struct ldap_connection *ldap;
@@ -272,8 +273,8 @@ static void ildb_callback(struct ldap_request *req)
 
                                search = &(msg->r.SearchResultEntry);
                
-                               ares->message->dn = ldb_dn_explode_or_special(ares->message, search->dn);
-                               if (ares->message->dn == NULL) {
+                               ares->message->dn = ldb_dn_new(ares->message, ac->module->ldb, search->dn);
+                               if ( ! ldb_dn_validate(ares->message->dn)) {
                                        handle->status = LDB_ERR_OPERATIONS_ERROR;
                                        return;
                                }
@@ -451,7 +452,7 @@ static int ildb_search(struct ldb_module *module, struct ldb_request *req)
        if (req->op.search.base == NULL) {
                msg->r.SearchRequest.basedn = talloc_strdup(msg, "");
        } else {
-               msg->r.SearchRequest.basedn  = ldb_dn_linearize(msg, req->op.search.base);
+               msg->r.SearchRequest.basedn  = ldb_dn_alloc_linearized(msg, req->op.search.base);
        }
        if (msg->r.SearchRequest.basedn == NULL) {
                ldb_set_errstring(module->ldb, "Unable to determine baseDN");
@@ -503,7 +504,7 @@ static int ildb_add(struct ldb_module *module, struct ldb_request *req)
 
        msg->type = LDAP_TAG_AddRequest;
 
-       msg->r.AddRequest.dn = ldb_dn_linearize(msg, req->op.add.message->dn);
+       msg->r.AddRequest.dn = ldb_dn_alloc_linearized(msg, req->op.add.message->dn);
        if (msg->r.AddRequest.dn == NULL) {
                talloc_free(msg);
                return LDB_ERR_INVALID_DN_SYNTAX;
@@ -553,7 +554,7 @@ static int ildb_modify(struct ldb_module *module, struct ldb_request *req)
 
        msg->type = LDAP_TAG_ModifyRequest;
 
-       msg->r.ModifyRequest.dn = ldb_dn_linearize(msg, req->op.mod.message->dn);
+       msg->r.ModifyRequest.dn = ldb_dn_alloc_linearized(msg, req->op.mod.message->dn);
        if (msg->r.ModifyRequest.dn == NULL) {
                talloc_free(msg);
                return LDB_ERR_INVALID_DN_SYNTAX;
@@ -601,7 +602,7 @@ static int ildb_delete(struct ldb_module *module, struct ldb_request *req)
 
        msg->type = LDAP_TAG_DelRequest;
        
-       msg->r.DelRequest.dn = ldb_dn_linearize(msg, req->op.del.dn);
+       msg->r.DelRequest.dn = ldb_dn_alloc_linearized(msg, req->op.del.dn);
        if (msg->r.DelRequest.dn == NULL) {
                talloc_free(msg);
                return LDB_ERR_INVALID_DN_SYNTAX;
@@ -631,7 +632,7 @@ static int ildb_rename(struct ldb_module *module, struct ldb_request *req)
        }
 
        msg->type = LDAP_TAG_ModifyDNRequest;
-       msg->r.ModifyDNRequest.dn = ldb_dn_linearize(msg, req->op.rename.olddn);
+       msg->r.ModifyDNRequest.dn = ldb_dn_alloc_linearized(msg, req->op.rename.olddn);
        if (msg->r.ModifyDNRequest.dn == NULL) {
                talloc_free(msg);
                return LDB_ERR_INVALID_DN_SYNTAX;
@@ -647,8 +648,7 @@ static int ildb_rename(struct ldb_module *module, struct ldb_request *req)
        }
 
        msg->r.ModifyDNRequest.newsuperior =
-               ldb_dn_linearize(msg,
-                                ldb_dn_get_parent(msg, req->op.rename.newdn));
+               ldb_dn_alloc_linearized(msg, ldb_dn_get_parent(msg, req->op.rename.newdn));
        if (msg->r.ModifyDNRequest.newsuperior == NULL) {
                talloc_free(msg);
                return LDB_ERR_INVALID_DN_SYNTAX;