summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-10-23 10:08:27 +1100
committerAndrew Tridgell <tridge@samba.org>2009-10-23 15:42:14 +1100
commitb0eb8a1bbb5dc5ea51a82a730f71562d89572a21 (patch)
tree46c062839d578607f227e36f2cff80dfe555b1c1 /source4
parenta84abe7053b92de23612ded9c459ba8c76bcc567 (diff)
downloadsamba-b0eb8a1bbb5dc5ea51a82a730f71562d89572a21.tar.gz
samba-b0eb8a1bbb5dc5ea51a82a730f71562d89572a21.tar.bz2
samba-b0eb8a1bbb5dc5ea51a82a730f71562d89572a21.zip
s4:dsdb Do less allocation when searching for partitions modules
(it didn't help that the previous allocation was on the wrong long-term context) Andrew Bartlett
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition_init.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c b/source4/dsdb/samdb/ldb_modules/partition_init.c
index 2a1f34e9bc..7d5c130778 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_init.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_init.c
@@ -89,32 +89,34 @@ static int partition_load_modules(struct ldb_context *ldb,
}
for (i=0; i < modules_attributes->num_values; i++) {
- char *base;
char *p;
-
+ DATA_BLOB dn_blob;
data->modules[i] = talloc(data->modules, struct partition_module);
if (!data->modules[i]) {
ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
- base = talloc_strdup(data->partitions, (char *)modules_attributes->values[i].data);
- p = strchr(base, ':');
+ dn_blob = modules_attributes->values[i];
+
+ p = strchr((const char *)dn_blob.data, ':');
if (!p) {
ldb_asprintf_errstring(ldb,
"partition_load_modules: "
- "invalid form for partition module record (missing ':'): %s", base);
+ "invalid form for partition module record (missing ':'): %s", (const char *)dn_blob.data);
return LDB_ERR_CONSTRAINT_VIOLATION;
}
- p[0] = '\0';
+ /* Now trim off the filename */
+ dn_blob.length = ((uint8_t *)p - dn_blob.data);
+
p++;
data->modules[i]->modules = ldb_modules_list_from_string(ldb, data->modules[i],
p);
- if (strcmp(base, "*") == 0) {
+ if (dn_blob.length == 1 && dn_blob.data[0] == '*') {
data->modules[i]->dn = NULL;
} else {
- data->modules[i]->dn = ldb_dn_new(data->modules[i], ldb, base);
+ data->modules[i]->dn = ldb_dn_from_ldb_val(data->modules[i], ldb, &dn_blob);
if (!data->modules[i]->dn || !ldb_dn_validate(data->modules[i]->dn)) {
return LDB_ERR_OPERATIONS_ERROR;
}