summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
Diffstat (limited to 'librpc')
-rw-r--r--librpc/idl/browser.idl54
-rw-r--r--librpc/idl/lsa.idl2
-rw-r--r--librpc/idl/misc.idl2
-rw-r--r--librpc/idl/netlogon.idl20
-rw-r--r--librpc/idl/samr.idl18
-rw-r--r--librpc/idl/security.idl28
-rw-r--r--librpc/idl/srvsvc.idl4
-rw-r--r--librpc/idl/winreg.idl2
-rw-r--r--librpc/ndr/ndr_sec_helper.c224
9 files changed, 326 insertions, 28 deletions
diff --git a/librpc/idl/browser.idl b/librpc/idl/browser.idl
index 5b05be9cbb..94d4ce6b62 100644
--- a/librpc/idl/browser.idl
+++ b/librpc/idl/browser.idl
@@ -1,4 +1,6 @@
-[
+import "srvsvc.idl";
+
+[
uuid("6bffd098-a112-3610-9833-012892020162"),
version(0.0),
helpstring("Browsing"),
@@ -9,50 +11,76 @@ interface browser
{
/******************/
/* Function 0x00 */
- [todo] NTSTATUS BrowserrServerEnum();
+ [todo] void BrowserrServerEnum();
/******************/
/* Function 0x01 */
- [todo] NTSTATUS BrowserrDebugCall();
+ [todo] void BrowserrDebugCall();
/******************/
/* Function 0x02 */
- [todo] NTSTATUS BrowserrQueryOtherDomains();
+
+ typedef struct {
+ uint32 entries_read;
+ [size_is(entries_read)] srvsvc_NetSrvInfo100 *entries;
+ } BrowserrSrvInfo100Ctr;
+
+ typedef struct {
+ uint32 entries_read;
+ [size_is(entries_read)] srvsvc_NetSrvInfo101 *entries;
+ } BrowserrSrvInfo101Ctr;
+
+ typedef [switch_type(uint32)] union {
+ [case(100)] BrowserrSrvInfo100Ctr *info100;
+ [case(101)] BrowserrSrvInfo101Ctr *info101;
+ [default] ;
+ } BrowserrSrvInfoUnion;
+
+ typedef struct {
+ uint32 level;
+ [switch_is(level)] BrowserrSrvInfoUnion info;
+ } BrowserrSrvInfo;
+
+ WERROR BrowserrQueryOtherDomains(
+ [in,unique] [string,charset(UTF16)] uint16 *server_unc,
+ [in,out,ref] BrowserrSrvInfo *info,
+ [out,ref] uint32 *total_entries
+ );
/******************/
/* Function 0x03 */
- [todo] NTSTATUS BrowserrResetNetlogonState();
+ [todo] void BrowserrResetNetlogonState();
/******************/
/* Function 0x04 */
- [todo] NTSTATUS BrowserrDebugTrace();
+ [todo] void BrowserrDebugTrace();
/******************/
/* Function 0x05 */
- [todo] NTSTATUS BrowserrQueryStatistics();
+ [todo] void BrowserrQueryStatistics();
/******************/
/* Function 0x06 */
- [todo] NTSTATUS BrowserResetStatistics();
+ [todo] void BrowserResetStatistics();
/******************/
/* Function 0x07 */
- [todo] NTSTATUS NetrBrowserStatisticsClear();
+ [todo] void NetrBrowserStatisticsClear();
/******************/
/* Function 0x08 */
- [todo] NTSTATUS NetrBrowserStatisticsGet();
+ [todo] void NetrBrowserStatisticsGet();
/******************/
/* Function 0x09 */
- [todo] NTSTATUS BrowserrSetNetlogonState();
+ [todo] void BrowserrSetNetlogonState();
/******************/
/* Function 0x0a */
- [todo] NTSTATUS BrowserrQueryEmulatedDomains();
+ [todo] void BrowserrQueryEmulatedDomains();
/******************/
/* Function 0x0b */
- [todo] NTSTATUS BrowserrServerEnumEx();
+ [todo] void BrowserrServerEnumEx();
}
diff --git a/librpc/idl/lsa.idl b/librpc/idl/lsa.idl
index 003641d97a..db5ca31720 100644
--- a/librpc/idl/lsa.idl
+++ b/librpc/idl/lsa.idl
@@ -16,7 +16,7 @@ import "misc.idl", "security.idl";
typedef bitmap security_secinfo security_secinfo;
typedef bitmap kerb_EncTypes kerb_EncTypes;
- typedef [public,noejs] struct {
+ typedef [public] struct {
[value(2*strlen_m(string))] uint16 length;
[value(2*strlen_m(string))] uint16 size;
[charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string;
diff --git a/librpc/idl/misc.idl b/librpc/idl/misc.idl
index 1907195252..1ef0d913b9 100644
--- a/librpc/idl/misc.idl
+++ b/librpc/idl/misc.idl
@@ -7,7 +7,7 @@
]
interface misc
{
- typedef [public,noprint,gensize,noejs] struct {
+ typedef [public,noprint,gensize] struct {
uint32 time_low;
uint16 time_mid;
uint16 time_hi_and_version;
diff --git a/librpc/idl/netlogon.idl b/librpc/idl/netlogon.idl
index cf4da7adfa..f09e51e30f 100644
--- a/librpc/idl/netlogon.idl
+++ b/librpc/idl/netlogon.idl
@@ -1500,5 +1500,23 @@ interface netlogon
/****************/
/* Function 0x2e */
- [todo] WERROR netr_NETRSERVERGETTRUSTINFO();
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] uint32 *data;
+ uint32 entry_count;
+ [size_is(count)] lsa_String *entries;
+ } netr_TrustInfo;
+
+ NTSTATUS netr_ServerGetTrustInfo(
+ [in,unique] [string,charset(UTF16)] uint16 *server_name,
+ [in,ref] [string,charset(UTF16)] uint16 *account_name,
+ [in] netr_SchannelType secure_channel_type,
+ [in,ref] [string,charset(UTF16)] uint16 *computer_name,
+ [in,ref] netr_Authenticator *credential,
+ [out,ref] netr_Authenticator *return_authenticator,
+ [out,ref] samr_Password *new_owf_password,
+ [out,ref] samr_Password *old_owf_password,
+ [out,ref] netr_TrustInfo **trust_info
+ );
}
diff --git a/librpc/idl/samr.idl b/librpc/idl/samr.idl
index 46478ee9e8..7d5d877bb1 100644
--- a/librpc/idl/samr.idl
+++ b/librpc/idl/samr.idl
@@ -410,8 +410,7 @@ import "misc.idl", "lsa.idl", "security.idl";
typedef struct {
hyper sequence_num;
NTTIME domain_create_time;
- uint32 unknown1;
- uint32 unknown2;
+ hyper modified_count_at_last_promotion;
} samr_DomInfo13;
typedef [switch_type(uint16)] union {
@@ -880,10 +879,11 @@ import "misc.idl", "lsa.idl", "security.idl";
} samr_Password;
typedef struct {
- samr_Password lm_pwd;
samr_Password nt_pwd;
- boolean8 lm_pwd_active;
+ samr_Password lm_pwd;
boolean8 nt_pwd_active;
+ boolean8 lm_pwd_active;
+ uint8 password_expired;
} samr_UserInfo18;
typedef struct {
@@ -916,8 +916,8 @@ import "misc.idl", "lsa.idl", "security.idl";
SAMR_FIELD_PARAMETERS = 0x00200000,
SAMR_FIELD_COUNTRY_CODE = 0x00400000,
SAMR_FIELD_CODE_PAGE = 0x00800000,
- SAMR_FIELD_PASSWORD = 0x01000000, /* either of these */
- SAMR_FIELD_PASSWORD2 = 0x02000000, /* two bits seems to work */
+ SAMR_FIELD_NT_PASSWORD_PRESENT = 0x01000000, /* either of these */
+ SAMR_FIELD_LM_PASSWORD_PRESENT = 0x02000000, /* two bits seems to work */
SAMR_FIELD_PRIVATE_DATA = 0x04000000,
SAMR_FIELD_EXPIRED_FLAG = 0x08000000,
SAMR_FIELD_SEC_DESC = 0x10000000,
@@ -945,8 +945,8 @@ import "misc.idl", "lsa.idl", "security.idl";
lsa_String workstations;
lsa_String comment;
lsa_BinaryString parameters;
- lsa_String unknown1;
- lsa_String unknown2;
+ lsa_BinaryString lm_owf_password;
+ lsa_BinaryString nt_owf_password;
lsa_String unknown3;
uint32 buf_count;
[size_is(buf_count)] uint8 *buffer;
@@ -959,8 +959,8 @@ import "misc.idl", "lsa.idl", "security.idl";
uint16 logon_count;
uint16 country_code;
uint16 code_page;
- uint8 nt_password_set;
uint8 lm_password_set;
+ uint8 nt_password_set;
uint8 password_expired;
uint8 unknown4;
} samr_UserInfo21;
diff --git a/librpc/idl/security.idl b/librpc/idl/security.idl
index 3f70e2c36e..4c6aa235d7 100644
--- a/librpc/idl/security.idl
+++ b/librpc/idl/security.idl
@@ -7,12 +7,39 @@
import "misc.idl";
import "dom_sid.idl";
+/*
+ use the same structure for dom_sid2 as dom_sid. A dom_sid2 is really
+ just a dom sid, but with the sub_auths represented as a conformant
+ array. As with all in-structure conformant arrays, the array length
+ is placed before the start of the structure. That's what gives rise
+ to the extra num_auths elemenent. We don't want the Samba code to
+ have to bother with such esoteric NDR details, so its easier to just
+ define it as a dom_sid and use pidl magic to make it all work. It
+ just means you need to mark a sid as a "dom_sid2" in the IDL when you
+ know it is of the conformant array variety
+*/
+cpp_quote("#define dom_sid2 dom_sid")
+
+/* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
+cpp_quote("#define dom_sid28 dom_sid")
+
+/* same struct as dom_sid but in a variable byte buffer, which is maybe empty in NDR */
+cpp_quote("#define dom_sid0 dom_sid")
+
[
helper("librpc/gen_ndr/ndr_dom_sid.h"),
+ pyhelper("librpc/ndr/py_security.c"),
pointer_default(unique)
]
interface security
{
+
+ typedef [public,gensize,noprint,nosize,nopull,nopush] struct {
+ uint8 sid_rev_num; /**< SID revision number */
+ [range(0,15)] int8 num_auths; /**< Number of sub-authorities */
+ uint8 id_auth[6]; /**< Identifier Authority */
+ uint32 sub_auths[15];
+ } dom_sid;
/*
access masks are divided up like this:
0xabccdddd
@@ -388,4 +415,5 @@ interface security
KERB_ENCTYPE_AES128_CTS_HMAC_SHA1_96 = 0x00000008,
KERB_ENCTYPE_AES256_CTS_HMAC_SHA1_96 = 0x00000010
} kerb_EncTypes;
+
}
diff --git a/librpc/idl/srvsvc.idl b/librpc/idl/srvsvc.idl
index 3f24402c3f..153d8cfbbe 100644
--- a/librpc/idl/srvsvc.idl
+++ b/librpc/idl/srvsvc.idl
@@ -638,12 +638,12 @@ import "security.idl", "svcctl.idl";
PLATFORM_ID_VMS = 700
} srvsvc_PlatformId;
- typedef struct {
+ typedef [public] struct {
srvsvc_PlatformId platform_id;
[string,charset(UTF16)] uint16 *server_name;
} srvsvc_NetSrvInfo100;
- typedef struct {
+ typedef [public] struct {
srvsvc_PlatformId platform_id;
[string,charset(UTF16)] uint16 *server_name;
uint32 version_major;
diff --git a/librpc/idl/winreg.idl b/librpc/idl/winreg.idl
index 9216f9893b..2f108a090b 100644
--- a/librpc/idl/winreg.idl
+++ b/librpc/idl/winreg.idl
@@ -40,7 +40,7 @@ import "lsa.idl", "security.idl";
REG_QWORD = 11
} winreg_Type;
- typedef [public,noejs] struct {
+ typedef [public] struct {
[value(strlen_m_term(name)*2)] uint16 name_len;
[value(strlen_m_term(name)*2)] uint16 name_size;
[string,charset(UTF16)] uint16 *name;
diff --git a/librpc/ndr/ndr_sec_helper.c b/librpc/ndr/ndr_sec_helper.c
index 4b135505d8..898a4287ea 100644
--- a/librpc/ndr/ndr_sec_helper.c
+++ b/librpc/ndr/ndr_sec_helper.c
@@ -23,6 +23,9 @@
#include "includes.h"
#include "librpc/gen_ndr/ndr_security.h"
+#if _SAMBA_BUILD_ == 4
+#include "libcli/security/security.h"
+#endif
/*
return the wire size of a security_ace
@@ -116,3 +119,224 @@ size_t ndr_size_security_descriptor(const struct security_descriptor *sd, int fl
return ret;
}
+/*
+ return the wire size of a dom_sid
+*/
+size_t ndr_size_dom_sid(const struct dom_sid *sid, int flags)
+{
+ if (!sid) return 0;
+ return 8 + 4*sid->num_auths;
+}
+
+size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags)
+{
+ struct dom_sid zero_sid;
+
+ if (!sid) return 0;
+
+ ZERO_STRUCT(zero_sid);
+
+ if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+ return 0;
+ }
+
+ return 8 + 4*sid->num_auths;
+}
+
+size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags)
+{
+ return ndr_size_dom_sid28(sid, flags);
+}
+
+/*
+ print a dom_sid
+*/
+void ndr_print_dom_sid(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+ ndr->print(ndr, "%-25s: %s", name, dom_sid_string(ndr, sid));
+}
+
+void ndr_print_dom_sid2(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+ ndr_print_dom_sid(ndr, name, sid);
+}
+
+void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+ ndr_print_dom_sid(ndr, name, sid);
+}
+
+void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+ ndr_print_dom_sid(ndr, name, sid);
+}
+
+
+/*
+ parse a dom_sid2 - this is a dom_sid but with an extra copy of the num_auths field
+*/
+enum ndr_err_code ndr_pull_dom_sid2(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid)
+{
+ uint32_t num_auths;
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &num_auths));
+ NDR_CHECK(ndr_pull_dom_sid(ndr, ndr_flags, sid));
+ if (sid->num_auths != num_auths) {
+ return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE,
+ "Bad array size %u should exceed %u",
+ num_auths, sid->num_auths);
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a dom_sid2 - this is a dom_sid but with an extra copy of the num_auths field
+*/
+enum ndr_err_code ndr_push_dom_sid2(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
+{
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, sid->num_auths));
+ return ndr_push_dom_sid(ndr, ndr_flags, sid);
+}
+
+/*
+ parse a dom_sid28 - this is a dom_sid in a fixed 28 byte buffer, so we need to ensure there are only upto 5 sub_auth
+*/
+enum ndr_err_code ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid)
+{
+ enum ndr_err_code status;
+ struct ndr_pull *subndr;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ subndr = talloc_zero(ndr, struct ndr_pull);
+ NDR_ERR_HAVE_NO_MEMORY(subndr);
+ subndr->flags = ndr->flags;
+ subndr->current_mem_ctx = ndr->current_mem_ctx;
+
+ subndr->data = ndr->data + ndr->offset;
+ subndr->data_size = 28;
+ subndr->offset = 0;
+
+ NDR_CHECK(ndr_pull_advance(ndr, 28));
+
+ status = ndr_pull_dom_sid(subndr, ndr_flags, sid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(status)) {
+ /* handle a w2k bug which send random data in the buffer */
+ ZERO_STRUCTP(sid);
+ } else if (sid->num_auths == 0 && sid->sub_auths) {
+ ZERO_STRUCT(sid->sub_auths);
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ push a dom_sid28 - this is a dom_sid in a 28 byte fixed buffer
+*/
+enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
+{
+ uint32_t old_offset;
+ uint32_t padding;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (sid->num_auths > 5) {
+ return ndr_push_error(ndr, NDR_ERR_RANGE,
+ "dom_sid28 allows only upto 5 sub auth [%u]",
+ sid->num_auths);
+ }
+
+ old_offset = ndr->offset;
+ NDR_CHECK(ndr_push_dom_sid(ndr, ndr_flags, sid));
+
+ padding = 28 - (ndr->offset - old_offset);
+
+ if (padding > 0) {
+ NDR_CHECK(ndr_push_zero(ndr, padding));
+ }
+
+ return NDR_ERR_SUCCESS;
+}
+
+/*
+ parse a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty
+*/
+enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid)
+{
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (ndr->data_size == ndr->offset) {
+ ZERO_STRUCTP(sid);
+ return NDR_ERR_SUCCESS;
+ }
+
+ return ndr_pull_dom_sid(ndr, ndr_flags, sid);
+}
+
+/*
+ push a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty
+*/
+enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
+{
+ struct dom_sid zero_sid;
+
+ if (!(ndr_flags & NDR_SCALARS)) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ if (!sid) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ ZERO_STRUCT(zero_sid);
+
+ if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+ return NDR_ERR_SUCCESS;
+ }
+
+ return ndr_push_dom_sid(ndr, ndr_flags, sid);
+}
+
+_PUBLIC_ enum ndr_err_code ndr_push_dom_sid(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *r)
+{
+ uint32_t cntr_sub_auths_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_push_align(ndr, 4));
+ NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->sid_rev_num));
+ NDR_CHECK(ndr_push_int8(ndr, NDR_SCALARS, r->num_auths));
+ NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->id_auth, 6));
+ for (cntr_sub_auths_0 = 0; cntr_sub_auths_0 < r->num_auths; cntr_sub_auths_0++) {
+ NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sub_auths[cntr_sub_auths_0]));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}
+
+_PUBLIC_ enum ndr_err_code ndr_pull_dom_sid(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *r)
+{
+ uint32_t cntr_sub_auths_0;
+ if (ndr_flags & NDR_SCALARS) {
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->sid_rev_num));
+ NDR_CHECK(ndr_pull_int8(ndr, NDR_SCALARS, &r->num_auths));
+ if (r->num_auths < 0 || r->num_auths > 15) {
+ return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
+ }
+ NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->id_auth, 6));
+ for (cntr_sub_auths_0 = 0; cntr_sub_auths_0 < r->num_auths; cntr_sub_auths_0++) {
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sub_auths[cntr_sub_auths_0]));
+ }
+ }
+ return NDR_ERR_SUCCESS;
+}