diff options
-rw-r--r-- | librpc/idl/dns.idl | 155 | ||||
-rw-r--r-- | librpc/idl/wscript_build | 2 | ||||
-rw-r--r-- | librpc/wscript_build | 5 | ||||
-rwxr-xr-x | source4/librpc/wscript_build | 29 |
4 files changed, 188 insertions, 3 deletions
diff --git a/librpc/idl/dns.idl b/librpc/idl/dns.idl new file mode 100644 index 0000000000..faa623be5d --- /dev/null +++ b/librpc/idl/dns.idl @@ -0,0 +1,155 @@ +#include "idl_types.h" + +/* + IDL structures for DNS operations + + DNS is not traditionally encoded using IDL/NDR. This is a bit of an + experiment, and I may well switch us back to a more traditional + encoding if it doesn't work out +*/ + +import "misc.idl"; +[ + helper("librpc/ndr/ndr_dnsp.h"), + helpstring("DNS records"), + version(0.0), + uuid("a047c001-5f22-40b0-9d52-7042c43f711a") +] +interface dns +{ + const int DNS_SERVICE_PORT = 53; + + typedef [public,bitmap16bit] bitmap { + DNS_RCODE = 0x000F, + DNS_FLAG_BROADCAST = 0x0010, + DNS_FLAG_RECURSION_AVAIL = 0x0080, + DNS_FLAG_RECURSION_DESIRED = 0x0100, + DNS_FLAG_TRUNCATION = 0x0200, + DNS_FLAG_AUTHORITIVE = 0x0400, + DNS_OPCODE = 0x7800, + DNS_FLAG_REPLY = 0x8000 + } dns_operation; + + /* the opcodes are in the operation field, masked with + DNS_OPCODE */ + typedef [public] enum { + DNS_OPCODE_QUERY = (0x0<<11), + DNS_OPCODE_IQUERY = (0x1<<11), + DNS_OPCODE_STATUS = (0x2<<11), + DNS_OPCODE_REGISTER = (0x5<<11), + DNS_OPCODE_RELEASE = (0x6<<11), + DNS_OPCODE_WACK = (0x7<<11), + DNS_OPCODE_REFRESH = (0x8<<11), + DNS_OPCODE_REFRESH2 = (0x9<<11), + DNS_OPCODE_MULTI_HOME_REG = (0xf<<11) + } dns_opcode; + + /* rcode values */ + typedef [public] enum { + DNS_RCODE_OK = 0x0, + DNS_RCODE_FORMERR = 0x1, + DNS_RCODE_SERVFAIL = 0x2, + DNS_RCODE_NXDOMAIN = 0x3, + DNS_RCODE_NOTIMP = 0x4, + DNS_RCODE_REFUSED = 0x5, + DNS_RCODE_YXDOMAIN = 0x6, + DNS_RCODE_YXRRSET = 0x7, + DNS_RCODE_NXRRSET = 0x8, + DNS_RCODE_NOTAUTH = 0x9, + DNS_RCODE_NOTZONE = 0xA + } dns_rcode; + + typedef [public,enum16bit] enum { + DNS_QCLASS_IP = 0x01 + } dns_qclass; + + /* These vese values could have been merged with NBT_QTYPE values, but + DNS_QTYPE_SRV and NBT_QTYPE_STATUS have the same numeric value. */ + typedef [public,enum16bit] enum { + DNS_QTYPE_ZERO = 0x0000, + DNS_QTYPE_A = 0x0001, + DNS_QTYPE_NS = 0x0002, + DNS_QTYPE_MD = 0x0003, + DNS_QTYPE_MF = 0x0004, + DNS_QTYPE_CNAME = 0x0005, + DNS_QTYPE_SOA = 0x0006, + DNS_QTYPE_MB = 0x0007, + DNS_QTYPE_MG = 0x0008, + DNS_QTYPE_MR = 0x0009, + DNS_QTYPE_NULL = 0x000A, + DNS_QTYPE_WKS = 0x000B, + DNS_QTYPE_PTR = 0x000C, + DNS_QTYPE_HINFO = 0x000D, + DNS_QTYPE_MINFO = 0x000E, + DNS_QTYPE_MX = 0x000F, + DNS_QTYPE_TXT = 0x0010, + DNS_QTYPE_RP = 0x0011, + DNS_QTYPE_AFSDB = 0x0012, + DNS_QTYPE_X25 = 0x0013, + DNS_QTYPE_ISDN = 0x0014, + DNS_QTYPE_RT = 0x0015, + DNS_QTYPE_SIG = 0x0018, + DNS_QTYPE_KEY = 0x0019, + DNS_QTYPE_AAAA = 0x001C, + DNS_QTYPE_LOC = 0x001D, + DNS_QTYPE_NXT = 0x001E, + DNS_QTYPE_NETBIOS= 0x0020, + DNS_QTYPE_SRV = 0x0021, + DNS_QTYPE_ATMA = 0x0022, + DNS_QTYPE_NAPTR = 0x0023, + DNS_QTYPE_DNAME = 0x0027, + DNS_QTYPE_DS = 0x002B, + DNS_QTYPE_RRSIG = 0x002E, + DNS_QTYPE_NSEC = 0x002F, + DNS_QTYPE_DNSKEY = 0x0030, + DNS_QTYPE_DHCID = 0x0031, + DNS_QTYPE_ALL = 0x00FF, + DNS_QTYPE_WINS = 0xFF01, + DNS_QTYPE_WINSR = 0xFF02 + } dns_qtype; + + typedef [public] struct { + dnsp_name name; + dns_qtype question_type; + dns_qclass question_class; + } dns_name_question; + + typedef [public] struct { + uint16 length; + uint8 data[length]; + } dns_rdata_data; + + typedef [nodiscriminant,public] union { + [case(DNS_QTYPE_A)] ipv4address ipv4_address; + [default] dns_rdata_data data; + } dns_rdata; + + typedef [flag(LIBNDR_PRINT_ARRAY_HEX),public] struct { + dnsp_name name; + dns_qtype rr_type; + dns_qclass rr_class; + uint32 ttl; + [switch_is(rr_type)] dns_rdata rdata; + } dns_res_rec; + + typedef [flag(NDR_NOALIGN|NDR_BIG_ENDIAN|NDR_PAHEX),public] struct { + uint16 id; + dns_operation operation; + uint16 qdcount; + uint16 ancount; + uint16 nscount; + uint16 arcount; + dns_name_question questions[qdcount]; + dns_res_rec answers[ancount]; + dns_res_rec nsrecs[nscount]; + dns_res_rec additional[arcount]; + [flag(NDR_REMAINING)] DATA_BLOB padding; + } dns_name_packet; + + /* + this is a convenience hook for ndrdump + */ + void decode_dns_name_packet( + [in] dns_name_packet packet + ); +} diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build index 4dc1199092..eed608075e 100644 --- a/librpc/idl/wscript_build +++ b/librpc/idl/wscript_build @@ -7,7 +7,7 @@ bld.SAMBA_PIDL_LIST('PIDL', msgsvc.idl ntsvcs.idl remact.idl security.idl unixinfo.idl wzcsvc.idl browser.idl dfs.idl dssetup.idl frsapi.idl krb5pac.idl named_pipe_auth.idl orpc.idl rot.idl spoolss.idl w32time.idl xattr.idl - dbgidl.idl dnsserver.idl echo.idl frsrpc.idl lsa.idl nbt.idl + dbgidl.idl dnsserver.idl echo.idl frsrpc.idl lsa.idl nbt.idl dns.idl oxidresolver.idl samr.idl srvsvc.idl winreg.idl dcerpc.idl drsblobs.idl efs.idl frstrans.idl mgmt.idl netlogon.idl policyagent.idl scerpc.idl svcctl.idl wkssvc.idl eventlog6.idl''', diff --git a/librpc/wscript_build b/librpc/wscript_build index 4a45095eec..2d053e49a5 100644 --- a/librpc/wscript_build +++ b/librpc/wscript_build @@ -17,6 +17,11 @@ bld.SAMBA_SUBSYSTEM('NDR_DNSSERVER', public_deps='LIBNDR' ) +bld.SAMBA_SUBSYSTEM('NDR_DNS', + source='../librpc/gen_ndr/ndr_dns.c', + public_deps='LIBNDR NDR_DNSP' + ) + bld.SAMBA_SUBSYSTEM('NDR_DSBACKUP', source='../librpc/gen_ndr/ndr_dsbackup.c', public_deps='LIBNDR' diff --git a/source4/librpc/wscript_build b/source4/librpc/wscript_build index 920d6a2c31..734274379a 100755 --- a/source4/librpc/wscript_build +++ b/source4/librpc/wscript_build @@ -123,10 +123,20 @@ bld.SAMBA_PIDL_TABLES('GEN_NDR_TABLES', 'gen_ndr/tables.c') bld.SAMBA_LIBRARY('NDR_TABLE', source='../../librpc/ndr/ndr_table.c gen_ndr/tables.c', - public_deps='NDR_STANDARD NDR_AUDIOSRV NDR_DSBACKUP NDR_EFS NDR_DRSUAPI NDR_POLICYAGENT NDR_UNIXINFO NDR_SPOOLSS NDR_EPMAPPER NDR_DBGIDL NDR_DSSETUP NDR_MSGSVC NDR_WINSIF NDR_MGMT NDR_PROTECTED_STORAGE NDR_OXIDRESOLVER NDR_REMACT NDR_WZCSVC NDR_BROWSER NDR_W32TIME NDR_SCERPC NDR_TRKWKS NDR_KEYSVC NDR_KRB5PAC NDR_XATTR NDR_SCHANNEL NDR_ROT NDR_DRSBLOBS NDR_NBT NDR_WINSREPL NDR_SECURITY NDR_DNSSERVER NDR_WINSTATION NDR_IRPC NDR_OPENDB NDR_SASL_HELPERS NDR_NOTIFY NDR_WINBIND NDR_FRSRPC NDR_FRSAPI NDR_FRSTRANS NDR_NFS4ACL NDR_NTP_SIGND NDR_DCOM NDR_WMI NDR_NAMED_PIPE_AUTH NDR_NTLMSSP NDR_DFSBLOBS NDR_DNSP NDR_NTPRINTING', + public_deps='''NDR_STANDARD NDR_AUDIOSRV NDR_DSBACKUP NDR_EFS + NDR_DRSUAPI NDR_POLICYAGENT NDR_UNIXINFO NDR_SPOOLSS NDR_EPMAPPER + NDR_DBGIDL NDR_DSSETUP NDR_MSGSVC NDR_WINSIF NDR_MGMT + NDR_PROTECTED_STORAGE NDR_OXIDRESOLVER NDR_REMACT NDR_WZCSVC + NDR_BROWSER NDR_W32TIME NDR_SCERPC NDR_TRKWKS NDR_KEYSVC NDR_KRB5PAC + NDR_XATTR NDR_SCHANNEL NDR_ROT NDR_DRSBLOBS NDR_NBT NDR_WINSREPL + NDR_SECURITY NDR_DNSSERVER NDR_WINSTATION NDR_IRPC NDR_OPENDB + NDR_SASL_HELPERS NDR_NOTIFY NDR_WINBIND NDR_FRSRPC NDR_FRSAPI + NDR_FRSTRANS NDR_NFS4ACL NDR_NTP_SIGND NDR_DCOM NDR_WMI + NDR_NAMED_PIPE_AUTH NDR_NTLMSSP NDR_DFSBLOBS NDR_DNSP + NDR_NTPRINTING NDR_DNS''', private_library=True, depends_on='GEN_NDR_TABLES' - ) + ) bld.SAMBA_SUBSYSTEM('RPC_NDR_IRPC', @@ -150,6 +160,15 @@ bld.SAMBA_LIBRARY('dcerpc_samr', ) +bld.SAMBA_LIBRARY('dcerpc_dns', + source='../../librpc/gen_ndr/ndr_dns_c.c', + vnum='0.0.1', + public_deps='dcerpc NDR_STANDARD', + public_headers='../../librpc/gen_ndr/ndr_dns_c.h', + header_path='gen_ndr' + ) + + bld.SAMBA_LIBRARY('dcerpc_atsvc', source='../../librpc/gen_ndr/ndr_atsvc_c.c', pc_files='dcerpc_atsvc.pc', @@ -344,6 +363,12 @@ bld.SAMBA_PYTHON('python_dcerpc_xattr', realname='samba/dcerpc/xattr.so' ) +bld.SAMBA_PYTHON('python_dns', + source='../../librpc/gen_ndr/py_dns.c', + deps='PYTALLOC NDR_DNS pyrpc_util dcerpc_dns', + realname='samba/dcerpc/dns.so' + ) + bld.SAMBA_PYTHON('python_netlogon', source='../../librpc/gen_ndr/py_netlogon.c', deps='RPC_NDR_NETLOGON PYTALLOC pyrpc_util', |