From 6e7be5f4d1eccccb93f8e3ed2751e8851f94517f Mon Sep 17 00:00:00 2001 From: Kamen Mazdrashki Date: Thu, 18 Mar 2010 17:04:34 +0200 Subject: s4/ldif: Handle Schema:schemaInfo blobs --- source4/lib/ldb-samba/ldif_handlers.c | 20 ++++++++++++++++++++ source4/lib/ldb-samba/ldif_handlers.h | 1 + 2 files changed, 21 insertions(+) (limited to 'source4/lib/ldb-samba') diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c index ebaa024cb6..11f5914b37 100644 --- a/source4/lib/ldb-samba/ldif_handlers.c +++ b/source4/lib/ldb-samba/ldif_handlers.c @@ -491,6 +491,19 @@ static int ldif_comparison_objectCategory(struct ldb_context *ldb, void *mem_ctx v1, v2); } +/* + convert a NDR formatted blob to a ldif formatted schemaInfo +*/ +static int ldif_write_schemaInfo(struct ldb_context *ldb, void *mem_ctx, + const struct ldb_val *in, struct ldb_val *out) +{ + return ldif_write_NDR(ldb, mem_ctx, in, out, + sizeof(struct repsFromToBlob), + (ndr_pull_flags_fn_t)ndr_pull_schemaInfoBlob, + (ndr_print_fn_t)ndr_print_schemaInfoBlob, + true); +} + /* convert a ldif formatted prefixMap to a NDR formatted blob */ @@ -937,6 +950,12 @@ static const struct ldb_schema_syntax samba_syntaxes[] = { .ldif_write_fn = ldb_handler_copy, .canonicalise_fn = ldif_canonicalise_objectCategory, .comparison_fn = ldif_comparison_objectCategory + },{ + .name = LDB_SYNTAX_SAMBA_SCHEMAINFO, + .ldif_read_fn = ldb_handler_copy, + .ldif_write_fn = ldif_write_schemaInfo, + .canonicalise_fn = ldb_handler_copy, + .comparison_fn = ldb_comparison_binary },{ .name = LDB_SYNTAX_SAMBA_PREFIX_MAP, .ldif_read_fn = ldif_read_prefixMap, @@ -1063,6 +1082,7 @@ static const struct { { "netbootGUID", LDB_SYNTAX_SAMBA_GUID }, { "msDS-OptionalFeatureGUID", LDB_SYNTAX_SAMBA_GUID }, { "objectCategory", LDB_SYNTAX_SAMBA_OBJECT_CATEGORY }, + { "schemaInfo", LDB_SYNTAX_SAMBA_SCHEMAINFO }, { "prefixMap", LDB_SYNTAX_SAMBA_PREFIX_MAP }, { "repsFrom", LDB_SYNTAX_SAMBA_REPSFROMTO }, { "repsTo", LDB_SYNTAX_SAMBA_REPSFROMTO }, diff --git a/source4/lib/ldb-samba/ldif_handlers.h b/source4/lib/ldb-samba/ldif_handlers.h index 8e4df77ffc..bd5ed3145e 100644 --- a/source4/lib/ldb-samba/ldif_handlers.h +++ b/source4/lib/ldb-samba/ldif_handlers.h @@ -5,6 +5,7 @@ #define LDB_SYNTAX_SAMBA_SECURITY_DESCRIPTOR "1.2.840.113556.1.4.907" #define LDB_SYNTAX_SAMBA_GUID "LDB_SYNTAX_SAMBA_GUID" #define LDB_SYNTAX_SAMBA_OBJECT_CATEGORY "LDB_SYNTAX_SAMBA_OBJECT_CATEGORY" +#define LDB_SYNTAX_SAMBA_SCHEMAINFO "LDB_SYNTAX_SAMBA_SCHEMAINFO" #define LDB_SYNTAX_SAMBA_PREFIX_MAP "LDB_SYNTAX_SAMBA_PREFIX_MAP" #define LDB_SYNTAX_SAMBA_INT32 "LDB_SYNTAX_SAMBA_INT32" #define LDB_SYNTAX_SAMBA_REPSFROMTO "LDB_SYNTAX_SAMBA_REPSFROMTO" -- cgit