The branch, master has been updated via dd64f99 build: explain the passing of make options to waf via ab50165 ldb: ldb_errstring() takes ldb_contxt as an argument via 2feb81f s4-dns: Update serial number for zone on dns updates via 7ca0bed s4-selftest: Add tests for RPC dnsserver via b619705 samba-tool: Added dns command for DNS management via 8df2ed4 s4-dns: Added DCERPC dns server for DNS management via a8c7b28 s4-provision: Provision DNS records with correct rank via 51855de werror: Added missing DNS error codes via 65f9a13 s4-dns: Added support for multiple DNS_RPC_RECORDS structures via 0f84c63 s4-dns: Added more data types for dnsserver implementation via 7ba004d ldb-samba: Added handler to decode dnsProperty attribute via 3193e14 dnsp: Added typedefs to interpret dnsProperty attribute for dnsZone objectclass from 8890f70 s4-test: added test suite for common.py code
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit dd64f99fd17c1cb5aeefda91618111c6702832a7 Author: Andrew Tridgell <tri...@samba.org> Date: Thu Oct 20 14:57:13 2011 +1100 build: explain the passing of make options to waf add a comment explaining how we pass make command line options into waf Autobuild-User: Andrew Tridgell <tri...@samba.org> Autobuild-Date: Thu Oct 20 07:24:02 CEST 2011 on sn-devel-104 commit ab50165a0235401d7920e67503c211028f55012d Author: Amitay Isaacs <ami...@gmail.com> Date: Wed Oct 19 10:45:28 2011 +1100 ldb: ldb_errstring() takes ldb_contxt as an argument Signed-off-by: Andrew Tridgell <tri...@samba.org> commit 2feb81f659801444be090b8f90b85a78a59da796 Author: Amitay Isaacs <ami...@gmail.com> Date: Tue Oct 18 15:20:14 2011 +1100 s4-dns: Update serial number for zone on dns updates Signed-off-by: Andrew Tridgell <tri...@samba.org> commit 7ca0bed38d35948f05e30f52d2bf4c391bfc1711 Author: Amitay Isaacs <ami...@gmail.com> Date: Tue Oct 18 12:44:02 2011 +1100 s4-selftest: Add tests for RPC dnsserver Signed-off-by: Andrew Tridgell <tri...@samba.org> commit b619705c22f62a763a83fe57508b16af24a22ef0 Author: Amitay Isaacs <ami...@gmail.com> Date: Mon Oct 17 13:15:40 2011 +1100 samba-tool: Added dns command for DNS management Signed-off-by: Andrew Tridgell <tri...@samba.org> commit 8df2ed42cc4662bd385ea34169ebd3bcd4d8bc17 Author: Amitay Isaacs <ami...@gmail.com> Date: Tue Sep 27 16:53:45 2011 +1000 s4-dns: Added DCERPC dns server for DNS management dnsserver.h - typedefs and prototypes dnsserver.c - RPC API and implementation methods dnsdb.c - samdb operations dnsdata.c - functions to manipulate dns structures dnsutils.c - function for serverinfo and zoneinfo structures Signed-off-by: Andrew Tridgell <tri...@samba.org> commit a8c7b2843553a3ea6b19c8f9a065b1f54c1ff0d7 Author: Amitay Isaacs <ami...@gmail.com> Date: Fri Oct 7 15:39:58 2011 +1100 s4-provision: Provision DNS records with correct rank Signed-off-by: Andrew Tridgell <tri...@samba.org> commit 51855de6338607b0dcca7b81b7fd4577481af40c Author: Amitay Isaacs <ami...@gmail.com> Date: Wed Sep 28 13:15:02 2011 +1000 werror: Added missing DNS error codes Signed-off-by: Andrew Tridgell <tri...@samba.org> commit 65f9a13dc3f3e26aa3f7a9d90abe94a7b2e6bc77 Author: Amitay Isaacs <ami...@gmail.com> Date: Tue Sep 27 17:10:14 2011 +1000 s4-dns: Added support for multiple DNS_RPC_RECORDS structures Windows returns multiple DNS_RPC_RECORDS structures, but there is no well defined structure in [MS-DNSP] doc. Added hand-written code to parse ndr. Pair-Programmed-With: Andrew Tridgell <tri...@samba.org> Signed-off-by: Andrew Tridgell <tri...@samba.org> commit 0f84c634fc035f31e284b95b93e66be1a541c680 Author: Amitay Isaacs <ami...@gmail.com> Date: Tue Sep 27 17:07:04 2011 +1000 s4-dns: Added more data types for dnsserver implementation Windows uses WERROR on dnsserver pipe. Signed-off-by: Andrew Tridgell <tri...@samba.org> commit 7ba004da246ea2a6c4738c6d3ea5dfafdbdbf1d6 Author: Amitay Isaacs <ami...@gmail.com> Date: Wed Sep 21 14:56:19 2011 +1000 ldb-samba: Added handler to decode dnsProperty attribute Signed-off-by: Andrew Tridgell <tri...@samba.org> commit 3193e142d40b9dcdbf7cb55f708dae7bba398c3c Author: Amitay Isaacs <ami...@gmail.com> Date: Wed Sep 21 14:55:06 2011 +1000 dnsp: Added typedefs to interpret dnsProperty attribute for dnsZone objectclass Signed-off-by: Andrew Tridgell <tri...@samba.org> ----------------------------------------------------------------------- Summary of changes: buildtools/wafsamba/samba_utils.py | 7 + lib/ldb-samba/ldif_handlers.c | 21 + lib/ldb-samba/ldif_handlers.h | 1 + lib/ldb/common/ldb_modules.c | 2 +- lib/param/loadparm.c | 2 +- libcli/util/werror.h | 36 + librpc/idl/dnsp.idl | 126 ++- librpc/idl/dnsserver.idl | 929 ++++++---- librpc/ndr/ndr_dnsserver.c | 63 + librpc/ndr/ndr_dnsserver.h | 25 + librpc/wscript_build | 2 +- selftest/target/Samba4.pm | 1 + source4/rpc_server/dnsserver/dcerpc_dnsserver.c | 2021 ++++++++++++++++++++ source4/rpc_server/dnsserver/dnsdata.c | 795 ++++++++ source4/rpc_server/dnsserver/dnsdb.c | 498 +++++ source4/rpc_server/dnsserver/dnsserver.h | 220 +++ source4/rpc_server/dnsserver/dnsutils.c | 309 +++ source4/rpc_server/wscript_build | 7 + source4/scripting/python/samba/netcmd/dns.py | 859 +++++++++ source4/scripting/python/samba/netcmd/main.py | 2 + .../scripting/python/samba/provision/sambadns.py | 41 +- .../python/samba/tests/dcerpc/dnsserver.py | 181 ++ source4/selftest/tests.py | 1 + 23 files changed, 5747 insertions(+), 402 deletions(-) create mode 100644 librpc/ndr/ndr_dnsserver.c create mode 100644 librpc/ndr/ndr_dnsserver.h create mode 100644 source4/rpc_server/dnsserver/dcerpc_dnsserver.c create mode 100644 source4/rpc_server/dnsserver/dnsdata.c create mode 100644 source4/rpc_server/dnsserver/dnsdb.c create mode 100644 source4/rpc_server/dnsserver/dnsserver.h create mode 100644 source4/rpc_server/dnsserver/dnsutils.c create mode 100644 source4/scripting/python/samba/netcmd/dns.py create mode 100644 source4/scripting/python/samba/tests/dcerpc/dnsserver.py Changeset truncated at 500 lines: diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py index 3adf533..5e16a5d 100644 --- a/buildtools/wafsamba/samba_utils.py +++ b/buildtools/wafsamba/samba_utils.py @@ -487,6 +487,13 @@ def CHECK_MAKEFLAGS(bld): if Logs.verbose > 2: Logs.zones = ['*'] elif opt[0].isupper() and opt.find('=') != -1: + # this allows us to set waf options on the make command line + # for example, if you do "make FOO=blah", then we set the + # option 'FOO' in Options.options, to blah. If you look in wafsamba/wscript + # you will see that the command line accessible options have their dest= + # set to uppercase, to allow for passing of options from make in this way + # this is also how "make test TESTS=testpattern" works, and + # "make VERBOSE=1" as well as things like "make SYMBOLCHECK=1" loc = opt.find('=') setattr(Options.options, opt[0:loc], opt[loc+1:]) elif opt[0] != '-': diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c index 52c77bd..9c49f75 100644 --- a/lib/ldb-samba/ldif_handlers.c +++ b/lib/ldb-samba/ldif_handlers.c @@ -915,6 +915,19 @@ static int ldif_write_dnsRecord(struct ldb_context *ldb, void *mem_ctx, } /* + convert a NDR formatted blob to a ldif formatted dnsProperty +*/ +static int ldif_write_dnsProperty(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_DnsProperty), + (ndr_pull_flags_fn_t)ndr_pull_dnsp_DnsProperty, + (ndr_print_fn_t)ndr_print_dnsp_DnsProperty, + true); +} + +/* convert a NDR formatted blob of a supplementalCredentials into text */ static int ldif_write_supplementalCredentialsBlob(struct ldb_context *ldb, void *mem_ctx, @@ -1348,6 +1361,13 @@ static const struct ldb_schema_syntax samba_syntaxes[] = { .comparison_fn = ldb_comparison_binary, .operator_fn = samba_syntax_operator_fn },{ + .name = LDB_SYNTAX_SAMBA_DNSPROPERTY, + .ldif_read_fn = ldb_handler_copy, + .ldif_write_fn = ldif_write_dnsProperty, + .canonicalise_fn = ldb_handler_copy, + .comparison_fn = ldb_comparison_binary, + .operator_fn = samba_syntax_operator_fn + },{ .name = LDB_SYNTAX_SAMBA_SUPPLEMENTALCREDENTIALS, .ldif_read_fn = ldb_handler_copy, .ldif_write_fn = ldif_write_supplementalCredentialsBlob, @@ -1480,6 +1500,7 @@ static const struct { /* These NDR encoded things we want to be able to read with --show-binary */ { "dnsRecord", LDB_SYNTAX_SAMBA_DNSRECORD }, + { "dnsProperty", LDB_SYNTAX_SAMBA_DNSPROPERTY }, { "supplementalCredentials", LDB_SYNTAX_SAMBA_SUPPLEMENTALCREDENTIALS}, { "partialAttributeSet", LDB_SYNTAX_SAMBA_PARTIALATTRIBUTESET} }; diff --git a/lib/ldb-samba/ldif_handlers.h b/lib/ldb-samba/ldif_handlers.h index eb6c656..41a2208 100644 --- a/lib/ldb-samba/ldif_handlers.h +++ b/lib/ldb-samba/ldif_handlers.h @@ -13,6 +13,7 @@ #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" +#define LDB_SYNTAX_SAMBA_DNSPROPERTY "LDB_SYNTAX_SAMBA_DNSPROPERTY" #define LDB_SYNTAX_SAMBA_SUPPLEMENTALCREDENTIALS "LDB_SYNTAX_SAMBA_SUPPLEMENTALCREDENTIALS" #define LDB_SYNTAX_SAMBA_SDDL_SECURITY_DESCRIPTOR "LDB_SYNTAX_SAMBA_SDDL" #define LDB_SYNTAX_SAMBA_TRUSTAUTHINOUTBLOB "LDB_SYNTAX_SAMBA_TRUSTAUTHINOUTBLOB" diff --git a/lib/ldb/common/ldb_modules.c b/lib/ldb/common/ldb_modules.c index c8a53e2..47ec434 100644 --- a/lib/ldb/common/ldb_modules.c +++ b/lib/ldb/common/ldb_modules.c @@ -218,7 +218,7 @@ int ldb_module_connect_backend(struct ldb_context *ldb, if (ret != LDB_SUCCESS) { ldb_debug(ldb, LDB_DEBUG_ERROR, - "Failed to connect to '%s' with backend '%s': %s", url, be->ops->name, ldb_errstring(ret)); + "Failed to connect to '%s' with backend '%s': %s", url, be->ops->name, ldb_errstring(ldb)); return ret; } return ret; diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c index 0918cce..4274e9b 100644 --- a/lib/param/loadparm.c +++ b/lib/param/loadparm.c @@ -3298,7 +3298,7 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx) lpcfg_do_global_parameter(lp_ctx, "ntvfs handler", "unixuid default"); lpcfg_do_global_parameter(lp_ctx, "max connections", "-1"); - lpcfg_do_global_parameter(lp_ctx, "dcerpc endpoint servers", "epmapper srvsvc wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi winreg dssetup unixinfo browser eventlog6 backupkey"); + lpcfg_do_global_parameter(lp_ctx, "dcerpc endpoint servers", "epmapper srvsvc wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi winreg dssetup unixinfo browser eventlog6 backupkey dnsserver"); lpcfg_do_global_parameter(lp_ctx, "server services", "smb rpc nbt wrepl ldap cldap kdc drepl winbind ntp_signd kcc dnsupdate"); lpcfg_do_global_parameter(lp_ctx, "ntptr providor", "simple_ldb"); /* the winbind method for domain controllers is for both RODC diff --git a/libcli/util/werror.h b/libcli/util/werror.h index d59f4d6..b490974 100644 --- a/libcli/util/werror.h +++ b/libcli/util/werror.h @@ -2400,11 +2400,41 @@ typedef uint32_t WERROR; #define WERR_DNS_ERROR_RCODE_BADSIG W_ERROR(0x00002338) #define WERR_DNS_ERROR_RCODE_BADKEY W_ERROR(0x00002339) #define WERR_DNS_ERROR_RCODE_BADTIME W_ERROR(0x0000233A) +#define WERR_DNS_ERROR_KEYMASTER_REQUIRED W_ERROR(0x0000238D) +#define WERR_DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE W_ERROR(0x0000238E) +#define WERR_DNS_ERROR_INVALID_NSEC3_PARAMETERS W_ERROR(0x0000238F) +#define WERR_DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS W_ERROR(0x00002390) +#define WERR_DNS_ERROR_UNSUPPORTED_ALGORITHM W_ERROR(0x00002391) +#define WERR_DNS_ERROR_INVALID_KEY_SIZE W_ERROR(0x00002392) +#define WERR_DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE W_ERROR(0x00002393) +#define WERR_DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION W_ERROR(0x00002394) +#define WERR_DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR W_ERROR(0x00002395) +#define WERR_DNS_ERROR_UNEXPECTED_CNG_ERROR W_ERROR(0x00002396) +#define WERR_DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION W_ERROR(0x00002397) +#define WERR_DNS_ERROR_KSP_NOT_ACCESSIBLE W_ERROR(0x00002398) +#define WERR_DNS_ERROR_TOO_MANY_SKDS W_ERROR(0x00002399) +#define WERR_DNS_ERROR_INVALID_ROLLOVER_PERIOD W_ERROR(0x0000239A) +#define WERR_DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET W_ERROR(0x0000239B) +#define WERR_DNS_ERROR_ROLLOVER_IN_PROGRESS W_ERROR(0x0000239C) +#define WERR_DNS_ERROR_STANDBY_KEY_NOT_PRESENT W_ERROR(0x0000239D) +#define WERR_DNS_ERROR_NOT_ALLOWED_ON_ZSK W_ERROR(0x0000239E) +#define WERR_DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD W_ERROR(0x0000239F) +#define WERR_DNS_ERROR_ROLLOVER_ALREADY_QUEUED W_ERROR(0x000023A0) +#define WERR_DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE W_ERROR(0x000023A1) +#define WERR_DNS_ERROR_BAD_KEYMASTER W_ERROR(0x000023A2) +#define WERR_DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD W_ERROR(0x000023A3) +#define WERR_DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT W_ERROR(0x000023A4) +#define WERR_DNS_ERROR_DNSSEC_IS_DISABLED W_ERROR(0x000023A5) +#define WERR_DNS_ERROR_INVALID_XML W_ERROR(0x000023A6) +#define WERR_DNS_ERROR_NO_VALID_TRUST_ANCHORS W_ERROR(0x000023A7) +#define WERR_DNS_ERROR_ROLLOVER_NOT_POKEABLE W_ERROR(0x000023A8) +#define WERR_DNS_ERROR_NSEC3_NAME_COLLISION W_ERROR(0x000023A9) #define WERR_DNS_INFO_NO_RECORDS W_ERROR(0x0000251D) #define WERR_DNS_ERROR_BAD_PACKET W_ERROR(0x0000251E) #define WERR_DNS_ERROR_NO_PACKET W_ERROR(0x0000251F) #define WERR_DNS_ERROR_RCODE W_ERROR(0x00002520) #define WERR_DNS_ERROR_UNSECURE_PACKET W_ERROR(0x00002521) +#define WERR_DNS_REQUEST_PENDING W_ERROR(0x00002522) #define WERR_DNS_ERROR_INVALID_TYPE W_ERROR(0x0000254F) #define WERR_DNS_ERROR_INVALID_IP_ADDRESS W_ERROR(0x00002550) #define WERR_DNS_ERROR_INVALID_PROPERTY W_ERROR(0x00002551) @@ -2424,6 +2454,9 @@ typedef uint32_t WERROR; #define WERR_DNS_ERROR_DWORD_VALUE_TOO_LARGE W_ERROR(0x0000255F) #define WERR_DNS_ERROR_BACKGROUND_LOADING W_ERROR(0x00002560) #define WERR_DNS_ERROR_NOT_ALLOWED_ON_RODC W_ERROR(0x00002561) +#define WERR_DNS_ERROR_NOT_ALLOWED_UNDER_DNAME W_ERROR(0x00002562) +#define WERR_DNS_ERROR_DELEGATION_REQUIRED W_ERROR(0x00002563) +#define WERR_DNS_ERROR_INVALID_POLICY_TABLE W_ERROR(0x00002564) #define WERR_DNS_ERROR_ZONE_DOES_NOT_EXIST W_ERROR(0x00002581) #define WERR_DNS_ERROR_NO_ZONE_INFO W_ERROR(0x00002582) #define WERR_DNS_ERROR_INVALID_ZONE_OPERATION W_ERROR(0x00002583) @@ -2469,6 +2502,9 @@ typedef uint32_t WERROR; #define WERR_DNS_ERROR_DS_UNAVAILABLE W_ERROR(0x000025F5) #define WERR_DNS_ERROR_DS_ZONE_ALREADY_EXISTS W_ERROR(0x000025F6) #define WERR_DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE W_ERROR(0x000025F7) +#define WERR_DNS_ERROR_NODE_IS_DNMAE W_ERROR(0x000025F8) +#define WERR_DNS_ERROR_DNAME_COLLISION W_ERROR(0x000025F9) +#define WERR_DNS_ERROR_ALIAS_LOOP W_ERROR(0x000025FA) #define WERR_DNS_INFO_AXFR_COMPLETE W_ERROR(0x00002617) #define WERR_DNS_ERROR_AXFR W_ERROR(0x00002618) #define WERR_DNS_INFO_ADDED_LOCAL_WINS W_ERROR(0x00002619) diff --git a/librpc/idl/dnsp.idl b/librpc/idl/dnsp.idl index 12af30a..258b3a2 100644 --- a/librpc/idl/dnsp.idl +++ b/librpc/idl/dnsp.idl @@ -65,6 +65,23 @@ interface dnsp DNS_TYPE_WINSR = 0xFF02 } dns_record_type; + typedef [bitmap32bit] bitmap { + DNS_RPC_FLAG_SUPPRESS_NOTIFY = 0x00010000, + DNS_RPC_FLAG_AGING_ON = 0x00020000, + DNS_RPC_FLAG_OPEN_ACL = 0x00040000, + DNS_RPC_FLAG_NODE_COMPLETE = 0x00800000, + DNS_RPC_FLAG_NODE_STICKY = 0x01000000, + DNS_RPC_FLAG_RECORD_CREATE_PTR = 0x02000000, + DNS_RPC_FLAG_RECORD_TTL_CHANGE = 0x04000000, + DNS_RPC_FLAG_RECORD_DEFAULT_TTL = 0x08000000, + DNS_RPC_FLAG_ZONE_DELEGATION = 0x10000000, + DNS_RPC_FLAG_AUTH_ZONE_ROOT = 0x20000000, + DNS_RPC_FLAG_ZONE_ROOT = 0x40000000, + DNS_RPC_FLAG_CACHE_DATA = 0x80000000 + } + dns_rpc_node_flags; + + typedef [enum8bit] enum { DNS_RANK_NONE = 0x00, DNS_RANK_CACHE_BIT = 0x01, @@ -81,6 +98,48 @@ interface dnsp DNS_RANK_ZONE = 0xf0 } dns_record_rank; + typedef [v1_enum] enum { + DNS_ZONE_TYPE_CACHE = 0x00, + DNS_ZONE_TYPE_PRIMARY = 0x01, + DNS_ZONE_TYPE_SECONDARY = 0x02, + DNS_ZONE_TYPE_STUB = 0x03, + DNS_ZONE_TYPE_FORWARDER = 0x04, + DNS_ZONE_TYPE_SECONDARY_CACHE = 0x05 + } dns_zone_type; + + typedef [public,enum8bit] enum { + DNS_ZONE_UPDATE_OFF = 0x00, + DNS_ZONE_UPDATE_UNSECURE = 0x01, + DNS_ZONE_UPDATE_SECURE = 0x02 + } dns_zone_update; + + typedef [v1_enum] enum { + DSPROPERTY_ZONE_EMPTY = 0x00, + DSPROPERTY_ZONE_TYPE = 0x01, + DSPROPERTY_ZONE_ALLOW_UPDATE = 0x02, + DSPROPERTY_ZONE_SECURE_TIME = 0x08, + DSPROPERTY_ZONE_NOREFRESH_INTERVAL = 0x10, + DSPROPERTY_ZONE_SCAVENGING_SERVERS = 0x11, + DSPROPERTY_ZONE_AGING_ENABLED_TIME = 0x12, + DSPROPERTY_ZONE_REFRESH_INTERVAL = 0x20, + DSPROPERTY_ZONE_AGING_STATE = 0x40, + DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME = 0x80, + DSPROPERTY_ZONE_MASTER_SERVERS = 0x81, + DSPROPERTY_ZONE_AUTO_NS_SERVERS = 0x82, + DSPROPERTY_ZONE_DCPROMO_CONVERT = 0x83, + DSPROPERTY_ZONE_SCAVENGING_SERVERS_DA = 0x90, + DSPROPERTY_ZONE_MASTER_SERVERS_DA = 0x91, + DSPROPERTY_ZONE_NS_SERVERS_DA = 0x92, + DSPROPERTY_ZONE_NODE_DBFLAGS = 0x100 + + } dns_property_id; + + typedef [enum8bit] enum { + DCPROMO_CONVERT_NONE = 0x00, + DCPROMO_CONVERT_DOMAIN = 0x01, + DCPROMO_CONVERT_FOREST = 0x02 + } dns_dcpromo_flag; + typedef [public] struct { uint32 serial; uint32 refresh; @@ -108,7 +167,33 @@ interface dnsp dnsp_name nameTarget; } dnsp_srv; - typedef [nodiscriminant,gensize,public] union { + typedef struct { + uint32 addrCount; + [size_is(addrCount)] uint32 *addr; + } dnsp_ip4_array; + + typedef struct { + uint16 family; + uint16 port; + ipv4address ipv4; + ipv6address ipv6; + uint8 pad[8]; + uint32 unused[8]; + } dnsp_dns_addr; + + typedef [public] struct { + uint32 MaxCount; + uint32 AddrCount; + uint32 Tag; + uint16 Family; + uint16 Reserved0; + uint32 MatchFlag; + uint32 Reserved1; + uint32 Reserved2; + dnsp_dns_addr AddrArray[AddrCount]; + } dnsp_dns_addr_array; + + typedef [nodiscriminant,gensize] union { [case(DNS_TYPE_TOMBSTONE)] NTTIME timestamp; [case(DNS_TYPE_A)] [flag(NDR_BIG_ENDIAN)] ipv4address ipv4; [case(DNS_TYPE_NS)] dnsp_name ns; @@ -132,17 +217,52 @@ interface dnsp dns_record_rank rank; uint16 flags; uint32 dwSerial; - [flag(NDR_BIG_ENDIAN)] uint32 dwTtlSeconds; + [flag(NDR_BIG_ENDIAN)] uint32 dwTtlSeconds; uint32 dwReserved; uint32 dwTimeStamp; [switch_is(wType)] dnsRecordData data; } dnsp_DnssrvRpcRecord; + typedef [nodiscriminant,gensize] union { + [case(DSPROPERTY_ZONE_EMPTY)] ; + [case(DSPROPERTY_ZONE_TYPE)] dns_zone_type zone_type; + [case(DSPROPERTY_ZONE_ALLOW_UPDATE)] dns_zone_update allow_update_flag; + [case(DSPROPERTY_ZONE_SECURE_TIME)] NTTIME zone_secure_time; + [case(DSPROPERTY_ZONE_NOREFRESH_INTERVAL)] uint32 norefresh_hours; + [case(DSPROPERTY_ZONE_REFRESH_INTERVAL)] uint32 refresh_hours; + [case(DSPROPERTY_ZONE_AGING_STATE)] uint32 aging_enabled; + [case(DSPROPERTY_ZONE_SCAVENGING_SERVERS)] dnsp_ip4_array servers; + [case(DSPROPERTY_ZONE_AGING_ENABLED_TIME)] uint32 next_scavenging_cycle_hours; + [case(DSPROPERTY_ZONE_DELETED_FROM_HOSTNAME)] utf8string deleted_by_hostname; + [case(DSPROPERTY_ZONE_MASTER_SERVERS)] dnsp_ip4_array master_servers; + [case(DSPROPERTY_ZONE_AUTO_NS_SERVERS)] dnsp_ip4_array ns_servers; + [case(DSPROPERTY_ZONE_DCPROMO_CONVERT)] dns_dcpromo_flag dcpromo_flag; + [case(DSPROPERTY_ZONE_SCAVENGING_SERVERS_DA)] dnsp_dns_addr_array s_ns_servers; + [case(DSPROPERTY_ZONE_MASTER_SERVERS_DA)] dnsp_dns_addr_array z_master_servers; + [case(DSPROPERTY_ZONE_NS_SERVERS_DA)] dnsp_dns_addr_array d_ns_servers; + [case(DSPROPERTY_ZONE_NODE_DBFLAGS)] dns_rpc_node_flags flags; + } dnsPropertyData; + + /* this is the format for the dnsProperty attribute in the DNS + partitions in AD */ + typedef [flag(NDR_NOALIGN),public] struct { + [value(ndr_size_dnsPropertyData(&data,id,ndr->flags))] uint32 wDataLength; + uint32 namelength; + [value(0)] uint32 flag; + [value(1)] uint32 version; + dns_property_id id; + [switch_is(wDataLength?id:DSPROPERTY_ZONE_EMPTY)] dnsPropertyData data; + uint32 name; + } dnsp_DnsProperty; /* - this is a convenience hook for ndrdump + these are convenience hooks for ndrdump */ void decode_DnssrvRpcRecord( [in] dnsp_DnssrvRpcRecord blob ); + + void decode_DnsProperty( + [in] dnsp_DnsProperty blob + ); } diff --git a/librpc/idl/dnsserver.idl b/librpc/idl/dnsserver.idl index 33fadc6..306414e 100644 --- a/librpc/idl/dnsserver.idl +++ b/librpc/idl/dnsserver.idl @@ -9,7 +9,9 @@ import "misc.idl", "dnsp.idl"; [ uuid("50abc2a4-574d-40b3-9d66-ee4fd5fba076"), version(5.0), pointer_default(unique), - helpstring("DNS Server") + endpoint("ncacn_ip_tcp:", "ncacn_np:[\\pipe\\dnsserver]"), + helper("../librpc/ndr/ndr_dnsserver.h"), + helpstring("DNS Management Server") ] interface dnsserver { @@ -23,18 +25,155 @@ import "misc.idl", "dnsp.idl"; #define DWORD uint32 #define PDWORD uint32 * + /* */ + /* DNS RPC data types */ + /* */ + + typedef [v1_enum] enum { + DNS_RPC_USE_TCPIP = 0x00000001, + DNS_RPC_USE_NAMED_PIPE = 0x00000002, + DNS_RPC_USE_LPC = 0x00000004, + DNS_RPC_USE_ALL_PROTOCOLS = 0xFFFFFFFF + } + DNS_RPC_PROTOCOLS; + + typedef [v1_enum] enum { + DNS_CLIENT_VERSION_W2K = 0x00000000, + DNS_CLIENT_VERSION_DOTNET = 0x00060000, + DNS_CLIENT_VERSION_LONGHORN = 0x00070000 + } + DNS_RPC_CLIENT_VERSION; + + /* Return buffer */ typedef struct { - DWORD StatId; - WORD wLength; - BOOLEAN fClear; - UCHAR fReserved; - } DNSSRV_STAT_HEADER; + DWORD dwLength; + [size_is(dwLength)] BYTE Buffer[]; + } DNS_RPC_BUFFER; + /* String Array */ + typedef struct { + [range(0,10000)] DWORD dwCount; + [size_is(dwCount),string,charset(UTF8)] char * pszStrings[]; + } DNS_RPC_UTF8_STRING_LIST; + /* Name and parameter value */ typedef struct { - DNSSRV_STAT_HEADER Header; - BYTE Buffer[1]; - } DNSSRV_STAT; + DWORD dwParam; + [string, charset(UTF8)] char * pszNodeName; + } + DNS_RPC_NAME_AND_PARAM; + + + /* */ + /* DNS Resource Record data types */ + /* */ + + /* DNS_RECORD_TYPE is defined in dnsp.idl as dns_record_type */ + /* DNS_RPC_NODE_FLAGS is defined in dnsp.idl as dns_rpc_node_flags */ + + typedef [gensize] struct { + [value(strlen(str))] uint8 len; + [charset(UTF8)] uint8 str[len]; + } + DNS_RPC_NAME; + + typedef struct { + uint16 wLength; + uint16 wRecordCount; + uint32 dwFlags; + uint32 dwChildCount; + DNS_RPC_NAME dnsNodeName; + } + DNS_RPC_NODE; + + typedef struct { + uint32 dwSerialNo; + uint32 dwRefresh; + uint32 dwRetry; + uint32 dwExpire; + uint32 dwMinimumTtl; + DNS_RPC_NAME NamePrimaryServer; + DNS_RPC_NAME ZoneAdministratorEmail; + } + DNS_RPC_RECORD_SOA; + + typedef struct { + uint16 wPreference; + DNS_RPC_NAME nameExchange; + } + DNS_RPC_RECORD_NAME_PREFERENCE; + + typedef struct { + uint16 wPriority; + uint16 wWeight; + uint16 wPort; + DNS_RPC_NAME nameTarget; + } + DNS_RPC_RECORD_SRV; + + typedef [nodiscriminant,gensize,flag(NDR_NOALIGN)] union { + [case(DNS_TYPE_TOMBSTONE)] NTTIME timestamp; + [case(DNS_TYPE_A)] [flag(NDR_BIG_ENDIAN)] ipv4address ipv4; + [case(DNS_TYPE_NS)] DNS_RPC_NAME name; + [case(DNS_TYPE_MD)] DNS_RPC_NAME name; + [case(DNS_TYPE_MF)] DNS_RPC_NAME name; + [case(DNS_TYPE_CNAME)] DNS_RPC_NAME name; + [case(DNS_TYPE_SOA)] DNS_RPC_RECORD_SOA soa; + [case(DNS_TYPE_MB)] DNS_RPC_NAME name; + [case(DNS_TYPE_MG)] DNS_RPC_NAME name; + [case(DNS_TYPE_MR)] DNS_RPC_NAME name; + [case(DNS_TYPE_PTR)] DNS_RPC_NAME ptr; + [case(DNS_TYPE_HINFO)] DNS_RPC_NAME hinfo; + [case(DNS_TYPE_MX)] DNS_RPC_RECORD_NAME_PREFERENCE mx; + [case(DNS_TYPE_TXT)] DNS_RPC_NAME name; + [case(DNS_TYPE_AAAA)] ipv6address ipv6; + [case(DNS_TYPE_SRV)] DNS_RPC_RECORD_SRV srv; + [case(DNS_TYPE_DNAME)] DNS_RPC_NAME name; + } + DNS_RPC_DATA; + + typedef [public] struct { + [value(ndr_size_DNS_RPC_DATA(&data,wType,0))] uint16 wDataLength; + dns_record_type wType; + DWORD dwFlags; + DWORD dwSerial; + DWORD dwTtlSeconds; + DWORD dwTimeStamp; + DWORD dwReserved; + [subcontext(0),subcontext_size(wDataLength),switch_is(wType)] DNS_RPC_DATA data; + } + DNS_RPC_RECORD; + + typedef struct { + [value(ndr_size_DNS_RPC_DATA(&rec.data,rec.wType,0))] uint3264 wContextLength; + DNS_RPC_RECORD rec; + } + DNS_RPC_RECORD_BUF; + + + /* */ + /* DNS Address Information data types */ + /* */ + + typedef [v1_enum] enum { + DNS_IPVAL_DNS_SERVERS = 0x00, + DNS_IPVAL_DNS_ROOTHINTS = 0x01, + DNS_IPVAL_DNS_FORWARDERS = 0x02, + DNS_IPVAL_DNS_ZONE_MASTERS = 0x03, + DNS_IPVAL_DNS_DELEGATIONS = 0x04 + } + DNS_IPVAL_CONTEXT; -- Samba Shared Repository