summaryrefslogtreecommitdiff
path: root/source4/dsdb/schema/schema_init.c
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2012-04-15 14:50:20 -0700
committerMichael Adam <obnox@samba.org>2012-04-18 00:06:59 +0200
commit167c6eb61ee6211a63ffd98f9b86fa300472ea96 (patch)
treec87d5b01a447480fe9dee88c6a4ee3a3d06d5e5a /source4/dsdb/schema/schema_init.c
parent6ccaf279da949e945a09e90d3be8ec5b74128369 (diff)
downloadsamba-167c6eb61ee6211a63ffd98f9b86fa300472ea96.tar.gz
samba-167c6eb61ee6211a63ffd98f9b86fa300472ea96.tar.bz2
samba-167c6eb61ee6211a63ffd98f9b86fa300472ea96.zip
s4-schema: rename dsdb_attribute_from_ldb to dsdb_set_attribute_from_ldb and dsdb_class_from_ldb to dsdb_set_class_from_ldb
Diffstat (limited to 'source4/dsdb/schema/schema_init.c')
-rw-r--r--source4/dsdb/schema/schema_init.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/source4/dsdb/schema/schema_init.c b/source4/dsdb/schema/schema_init.c
index 93070503c7..2db708d2df 100644
--- a/source4/dsdb/schema/schema_init.c
+++ b/source4/dsdb/schema/schema_init.c
@@ -614,14 +614,17 @@ static int dsdb_schema_setup_ldb_schema_attribute(struct ldb_context *ldb,
}\
} while (0)
-WERROR dsdb_attribute_from_ldb(struct ldb_context *ldb,
- struct dsdb_schema *schema,
- struct ldb_message *msg)
+/** Create an dsdb_attribute out of ldb message, attr must be already talloced
+ */
+
+WERROR dsdb_attribute_from_ldb(const struct dsdb_schema *schema,
+ struct ldb_message *msg,
+ struct dsdb_attribute *attr)
{
WERROR status;
- struct dsdb_attribute *attr = talloc_zero(schema, struct dsdb_attribute);
- if (!attr) {
- return WERR_NOMEM;
+ if (attr == NULL) {
+ DEBUG(0, ("%s: attr is null, it's expected not to be so\n", __location__));
+ return WERR_INVALID_PARAM;
}
GET_STRING_LDB(msg, "cn", attr, attr, cn, false);
@@ -690,6 +693,24 @@ WERROR dsdb_attribute_from_ldb(struct ldb_context *ldb,
GET_BOOL_LDB(msg, "isDefunct", attr, isDefunct, false);
GET_BOOL_LDB(msg, "systemOnly", attr, systemOnly, false);
+ return WERR_OK;
+}
+
+WERROR dsdb_set_attribute_from_ldb(struct ldb_context *ldb,
+ struct dsdb_schema *schema,
+ struct ldb_message *msg)
+{
+ WERROR status;
+ struct dsdb_attribute *attr = talloc_zero(schema, struct dsdb_attribute);
+ if (!attr) {
+ return WERR_NOMEM;
+ }
+
+ status = dsdb_attribute_from_ldb(schema, msg, attr);
+ if (!W_ERROR_IS_OK(status)) {
+ return status;
+ }
+
attr->syntax = dsdb_syntax_for_attribute(attr);
if (!attr->syntax) {
DEBUG(0,(__location__ ": Unknown schema syntax for %s\n",
@@ -709,7 +730,7 @@ WERROR dsdb_attribute_from_ldb(struct ldb_context *ldb,
return WERR_OK;
}
-WERROR dsdb_class_from_ldb(struct dsdb_schema *schema,
+WERROR dsdb_set_class_from_ldb(struct dsdb_schema *schema,
struct ldb_message *msg)
{
WERROR status;