diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-10-12 07:54:15 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2005-10-12 07:54:15 +0000 |
commit | 1ff55c48687dd7ba22696b734a70c35c2be2d5f0 (patch) | |
tree | 8681e95ff29b156802397a8f80e5785aaa87446f /source/lib/ldb/common/ldb_attributes.c | |
parent | b290a9eca23fa7e610f674a8837e7e94f3c56d21 (diff) | |
download | samba-1ff55c48687dd7ba22696b734a70c35c2be2d5f0.tar.gz samba-1ff55c48687dd7ba22696b734a70c35c2be2d5f0.tar.xz samba-1ff55c48687dd7ba22696b734a70c35c2be2d5f0.zip |
r10915: added a standard attribute handler for a ldap UTC time string
Diffstat (limited to 'source/lib/ldb/common/ldb_attributes.c')
-rw-r--r-- | source/lib/ldb/common/ldb_attributes.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/source/lib/ldb/common/ldb_attributes.c b/source/lib/ldb/common/ldb_attributes.c index 47b4b1788b6..bf955ece3d5 100644 --- a/source/lib/ldb/common/ldb_attributes.c +++ b/source/lib/ldb/common/ldb_attributes.c @@ -138,6 +138,22 @@ void ldb_remove_attrib_handler(struct ldb_context *ldb, const char *attrib) ldb->schema.num_attrib_handlers--; } +/* + setup a attribute handler using a standard syntax +*/ +int ldb_set_attrib_handler_syntax(struct ldb_context *ldb, + const char *attr, const char *syntax) +{ + const struct ldb_attrib_handler *h = ldb_attrib_handler_syntax(ldb, syntax); + struct ldb_attrib_handler h2; + if (h == NULL) { + ldb_debug(ldb, LDB_DEBUG_ERROR, "Unknown syntax '%s'\n", syntax); + return -1; + } + h2 = *h; + h2.attr = attr; + return ldb_set_attrib_handlers(ldb, &h2, 1); +} /* setup the attribute handles for well known attributes @@ -158,17 +174,8 @@ int ldb_setup_wellknown_attributes(struct ldb_context *ldb) }; int i; for (i=0;i<ARRAY_SIZE(wellknown);i++) { - const struct ldb_attrib_handler *h = - ldb_attrib_handler_syntax(ldb, wellknown[i].syntax); - struct ldb_attrib_handler h2; - if (h == NULL) { - ldb_debug(ldb, LDB_DEBUG_ERROR, "Unknown syntax '%s'\n", - wellknown[i].syntax); - return -1; - } - h2 = *h; - h2.attr = wellknown[i].attr; - if (ldb_set_attrib_handlers(ldb, &h2, 1) != 0) { + if (ldb_set_attrib_handler_syntax(ldb, wellknown[i].attr, + wellknown[i].syntax) != 0) { return -1; } } |