summaryrefslogtreecommitdiffstats
path: root/source4/dsdb
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2014-11-07 07:02:51 +0100
committerAndrew Bartlett <abartlet@samba.org>2015-02-03 05:02:11 +0100
commit8e10c10bd6e601df47a2815c638482e486646f59 (patch)
treec458c9303e45b70c3ea3a01b00f423560561047a /source4/dsdb
parent4944e73d537199208e9895e818ff3233223da5d7 (diff)
downloadsamba-8e10c10bd6e601df47a2815c638482e486646f59.tar.gz
samba-8e10c10bd6e601df47a2815c638482e486646f59.tar.xz
samba-8e10c10bd6e601df47a2815c638482e486646f59.zip
s4-dsdb-util: Mark attributes with ADD flag in samdb_find_or_add_attribute()
At the moment no flags are set and it works fine, since this function is solely used in samldb during ADD requests handling. Pre-setting a flag make it usefull for other modules and request handlers too Change-Id: I7e43dcbe2a8f34e3b0ec16ae2db80ef436df8bfe Signed-off-by: Kamen Mazdrashki <kamenim@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/common/util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index 504afd8b77..6c05b5081a 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -774,6 +774,7 @@ struct ldb_message_element *samdb_find_attribute(struct ldb_context *ldb,
int samdb_find_or_add_attribute(struct ldb_context *ldb, struct ldb_message *msg, const char *name, const char *set_value)
{
+ int ret;
struct ldb_message_element *el;
el = ldb_msg_find_element(msg, name);
@@ -781,7 +782,12 @@ int samdb_find_or_add_attribute(struct ldb_context *ldb, struct ldb_message *msg
return LDB_SUCCESS;
}
- return ldb_msg_add_string(msg, name, set_value);
+ ret = ldb_msg_add_string(msg, name, set_value);
+ if (ret != LDB_SUCCESS) {
+ return ret;
+ }
+ msg->elements[msg->num_elements - 1].flags = LDB_FLAG_MOD_ADD;
+ return LDB_SUCCESS;
}
/*