s4-ldb: added ldif handler for the dnsRecord attribute
authorAndrew Tridgell <tridge@samba.org>
Thu, 5 Aug 2010 05:22:49 +0000 (15:22 +1000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 5 Aug 2010 07:31:29 +0000 (17:31 +1000)
source4/lib/ldb-samba/ldif_handlers.c
source4/lib/ldb-samba/ldif_handlers.h
source4/lib/ldb-samba/wscript_build

index a7706ac6dcf1e2ead3f669f9b74f07f0f7eeca0b..0ff6d32deecc837e99447f2bc419fd3617bee4c9 100644 (file)
@@ -30,6 +30,7 @@
 #include "librpc/gen_ndr/ndr_security.h"
 #include "librpc/gen_ndr/ndr_misc.h"
 #include "librpc/gen_ndr/ndr_drsblobs.h"
+#include "librpc/gen_ndr/ndr_dnsp.h"
 #include "librpc/ndr/libndr.h"
 #include "libcli/security/security.h"
 #include "param/param.h"
@@ -868,6 +869,20 @@ static int ldif_write_replUpToDateVector(struct ldb_context *ldb, void *mem_ctx,
 }
 
 
+/*
+  convert a NDR formatted blob to a ldif formatted dnsRecord
+*/
+static int ldif_write_dnsRecord(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 dnsp_DnssrvRpcRecord),
+                             (ndr_pull_flags_fn_t)ndr_pull_dnsp_DnssrvRpcRecord,
+                             (ndr_print_fn_t)ndr_print_dnsp_DnssrvRpcRecord,
+                             true);
+}
+
+
 static int extended_dn_write_hex(struct ldb_context *ldb, void *mem_ctx,
                                 const struct ldb_val *in, struct ldb_val *out)
 {
@@ -1094,7 +1109,13 @@ static const struct ldb_schema_syntax samba_syntaxes[] = {
                .ldif_write_fn    = ldif_write_range64,
                .canonicalise_fn  = ldif_canonicalise_int64,
                .comparison_fn    = ldif_comparison_int64
-       },
+       },{
+               .name             = LDB_SYNTAX_SAMBA_DNSRECORD,
+               .ldif_read_fn     = ldb_handler_copy,
+               .ldif_write_fn    = ldif_write_dnsRecord,
+               .canonicalise_fn  = ldb_handler_copy,
+               .comparison_fn    = ldb_comparison_binary
+       }
 };
 
 static const struct ldb_dn_extended_syntax samba_dn_syntax[] = {
@@ -1207,6 +1228,7 @@ static const struct {
        { "invocationId",                       LDB_SYNTAX_SAMBA_GUID },
        { "parentGUID",                         LDB_SYNTAX_SAMBA_GUID },
        { "msDS-OptionalFeatureGUID",           LDB_SYNTAX_SAMBA_GUID },
+       { "dnsRecord",                          LDB_SYNTAX_SAMBA_DNSRECORD },
 };
 
 const struct ldb_schema_syntax *ldb_samba_syntax_by_name(struct ldb_context *ldb, const char *name)
index bd5ed3145ecbfe5c9704c626ca6d2bee9e12accf..33373fa01db556762d608364c2ad0c123a4b4770 100644 (file)
@@ -12,6 +12,7 @@
 #define LDB_SYNTAX_SAMBA_REPLPROPERTYMETADATA   "LDB_SYNTAX_SAMBA_REPLPROPERTYMETADATA"
 #define LDB_SYNTAX_SAMBA_REPLUPTODATEVECTOR     "LDB_SYNTAX_SAMBA_REPLUPTODATEVECTOR"
 #define LDB_SYNTAX_SAMBA_RANGE64               "LDB_SYNTAX_SAMBA_RANGE64"
+#define LDB_SYNTAX_SAMBA_DNSRECORD             "LDB_SYNTAX_SAMBA_DNSRECORD"
 
 #include "lib/ldb-samba/ldif_handlers_proto.h"
 
index a58316ec13a985c1dd8825354764603ac7596b95..7fdaac8b90252c0e9466fce8a7cca62683ccd86f 100644 (file)
@@ -9,7 +9,7 @@ bld.SAMBA_SUBSYSTEM('LDBSAMBA',
        autoproto='ldif_handlers_proto.h',
        public_deps='ldb',
        public_headers='ldb_wrap.h',
-       deps='LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_DRSBLOBS CREDENTIALS UTIL_LDB'
+       deps='LIBSECURITY SAMDB_SCHEMA LIBNDR NDR_DRSBLOBS CREDENTIALS UTIL_LDB NDR_DNSP'
        )