[SCM] Samba Shared Repository - branch master updated

Stefan Metzmacher metze at samba.org
Wed Jan 13 08:05:34 MST 2010


The branch, master has been updated
       via  24ecd19... s4:dsdb/resolve_oids: also resolve oid in search attribute list
      from  f715414... s4:dsdb/schema_load: add a TODO about schema reloading

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 24ecd19b30868829a2ffccaed2847e9ff4bb82e3
Author: Stefan Metzmacher <metze at samba.org>
Date:   Tue Sep 29 12:00:39 2009 +0200

    s4:dsdb/resolve_oids: also resolve oid in search attribute list
    
    metze

-----------------------------------------------------------------------

Summary of changes:
 source4/dsdb/samdb/ldb_modules/resolve_oids.c |   59 +++++++++++++++++++++++--
 1 files changed, 55 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/dsdb/samdb/ldb_modules/resolve_oids.c b/source4/dsdb/samdb/ldb_modules/resolve_oids.c
index 053c2ec..ba41033 100644
--- a/source4/dsdb/samdb/ldb_modules/resolve_oids.c
+++ b/source4/dsdb/samdb/ldb_modules/resolve_oids.c
@@ -458,6 +458,10 @@ static int resolve_oids_search(struct ldb_module *module, struct ldb_request *re
 	struct ldb_request *down_req;
 	struct resolve_oids_context *ac;
 	int ret;
+	bool needed = false;
+	const char * const *attrs1;
+	const char **attrs2;
+	uint32_t i;
 
 	ldb = ldb_module_get_ctx(module);
 	schema = dsdb_get_schema(ldb);
@@ -473,12 +477,36 @@ static int resolve_oids_search(struct ldb_module *module, struct ldb_request *re
 
 	ret = resolve_oids_parse_tree_need(ldb, schema,
 					   req->op.search.tree);
-	if (ret == LDB_ERR_COMPARE_FALSE) {
-		return ldb_next_request(module, req);
-	} else if (ret != LDB_ERR_COMPARE_TRUE) {
+	if (ret == LDB_ERR_COMPARE_TRUE) {
+		needed = true;
+	} else if (ret != LDB_ERR_COMPARE_FALSE) {
 		return ret;
 	}
 
+	attrs1 = req->op.search.attrs;
+
+	for (i=0; attrs1 && attrs1[i]; i++) {
+		const char *p;
+		struct dsdb_attribute *a;
+
+		p = strchr(attrs1[i], '.');
+		if (p == NULL) {
+			continue;
+		}
+
+		a = dsdb_attribute_by_attributeID_oid(schema, attrs1[i]);
+		if (a == NULL) {
+			continue;
+		}
+
+		needed = true;
+		break;
+	}
+
+	if (!needed) {
+		return ldb_next_request(module, req);
+	}
+
 	ac = talloc(req, struct resolve_oids_context);
 	if (ac == NULL) {
 		ldb_oom(ldb);
@@ -499,11 +527,34 @@ static int resolve_oids_search(struct ldb_module *module, struct ldb_request *re
 		return ret;
 	}
 
+	attrs2 = str_list_copy_const(ac, req->op.search.attrs);
+	if (req->op.search.attrs && !attrs2) {
+		ldb_oom(ldb);
+		return LDB_ERR_OPERATIONS_ERROR;
+	}
+
+	for (i=0; attrs2 && attrs2[i]; i++) {
+		const char *p;
+		struct dsdb_attribute *a;
+
+		p = strchr(attrs2[i], '.');
+		if (p == NULL) {
+			continue;
+		}
+
+		a = dsdb_attribute_by_attributeID_oid(schema, attrs2[i]);
+		if (a == NULL) {
+			continue;
+		}
+
+		attrs2[i] = a->lDAPDisplayName;
+	}
+
 	ret = ldb_build_search_req_ex(&down_req, ldb, ac,
 				      req->op.search.base,
 				      req->op.search.scope,
 				      tree,
-				      req->op.search.attrs,
+				      attrs2,
 				      req->controls,
 				      ac, resolve_oids_callback,
 				      req);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list