summaryrefslogtreecommitdiff
path: root/source4/librpc/ndr
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-15 12:14:22 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-15 12:14:22 +0000
commit4d00dd9d5d0a134804fb1d0e5e24980efee175a8 (patch)
treeb63dde806a8c0c12cc33cd2f321ad501eade3795 /source4/librpc/ndr
parentf272eb3139aebe5fb87666779ebaba04209cbc94 (diff)
downloadsamba-4d00dd9d5d0a134804fb1d0e5e24980efee175a8.tar.gz
samba-4d00dd9d5d0a134804fb1d0e5e24980efee175a8.tar.bz2
samba-4d00dd9d5d0a134804fb1d0e5e24980efee175a8.zip
added OpenGroup and QueryGroupInfo levels 1 to 4
(This used to be commit ffe4fcaab0fe4f6e0f64fb2d57c77442aa2e1f6f)
Diffstat (limited to 'source4/librpc/ndr')
-rw-r--r--source4/librpc/ndr/ndr_samr.c222
-rw-r--r--source4/librpc/ndr/ndr_samr.h55
2 files changed, 245 insertions, 32 deletions
diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c
index 7077a97e17..423483a13a 100644
--- a/source4/librpc/ndr/ndr_samr.c
+++ b/source4/librpc/ndr/ndr_samr.c
@@ -157,14 +157,19 @@ NTSTATUS ndr_push_samr_LOOKUP_RIDS(struct ndr_push *ndr, struct samr_LOOKUP_RIDS
return NT_STATUS_OK;
}
-NTSTATUS ndr_push_samr_OPEN_GROUP(struct ndr_push *ndr, struct samr_OPEN_GROUP *r)
+NTSTATUS ndr_push_samr_OpenGroup(struct ndr_push *ndr, struct samr_OpenGroup *r)
{
+ NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
+ NDR_CHECK(ndr_push_uint32(ndr, r->in.access_mask));
+ NDR_CHECK(ndr_push_uint32(ndr, r->in.rid));
return NT_STATUS_OK;
}
-NTSTATUS ndr_push_samr_QUERY_GROUPINFO(struct ndr_push *ndr, struct samr_QUERY_GROUPINFO *r)
+NTSTATUS ndr_push_samr_QueryGroupInfo(struct ndr_push *ndr, struct samr_QueryGroupInfo *r)
{
+ NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
+ NDR_CHECK(ndr_push_uint16(ndr, r->in.level));
return NT_STATUS_OK;
}
@@ -626,19 +631,19 @@ static NTSTATUS ndr_pull_samr_DomInfo2(struct ndr_pull *ndr, int ndr_flags, stru
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_align(ndr, 8));
NDR_CHECK(ndr_pull_HYPER_T(ndr, &r->force_logoff_time));
- NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->unknown_name));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->unknown1));
NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->domain));
NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->primary));
NDR_CHECK(ndr_pull_HYPER_T(ndr, &r->sequence_num));
- NDR_CHECK(ndr_pull_uint32(ndr, &r->unknown_2));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->unknown2));
NDR_CHECK(ndr_pull_uint32(ndr, &r->role));
- NDR_CHECK(ndr_pull_uint32(ndr, &r->unknown_3));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->unknown3));
NDR_CHECK(ndr_pull_uint32(ndr, &r->num_users));
NDR_CHECK(ndr_pull_uint32(ndr, &r->num_groups));
NDR_CHECK(ndr_pull_uint32(ndr, &r->num_aliases));
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
- NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->unknown_name));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->unknown1));
NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->domain));
NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->primary));
done:
@@ -660,10 +665,10 @@ static NTSTATUS ndr_pull_samr_DomInfo4(struct ndr_pull *ndr, int ndr_flags, stru
{
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_align(ndr, 4));
- NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->unknown_name));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->unknown));
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
- NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->unknown_name));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->unknown));
done:
return NT_STATUS_OK;
}
@@ -731,13 +736,13 @@ static NTSTATUS ndr_pull_samr_DomInfo11(struct ndr_pull *ndr, int ndr_flags, str
if (!(ndr_flags & NDR_SCALARS)) goto buffers;
NDR_CHECK(ndr_pull_align(ndr, 8));
NDR_CHECK(ndr_pull_HYPER_T(ndr, &r->force_logoff_time));
- NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->unknown_name));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->unknown1));
NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->domain));
NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->primary));
NDR_CHECK(ndr_pull_HYPER_T(ndr, &r->sequence_num));
- NDR_CHECK(ndr_pull_uint32(ndr, &r->unknown_2));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->unknown2));
NDR_CHECK(ndr_pull_uint32(ndr, &r->role));
- NDR_CHECK(ndr_pull_uint32(ndr, &r->unknown_3));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->unknown3));
NDR_CHECK(ndr_pull_uint32(ndr, &r->num_users));
NDR_CHECK(ndr_pull_uint32(ndr, &r->num_groups));
NDR_CHECK(ndr_pull_uint32(ndr, &r->num_aliases));
@@ -746,7 +751,7 @@ static NTSTATUS ndr_pull_samr_DomInfo11(struct ndr_pull *ndr, int ndr_flags, str
NDR_CHECK(ndr_pull_uint16(ndr, &r->lockout_threshold));
buffers:
if (!(ndr_flags & NDR_BUFFERS)) goto done;
- NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->unknown_name));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->unknown1));
NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->domain));
NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->primary));
done:
@@ -1020,15 +1025,130 @@ NTSTATUS ndr_pull_samr_LOOKUP_RIDS(struct ndr_pull *ndr, struct samr_LOOKUP_RIDS
return NT_STATUS_OK;
}
-NTSTATUS ndr_pull_samr_OPEN_GROUP(struct ndr_pull *ndr, struct samr_OPEN_GROUP *r)
+NTSTATUS ndr_pull_samr_OpenGroup(struct ndr_pull *ndr, struct samr_OpenGroup *r)
{
+ NDR_CHECK(ndr_pull_policy_handle(ndr, r->out.acct_handle));
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
return NT_STATUS_OK;
}
-NTSTATUS ndr_pull_samr_QUERY_GROUPINFO(struct ndr_pull *ndr, struct samr_QUERY_GROUPINFO *r)
+static NTSTATUS ndr_pull_samr_GroupInfoAll(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoAll *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->name));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->unknown));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->members));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->description));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->name));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->description));
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_samr_GroupInfoName(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoName *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->Name));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->Name));
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_samr_GroupInfoX(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoX *r)
{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_uint32(ndr, &r->unknown));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_samr_GroupInfoDesciption(struct ndr_pull *ndr, int ndr_flags, struct samr_GroupInfoDesciption *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->description));
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_BUFFERS, &r->description));
+done:
+ return NT_STATUS_OK;
+}
+
+static NTSTATUS ndr_pull_samr_GroupInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union samr_GroupInfo *r)
+{
+ if (!(ndr_flags & NDR_SCALARS)) goto buffers;
+ NDR_CHECK(ndr_pull_uint16(ndr, level));
+ switch (*level) {
+ case 1: {
+ NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_SCALARS, &r->all));
+ break; }
+
+ case 2: {
+ NDR_CHECK(ndr_pull_samr_GroupInfoName(ndr, NDR_SCALARS, &r->name));
+ break; }
+
+ case 3: {
+ NDR_CHECK(ndr_pull_samr_GroupInfoX(ndr, NDR_SCALARS, &r->unknown));
+ break; }
+
+ case 4: {
+ NDR_CHECK(ndr_pull_samr_GroupInfoDesciption(ndr, NDR_SCALARS, &r->description));
+ break; }
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
+ }
+buffers:
+ if (!(ndr_flags & NDR_BUFFERS)) goto done;
+ switch (*level) {
+ case 1:
+ NDR_CHECK(ndr_pull_samr_GroupInfoAll(ndr, NDR_BUFFERS, &r->all));
+ break;
+
+ case 2:
+ NDR_CHECK(ndr_pull_samr_GroupInfoName(ndr, NDR_BUFFERS, &r->name));
+ break;
+
+ case 3:
+ NDR_CHECK(ndr_pull_samr_GroupInfoX(ndr, NDR_BUFFERS, &r->unknown));
+ break;
+
+ case 4:
+ NDR_CHECK(ndr_pull_samr_GroupInfoDesciption(ndr, NDR_BUFFERS, &r->description));
+ break;
+
+ default:
+ return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", *level);
+ }
+done:
+ return NT_STATUS_OK;
+}
+
+NTSTATUS ndr_pull_samr_QueryGroupInfo(struct ndr_pull *ndr, struct samr_QueryGroupInfo *r)
+{
+ uint32 _ptr_info;
+ NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_info));
+ if (_ptr_info) {
+ NDR_ALLOC(ndr, r->out.info);
+ } else {
+ r->out.info = NULL;
+ }
+ if (r->out.info) {
+ { uint16 _level;
+ NDR_CHECK(ndr_pull_samr_GroupInfo(ndr, NDR_SCALARS|NDR_BUFFERS, &_level, r->out.info));
+ if (((NDR_SCALARS|NDR_BUFFERS) & NDR_SCALARS) && (_level != r->in.level)) return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u in info");
+ }
+ }
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
return NT_STATUS_OK;
@@ -2022,13 +2142,13 @@ void ndr_print_samr_DomInfo2(struct ndr_print *ndr, const char *name, struct sam
ndr_print_struct(ndr, name, "samr_DomInfo2");
ndr->depth++;
ndr_print_HYPER_T(ndr, "force_logoff_time", r->force_logoff_time);
- ndr_print_samr_Name(ndr, "unknown_name", &r->unknown_name);
+ ndr_print_samr_Name(ndr, "unknown1", &r->unknown1);
ndr_print_samr_Name(ndr, "domain", &r->domain);
ndr_print_samr_Name(ndr, "primary", &r->primary);
ndr_print_HYPER_T(ndr, "sequence_num", r->sequence_num);
- ndr_print_uint32(ndr, "unknown_2", r->unknown_2);
+ ndr_print_uint32(ndr, "unknown2", r->unknown2);
ndr_print_uint32(ndr, "role", r->role);
- ndr_print_uint32(ndr, "unknown_3", r->unknown_3);
+ ndr_print_uint32(ndr, "unknown3", r->unknown3);
ndr_print_uint32(ndr, "num_users", r->num_users);
ndr_print_uint32(ndr, "num_groups", r->num_groups);
ndr_print_uint32(ndr, "num_aliases", r->num_aliases);
@@ -2047,7 +2167,7 @@ void ndr_print_samr_DomInfo4(struct ndr_print *ndr, const char *name, struct sam
{
ndr_print_struct(ndr, name, "samr_DomInfo4");
ndr->depth++;
- ndr_print_samr_Name(ndr, "unknown_name", &r->unknown_name);
+ ndr_print_samr_Name(ndr, "unknown", &r->unknown);
ndr->depth--;
}
@@ -2097,13 +2217,13 @@ void ndr_print_samr_DomInfo11(struct ndr_print *ndr, const char *name, struct sa
ndr_print_struct(ndr, name, "samr_DomInfo11");
ndr->depth++;
ndr_print_HYPER_T(ndr, "force_logoff_time", r->force_logoff_time);
- ndr_print_samr_Name(ndr, "unknown_name", &r->unknown_name);
+ ndr_print_samr_Name(ndr, "unknown1", &r->unknown1);
ndr_print_samr_Name(ndr, "domain", &r->domain);
ndr_print_samr_Name(ndr, "primary", &r->primary);
ndr_print_HYPER_T(ndr, "sequence_num", r->sequence_num);
- ndr_print_uint32(ndr, "unknown_2", r->unknown_2);
+ ndr_print_uint32(ndr, "unknown2", r->unknown2);
ndr_print_uint32(ndr, "role", r->role);
- ndr_print_uint32(ndr, "unknown_3", r->unknown_3);
+ ndr_print_uint32(ndr, "unknown3", r->unknown3);
ndr_print_uint32(ndr, "num_users", r->num_users);
ndr_print_uint32(ndr, "num_groups", r->num_groups);
ndr_print_uint32(ndr, "num_aliases", r->num_aliases);
@@ -2191,6 +2311,66 @@ void ndr_print_samr_DomainInfo(struct ndr_print *ndr, const char *name, uint16 l
}
}
+void ndr_print_samr_GroupInfoAll(struct ndr_print *ndr, const char *name, struct samr_GroupInfoAll *r)
+{
+ ndr_print_struct(ndr, name, "samr_GroupInfoAll");
+ ndr->depth++;
+ ndr_print_samr_Name(ndr, "name", &r->name);
+ ndr_print_uint32(ndr, "unknown", r->unknown);
+ ndr_print_uint32(ndr, "members", r->members);
+ ndr_print_samr_Name(ndr, "description", &r->description);
+ ndr->depth--;
+}
+
+void ndr_print_samr_GroupInfoName(struct ndr_print *ndr, const char *name, struct samr_GroupInfoName *r)
+{
+ ndr_print_struct(ndr, name, "samr_GroupInfoName");
+ ndr->depth++;
+ ndr_print_samr_Name(ndr, "Name", &r->Name);
+ ndr->depth--;
+}
+
+void ndr_print_samr_GroupInfoX(struct ndr_print *ndr, const char *name, struct samr_GroupInfoX *r)
+{
+ ndr_print_struct(ndr, name, "samr_GroupInfoX");
+ ndr->depth++;
+ ndr_print_uint32(ndr, "unknown", r->unknown);
+ ndr->depth--;
+}
+
+void ndr_print_samr_GroupInfoDesciption(struct ndr_print *ndr, const char *name, struct samr_GroupInfoDesciption *r)
+{
+ ndr_print_struct(ndr, name, "samr_GroupInfoDesciption");
+ ndr->depth++;
+ ndr_print_samr_Name(ndr, "description", &r->description);
+ ndr->depth--;
+}
+
+void ndr_print_samr_GroupInfo(struct ndr_print *ndr, const char *name, uint16 level, union samr_GroupInfo *r)
+{
+ ndr_print_union(ndr, name, level, "samr_GroupInfo");
+ switch (level) {
+ case 1:
+ ndr_print_samr_GroupInfoAll(ndr, "all", &r->all);
+ break;
+
+ case 2:
+ ndr_print_samr_GroupInfoName(ndr, "name", &r->name);
+ break;
+
+ case 3:
+ ndr_print_samr_GroupInfoX(ndr, "unknown", &r->unknown);
+ break;
+
+ case 4:
+ ndr_print_samr_GroupInfoDesciption(ndr, "description", &r->description);
+ break;
+
+ default:
+ ndr_print_bad_level(ndr, name, level);
+ }
+}
+
void ndr_print_samr_UserInfo1(struct ndr_print *ndr, const char *name, struct samr_UserInfo1 *r)
{
ndr_print_struct(ndr, name, "samr_UserInfo1");
diff --git a/source4/librpc/ndr/ndr_samr.h b/source4/librpc/ndr/ndr_samr.h
index f267e6d5d7..5708fcd405 100644
--- a/source4/librpc/ndr/ndr_samr.h
+++ b/source4/librpc/ndr/ndr_samr.h
@@ -122,13 +122,13 @@ struct samr_DomInfo1 {
struct samr_DomInfo2 {
HYPER_T force_logoff_time;
- struct samr_Name unknown_name;
+ struct samr_Name unknown1;
struct samr_Name domain;
struct samr_Name primary;
HYPER_T sequence_num;
- uint32 unknown_2;
+ uint32 unknown2;
uint32 role;
- uint32 unknown_3;
+ uint32 unknown3;
uint32 num_users;
uint32 num_groups;
uint32 num_aliases;
@@ -139,7 +139,7 @@ struct samr_DomInfo3 {
};
struct samr_DomInfo4 {
- struct samr_Name unknown_name;
+ struct samr_Name unknown;
};
struct samr_DomInfo5 {
@@ -165,13 +165,13 @@ struct samr_DomInfo9 {
struct samr_DomInfo11 {
HYPER_T force_logoff_time;
- struct samr_Name unknown_name;
+ struct samr_Name unknown1;
struct samr_Name domain;
struct samr_Name primary;
HYPER_T sequence_num;
- uint32 unknown_2;
+ uint32 unknown2;
uint32 role;
- uint32 unknown_3;
+ uint32 unknown3;
uint32 num_users;
uint32 num_groups;
uint32 num_aliases;
@@ -340,21 +340,54 @@ struct samr_LOOKUP_RIDS {
};
-struct samr_OPEN_GROUP {
+struct samr_OpenGroup {
struct {
+ struct policy_handle *handle;
+ uint32 access_mask;
+ uint32 rid;
} in;
struct {
+ struct policy_handle *acct_handle;
NTSTATUS result;
} out;
};
-struct samr_QUERY_GROUPINFO {
+struct samr_GroupInfoAll {
+ struct samr_Name name;
+ uint32 unknown;
+ uint32 members;
+ struct samr_Name description;
+};
+
+struct samr_GroupInfoName {
+ struct samr_Name Name;
+};
+
+struct samr_GroupInfoX {
+ uint32 unknown;
+};
+
+struct samr_GroupInfoDesciption {
+ struct samr_Name description;
+};
+
+union samr_GroupInfo {
+/* [case(1)] */ struct samr_GroupInfoAll all;
+/* [case(2)] */ struct samr_GroupInfoName name;
+/* [case(3)] */ struct samr_GroupInfoX unknown;
+/* [case(4)] */ struct samr_GroupInfoDesciption description;
+};
+
+struct samr_QueryGroupInfo {
struct {
+ struct policy_handle *handle;
+ uint16 level;
} in;
struct {
+ union samr_GroupInfo *info;
NTSTATUS result;
} out;
@@ -1033,8 +1066,8 @@ struct samr_VALIDATE_PASSWORD {
#define DCERPC_SAMR_GET_ALIAS_MEMBERSHIP 16
#define DCERPC_SAMR_LOOKUP_NAMES 17
#define DCERPC_SAMR_LOOKUP_RIDS 18
-#define DCERPC_SAMR_OPEN_GROUP 19
-#define DCERPC_SAMR_QUERY_GROUPINFO 20
+#define DCERPC_SAMR_OPENGROUP 19
+#define DCERPC_SAMR_QUERYGROUPINFO 20
#define DCERPC_SAMR_SET_GROUPINFO 21
#define DCERPC_SAMR_ADD_GROUPMEM 22
#define DCERPC_SAMR_DELETE_DOM_GROUP 23