diff options
author | Simo Sorce <idra@samba.org> | 2008-12-22 15:54:56 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2008-12-22 18:52:48 -0500 |
commit | 41718e315ea78998fab0893fd5f148a49d8faab8 (patch) | |
tree | ecbc13fb3abce56481ba04e13d9aa1b69b19783b /ldb/common/ldb_attributes.c | |
parent | a93a69380dc6718c49879af628ed69f8e2b70797 (diff) | |
download | sssd-41718e315ea78998fab0893fd5f148a49d8faab8.tar.gz sssd-41718e315ea78998fab0893fd5f148a49d8faab8.tar.xz sssd-41718e315ea78998fab0893fd5f148a49d8faab8.zip |
Rebase ldb code with all changes in samba master
Diffstat (limited to 'ldb/common/ldb_attributes.c')
-rw-r--r-- | ldb/common/ldb_attributes.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/ldb/common/ldb_attributes.c b/ldb/common/ldb_attributes.c index 747f24178..001bc45ee 100644 --- a/ldb/common/ldb_attributes.c +++ b/ldb/common/ldb_attributes.c @@ -225,3 +225,50 @@ int ldb_setup_wellknown_attributes(struct ldb_context *ldb) return LDB_SUCCESS; } + +/* + add a extended dn syntax to the ldb_schema +*/ +int ldb_dn_extended_add_syntax(struct ldb_context *ldb, + unsigned flags, + const struct ldb_dn_extended_syntax *syntax) +{ + int n; + struct ldb_dn_extended_syntax *a; + + if (!syntax) { + return LDB_ERR_OPERATIONS_ERROR; + } + + n = ldb->schema.num_dn_extended_syntax + 1; + + a = talloc_realloc(ldb, ldb->schema.dn_extended_syntax, + struct ldb_dn_extended_syntax, n); + + if (!a) { + return LDB_ERR_OPERATIONS_ERROR; + } + + a[ldb->schema.num_dn_extended_syntax] = *syntax; + ldb->schema.dn_extended_syntax = a; + + ldb->schema.num_dn_extended_syntax = n; + + return LDB_SUCCESS; +} + +/* + return the extended dn syntax for a given name +*/ +const struct ldb_dn_extended_syntax *ldb_dn_extended_syntax_by_name(struct ldb_context *ldb, + const char *name) +{ + int i; + for (i=0; i < ldb->schema.num_dn_extended_syntax; i++) { + if (ldb_attr_cmp(ldb->schema.dn_extended_syntax[i].name, name) == 0) { + return &ldb->schema.dn_extended_syntax[i]; + } + } + return NULL; +} + |