summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-08-24 20:22:18 +1000
committerAndrew Bartlett <abartlet@samba.org>2009-08-24 20:24:19 +1000
commitbe9441ac3fa167f97f54700e52dec9995b170fa3 (patch)
tree9eb52828478e37f11e25c5a9cf5ef0676dfbca8d /source4
parent7234a24f821743c60075d1e2868fba7b0f2a8f8b (diff)
downloadsamba-be9441ac3fa167f97f54700e52dec9995b170fa3.tar.gz
samba-be9441ac3fa167f97f54700e52dec9995b170fa3.tar.bz2
samba-be9441ac3fa167f97f54700e52dec9995b170fa3.zip
s4:dsdb Use talloc_strndup() to ensure OIDs are null terminated
The OIDs are not NULL terminated by the python caller, in line with the LDB API, but we need them to be here, as we were casting them to a string. Andrew Bartlett
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema_fsmo.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
index adc0fe41d0..c482ab57df 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
@@ -172,8 +172,8 @@ static int schema_fsmo_add(struct ldb_module *module, struct ldb_request *req)
{
struct ldb_context *ldb;
struct dsdb_schema *schema;
- const char *attributeID = NULL;
- const char *governsID = NULL;
+ const struct ldb_val *attributeID = NULL;
+ const struct ldb_val *governsID = NULL;
const char *oid_attr = NULL;
const char *oid = NULL;
uint32_t id32;
@@ -202,21 +202,24 @@ static int schema_fsmo_add(struct ldb_module *module, struct ldb_request *req)
return LDB_ERR_UNWILLING_TO_PERFORM;
}
- attributeID = samdb_result_string(req->op.add.message, "attributeID", NULL);
- governsID = samdb_result_string(req->op.add.message, "governsID", NULL);
+ attributeID = ldb_msg_find_ldb_val(req->op.add.message, "attributeID");
+ governsID = ldb_msg_find_ldb_val(req->op.add.message, "governsID");
if (attributeID) {
oid_attr = "attributeID";
- oid = attributeID;
+ oid = talloc_strndup(req, (const char *)attributeID->data, attributeID->length);
} else if (governsID) {
oid_attr = "governsID";
- oid = governsID;
+ oid = talloc_strndup(req, (const char *)governsID->data, governsID->length);
+ } else {
+ return ldb_next_request(module, req);
}
if (!oid) {
- return ldb_next_request(module, req);
+ ldb_oom(ldb);
+ return LDB_ERR_OPERATIONS_ERROR;
}
-
+
status = dsdb_map_oid2int(schema, oid, &id32);
if (W_ERROR_IS_OK(status)) {
return ldb_next_request(module, req);