summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb.h
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2014-10-08 16:12:52 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-10-16 17:56:07 +0200
commit8a2a503fa5c01ea037d28b7c902b8821a11084bd (patch)
tree05b87b9b9c26b72fae1c1f983007894868401081 /src/db/sysdb.h
parentca49ae1eee321751681e99f3ebe2547211db3bf6 (diff)
downloadsssd-8a2a503fa5c01ea037d28b7c902b8821a11084bd.tar.gz
sssd-8a2a503fa5c01ea037d28b7c902b8821a11084bd.tar.xz
sssd-8a2a503fa5c01ea037d28b7c902b8821a11084bd.zip
sysdb: add sysdb_attrs_add_val_safe() and sysdb_attrs_add_string_safe()
sysdb_attrs_add_val_safe() works like sysdb_attrs_add_val() but checks if the attribute value to add already exists. In this case the value list is not changed. This is useful if values are added from different sources at different times to avoid LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS errors from ldb_modify() later on. sysdb_attrs_add_string_safe() does the same for string arguments Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/db/sysdb.h')
-rw-r--r--src/db/sysdb.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/db/sysdb.h b/src/db/sysdb.h
index b039a673a..602db2c04 100644
--- a/src/db/sysdb.h
+++ b/src/db/sysdb.h
@@ -287,6 +287,10 @@ struct range_info {
/* values are copied in the structure, allocated on "attrs" */
int sysdb_attrs_add_val(struct sysdb_attrs *attrs,
const char *name, const struct ldb_val *val);
+int sysdb_attrs_add_val_safe(struct sysdb_attrs *attrs,
+ const char *name, const struct ldb_val *val);
+int sysdb_attrs_add_string_safe(struct sysdb_attrs *attrs,
+ const char *name, const char *str);
int sysdb_attrs_add_string(struct sysdb_attrs *attrs,
const char *name, const char *str);
int sysdb_attrs_add_lower_case_string(struct sysdb_attrs *attrs,