From d9538e7412c593a9dc10a600676939d2cf0205ea Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 28 May 2004 13:23:30 +0000 Subject: r937: - added a simple QuerySecurity implementation in samr server - moved some sec desc defines into misc.idl - fixed pw_len field in UserInfo26 - made some pipes available on TCP - added netr_DsrEnumerateDomainTrusts() to netlogon - added templates for remaining netlogon IDL calls (from ethereal) - added a unistr_noterm vs unistr error detector in ndr basic decoder - added torture test for netr_DsrEnumerateDomainTrusts() (This used to be commit ae5a5113fb83640dcb9ae4642c1b9eaf28487956) --- source4/librpc/idl/lsa.idl | 2 +- source4/librpc/idl/misc.idl | 20 ++++++ source4/librpc/idl/netlogon.idl | 138 ++++++++++++++++++++++++++++++++++++++++ source4/librpc/idl/samr.idl | 3 +- source4/librpc/idl/winreg.idl | 1 + source4/librpc/ndr/ndr_basic.c | 12 ++++ 6 files changed, 174 insertions(+), 2 deletions(-) (limited to 'source4/librpc') diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl index b9acbfcf10..5683a0d08e 100644 --- a/source4/librpc/idl/lsa.idl +++ b/source4/librpc/idl/lsa.idl @@ -6,7 +6,7 @@ [ uuid(12345778-1234-abcd-ef00-0123456789ab), version(0.0), - endpoints(lsarpc,lsass), + endpoints(lsarpc,lsass,TCP-0), pointer_default(unique) ] interface lsarpc { diff --git a/source4/librpc/idl/misc.idl b/source4/librpc/idl/misc.idl index c5e0b06a23..240c0026e3 100644 --- a/source4/librpc/idl/misc.idl +++ b/source4/librpc/idl/misc.idl @@ -80,6 +80,26 @@ interface misc security_ace aces[num_aces]; } security_acl; + /* default revision for new ACLs */ + const int SD_REVISION = 1; + + /* security_descriptor->type bits */ + const int SEC_DESC_OWNER_DEFAULTED = 0x0001; + const int SEC_DESC_GROUP_DEFAULTED = 0x0002; + const int SEC_DESC_DACL_PRESENT = 0x0004; + const int SEC_DESC_DACL_DEFAULTED = 0x0008; + const int SEC_DESC_SACL_PRESENT = 0x0010; + const int SEC_DESC_SACL_DEFAULTED = 0x0020; + const int SEC_DESC_DACL_TRUSTED = 0x0040; + const int SEC_DESC_SERVER_SECURITY = 0x0080; + const int SEC_DESC_DACL_AUTO_INHERIT_REQ = 0x0100; + const int SEC_DESC_SACL_AUTO_INHERIT_REQ = 0x0200; + const int SEC_DESC_DACL_AUTO_INHERITED = 0x0400; + const int SEC_DESC_SACL_AUTO_INHERITED = 0x0800; + const int SEC_DESC_DACL_PROTECTED = 0x1000; + const int SEC_DESC_SACL_PROTECTED = 0x2000; + const int SEC_DESC_RM_CONTROL_VALID = 0x4000; + const int SEC_DESC_SELF_RELATIVE = 0x8000; typedef [public] struct { uint8 revision; diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl index f3c2b1ff26..6888c63ab9 100644 --- a/source4/librpc/idl/netlogon.idl +++ b/source4/librpc/idl/netlogon.idl @@ -9,6 +9,7 @@ [ uuid(12345678-1234-abcd-ef00-01234567cffb), version(1.0), + endpoints(netlogon,TCP-0), pointer_default(unique) ] @@ -854,4 +855,141 @@ interface netlogon [in][switch_is(function_code)] netr_CONTROL_DATA_INFORMATION data, [out][switch_is(level)] netr_CONTROL_QUERY_INFORMATION query ); + + /*****************/ + /* Function 0x13 */ + WERROR netr_NETRENUMERATETRUSTEDDOMAINS() ; + + /*****************/ + /* Function 0x14 */ + WERROR netr_DSRGETDCNAME() ; + + /*****************/ + /* Function 0x15 */ + WERROR netr_NETRLOGONDUMMYROUTINE1(); + + /****************/ + /* Function 0x16 */ + WERROR netr_NETRLOGONSETSERVICEBITS(); + + /****************/ + /* Function 0x17 */ + WERROR netr_NETRLOGONGETTRUSTRID(); + + /****************/ + /* Function 0x18 */ + WERROR netr_NETRLOGONCOMPUTESERVERDIGEST(); + + /****************/ + /* Function 0x19 */ + WERROR netr_NETRLOGONCOMPUTECLIENTDIGEST(); + + /****************/ + /* Function 0x1a */ + WERROR netr_NETRSERVERAUTHENTICATE3(); + + /****************/ + /* Function 0x1b */ + WERROR netr_DSRGETDCNAMEX(); + + /****************/ + /* Function 0x1c */ + WERROR netr_DSRGETSITENAME(); + + /****************/ + /* Function 0x1d */ + WERROR netr_NETRLOGONGETDOMAININFO(); + + /****************/ + /* Function 0x1e */ + WERROR netr_NETRSERVERPASSWORDSET2(); + + /****************/ + /* Function 0x1f */ + WERROR netr_NETRSERVERPASSWORDGET(); + + /****************/ + /* Function 0x20 */ + WERROR netr_NETRLOGONSENDTOSAM(); + + /****************/ + /* Function 0x21 */ + WERROR netr_DSRADDRESSTOSITENAMESW(); + + /****************/ + /* Function 0x22 */ + WERROR netr_DSRGETDCNAMEEX2(); + + /****************/ + /* Function 0x23 */ + WERROR netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN(); + + /****************/ + /* Function 0x24 */ + WERROR netr_NETRENUMERATETRUSTEDDOMAINSEX(); + + /****************/ + /* Function 0x25 */ + WERROR netr_DSRADDRESSTOSITENAMESEXW(); + + /****************/ + /* Function 0x26 */ + WERROR netr_DSRGETDCSITECOVERAGEW(); + + /****************/ + /* Function 0x27 */ + WERROR netr_NETRLOGONSAMLOGONEX(); + + /****************/ + /* Function 0x28 */ + + const int NETR_TRUST_FLAG_IN_FOREST = 0x01; + const int NETR_TRUST_FLAG_OUTBOUND = 0x02; + const int NETR_TRUST_FLAG_TREEROOT = 0x04; + const int NETR_TRUST_FLAG_PRIMARY = 0x08; + const int NETR_TRUST_FLAG_NATIVE = 0x10; + const int NETR_TRUST_FLAG_INBOUND = 0x20; + + typedef struct { + unistr *netbios_name; + unistr *dns_name; + uint32 trust_flags; + uint32 parent_index; + uint32 trust_type; + uint32 trust_attributes; + dom_sid2 *sid; + GUID guid; + } netr_DomainTrust; + + WERROR netr_DsrEnumerateDomainTrusts( + [in] unistr *server_name, + [in] uint32 trust_flags, + [out] uint32 count, + [out,size_is(count)] netr_DomainTrust *trusts + ); + + + /****************/ + /* Function 0x29 */ + WERROR netr_DSRDEREGISTERDNSHOSTRECORDS(); + + /****************/ + /* Function 0x2a */ + WERROR netr_NETRSERVERTRUSTPASSWORDSGET(); + + /****************/ + /* Function 0x2b */ + WERROR netr_DSRGETFORESTTRUSTINFORMATION(); + + /****************/ + /* Function 0x2c */ + WERROR netr_NETRGETFORESTTRUSTINFORMATION(); + + /****************/ + /* Function 0x2d */ + WERROR netr_NETRLOGONSAMLOGONWITHFLAGS(); + + /****************/ + /* Function 0x2e */ + WERROR netr_NETRSERVERGETTRUSTINFO(); } diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl index e428bfe0c7..960d007bd3 100644 --- a/source4/librpc/idl/samr.idl +++ b/source4/librpc/idl/samr.idl @@ -10,6 +10,7 @@ [ uuid(12345778-1234-abcd-ef00-0123456789ac), version(1.0), + endpoints(samr,TCP-0), pointer_default(unique) ] interface samr { @@ -761,7 +762,7 @@ typedef struct { samr_CryptPasswordEx password; - uint16 pw_len; + uint8 pw_len; } samr_UserInfo26; typedef union { diff --git a/source4/librpc/idl/winreg.idl b/source4/librpc/idl/winreg.idl index fa11f80dcd..d043dad1f1 100644 --- a/source4/librpc/idl/winreg.idl +++ b/source4/librpc/idl/winreg.idl @@ -6,6 +6,7 @@ [ uuid(338cd001-2244-31f1-aaaa-900038001003), version(1.0), + endpoints(winreg,TCP-0), pointer_default(unique) ] interface winreg { diff --git a/source4/librpc/ndr/ndr_basic.c b/source4/librpc/ndr/ndr_basic.c index 1766d47e14..f8315b3af0 100644 --- a/source4/librpc/ndr/ndr_basic.c +++ b/source4/librpc/ndr/ndr_basic.c @@ -413,6 +413,18 @@ NTSTATUS ndr_pull_string(struct ndr_pull *ndr, int ndr_flags, const char **s) "Bad character conversion"); } NDR_CHECK(ndr_pull_advance(ndr, len2*2)); + + /* this is a way of detecting if a string is sent with the wrong + termination */ + if (ndr->flags & LIBNDR_FLAG_STR_NOTERM) { + if (strlen(as) < len2) { + DEBUG(6,("short string '%s'\n", as)); + } + } else { + if (strlen(as) == len2) { + DEBUG(6,("long string '%s'\n", as)); + } + } *s = as; break; -- cgit