diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-11-15 12:38:06 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-11-15 12:38:06 +0000 |
commit | 8c90fcd32b37f211c32bcabe5e0c9af1a1ec5381 (patch) | |
tree | 9ee9a0b269130bdbd983498f7a495ce6bd546e81 /source4/librpc | |
parent | 4d00dd9d5d0a134804fb1d0e5e24980efee175a8 (diff) | |
download | samba-8c90fcd32b37f211c32bcabe5e0c9af1a1ec5381.tar.gz samba-8c90fcd32b37f211c32bcabe5e0c9af1a1ec5381.tar.bz2 samba-8c90fcd32b37f211c32bcabe5e0c9af1a1ec5381.zip |
added OpenAlias and QueryAliasInfo levels 1 to 3
(This used to be commit 2ed8cfdf6662f74808df67e3e9d03cf03f765569)
Diffstat (limited to 'source4/librpc')
-rw-r--r-- | source4/librpc/idl/samr.idl | 39 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_samr.c | 159 | ||||
-rw-r--r-- | source4/librpc/ndr/ndr_samr.h | 37 | ||||
-rw-r--r-- | source4/librpc/rpc/rpc_samr.c | 16 |
4 files changed, 229 insertions, 22 deletions
diff --git a/source4/librpc/idl/samr.idl b/source4/librpc/idl/samr.idl index d906978466..f64f9603ee 100644 --- a/source4/librpc/idl/samr.idl +++ b/source4/librpc/idl/samr.idl @@ -252,13 +252,14 @@ [out,ref] policy_handle *acct_handle ); + /************************/ /* Function 0x14 */ typedef struct { samr_Name name; uint32 unknown; - uint32 members; + uint32 num_members; samr_Name description; } samr_GroupInfoAll; @@ -311,13 +312,45 @@ /* Function 0x1a */ NTSTATUS samr_SET_MEMBER_ATTRIBUTES_OF_GROUP(); + /************************/ /* Function 0x1b */ - NTSTATUS samr_OPEN_ALIAS(); + NTSTATUS samr_OpenAlias ( + [in,ref] policy_handle *handle, + [in] uint32 access_mask, + [in] uint32 rid, + [out,ref] policy_handle *acct_handle + ); + /************************/ /* Function 0x1c */ - NTSTATUS samr_QUERY_ALIASINFO(); + + typedef struct { + samr_Name name; + uint32 num_members; + samr_Name description; + } samr_AliasInfoAll; + + typedef struct { + samr_Name name; + } samr_AliasInfoName; + + typedef struct { + samr_Name description; + } samr_AliasInfoDescription; + + typedef union { + case(1) samr_AliasInfoAll all; + case(2) samr_AliasInfoName name; + case(3) samr_AliasInfoDescription description; + } samr_AliasInfo; + + NTSTATUS samr_QueryAliasInfo( + [in,ref] policy_handle *handle, + [in] uint16 level, + [out,switch_is(level)] samr_AliasInfo *info + ); /************************/ /* Function 0x1d */ diff --git a/source4/librpc/ndr/ndr_samr.c b/source4/librpc/ndr/ndr_samr.c index 423483a13a..5ee496e103 100644 --- a/source4/librpc/ndr/ndr_samr.c +++ b/source4/librpc/ndr/ndr_samr.c @@ -210,14 +210,19 @@ NTSTATUS ndr_push_samr_SET_MEMBER_ATTRIBUTES_OF_GROUP(struct ndr_push *ndr, stru return NT_STATUS_OK; } -NTSTATUS ndr_push_samr_OPEN_ALIAS(struct ndr_push *ndr, struct samr_OPEN_ALIAS *r) +NTSTATUS ndr_push_samr_OpenAlias(struct ndr_push *ndr, struct samr_OpenAlias *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_ALIASINFO(struct ndr_push *ndr, struct samr_QUERY_ALIASINFO *r) +NTSTATUS ndr_push_samr_QueryAliasInfo(struct ndr_push *ndr, struct samr_QueryAliasInfo *r) { + NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle)); + NDR_CHECK(ndr_push_uint16(ndr, r->in.level)); return NT_STATUS_OK; } @@ -1039,7 +1044,7 @@ static NTSTATUS ndr_pull_samr_GroupInfoAll(struct ndr_pull *ndr, int ndr_flags, 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_uint32(ndr, &r->num_members)); NDR_CHECK(ndr_pull_samr_Name(ndr, NDR_SCALARS, &r->description)); buffers: if (!(ndr_flags & NDR_BUFFERS)) goto done; @@ -1196,15 +1201,110 @@ NTSTATUS ndr_pull_samr_SET_MEMBER_ATTRIBUTES_OF_GROUP(struct ndr_pull *ndr, stru return NT_STATUS_OK; } -NTSTATUS ndr_pull_samr_OPEN_ALIAS(struct ndr_pull *ndr, struct samr_OPEN_ALIAS *r) +NTSTATUS ndr_pull_samr_OpenAlias(struct ndr_pull *ndr, struct samr_OpenAlias *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_ALIASINFO(struct ndr_pull *ndr, struct samr_QUERY_ALIASINFO *r) +static NTSTATUS ndr_pull_samr_AliasInfoAll(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoAll *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->num_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_AliasInfoName(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoName *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_AliasInfoDescription(struct ndr_pull *ndr, int ndr_flags, struct samr_AliasInfoDescription *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_AliasInfo(struct ndr_pull *ndr, int ndr_flags, uint16 *level, union samr_AliasInfo *r) { + if (!(ndr_flags & NDR_SCALARS)) goto buffers; + NDR_CHECK(ndr_pull_uint16(ndr, level)); + switch (*level) { + case 1: { + NDR_CHECK(ndr_pull_samr_AliasInfoAll(ndr, NDR_SCALARS, &r->all)); + break; } + + case 2: { + NDR_CHECK(ndr_pull_samr_AliasInfoName(ndr, NDR_SCALARS, &r->name)); + break; } + + case 3: { + NDR_CHECK(ndr_pull_samr_AliasInfoDescription(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_AliasInfoAll(ndr, NDR_BUFFERS, &r->all)); + break; + + case 2: + NDR_CHECK(ndr_pull_samr_AliasInfoName(ndr, NDR_BUFFERS, &r->name)); + break; + + case 3: + NDR_CHECK(ndr_pull_samr_AliasInfoDescription(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_QueryAliasInfo(struct ndr_pull *ndr, struct samr_QueryAliasInfo *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_AliasInfo(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; @@ -2317,7 +2417,7 @@ void ndr_print_samr_GroupInfoAll(struct ndr_print *ndr, const char *name, struct 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_uint32(ndr, "num_members", r->num_members); ndr_print_samr_Name(ndr, "description", &r->description); ndr->depth--; } @@ -2371,6 +2471,53 @@ void ndr_print_samr_GroupInfo(struct ndr_print *ndr, const char *name, uint16 le } } +void ndr_print_samr_AliasInfoAll(struct ndr_print *ndr, const char *name, struct samr_AliasInfoAll *r) +{ + ndr_print_struct(ndr, name, "samr_AliasInfoAll"); + ndr->depth++; + ndr_print_samr_Name(ndr, "name", &r->name); + ndr_print_uint32(ndr, "num_members", r->num_members); + ndr_print_samr_Name(ndr, "description", &r->description); + ndr->depth--; +} + +void ndr_print_samr_AliasInfoName(struct ndr_print *ndr, const char *name, struct samr_AliasInfoName *r) +{ + ndr_print_struct(ndr, name, "samr_AliasInfoName"); + ndr->depth++; + ndr_print_samr_Name(ndr, "name", &r->name); + ndr->depth--; +} + +void ndr_print_samr_AliasInfoDescription(struct ndr_print *ndr, const char *name, struct samr_AliasInfoDescription *r) +{ + ndr_print_struct(ndr, name, "samr_AliasInfoDescription"); + ndr->depth++; + ndr_print_samr_Name(ndr, "description", &r->description); + ndr->depth--; +} + +void ndr_print_samr_AliasInfo(struct ndr_print *ndr, const char *name, uint16 level, union samr_AliasInfo *r) +{ + ndr_print_union(ndr, name, level, "samr_AliasInfo"); + switch (level) { + case 1: + ndr_print_samr_AliasInfoAll(ndr, "all", &r->all); + break; + + case 2: + ndr_print_samr_AliasInfoName(ndr, "name", &r->name); + break; + + case 3: + ndr_print_samr_AliasInfoDescription(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 5708fcd405..1d29f56c65 100644 --- a/source4/librpc/ndr/ndr_samr.h +++ b/source4/librpc/ndr/ndr_samr.h @@ -357,7 +357,7 @@ struct samr_OpenGroup { struct samr_GroupInfoAll { struct samr_Name name; uint32 unknown; - uint32 members; + uint32 num_members; struct samr_Name description; }; @@ -453,21 +453,48 @@ struct samr_SET_MEMBER_ATTRIBUTES_OF_GROUP { }; -struct samr_OPEN_ALIAS { +struct samr_OpenAlias { struct { + struct policy_handle *handle; + uint32 access_mask; + uint32 rid; } in; struct { + struct policy_handle *acct_handle; NTSTATUS result; } out; }; -struct samr_QUERY_ALIASINFO { +struct samr_AliasInfoAll { + struct samr_Name name; + uint32 num_members; + struct samr_Name description; +}; + +struct samr_AliasInfoName { + struct samr_Name name; +}; + +struct samr_AliasInfoDescription { + struct samr_Name description; +}; + +union samr_AliasInfo { +/* [case(1)] */ struct samr_AliasInfoAll all; +/* [case(2)] */ struct samr_AliasInfoName name; +/* [case(3)] */ struct samr_AliasInfoDescription description; +}; + +struct samr_QueryAliasInfo { struct { + struct policy_handle *handle; + uint16 level; } in; struct { + union samr_AliasInfo *info; NTSTATUS result; } out; @@ -1074,8 +1101,8 @@ struct samr_VALIDATE_PASSWORD { #define DCERPC_SAMR_DEL_GROUPMEM 24 #define DCERPC_SAMR_QUERY_GROUPMEM 25 #define DCERPC_SAMR_SET_MEMBER_ATTRIBUTES_OF_GROUP 26 -#define DCERPC_SAMR_OPEN_ALIAS 27 -#define DCERPC_SAMR_QUERY_ALIASINFO 28 +#define DCERPC_SAMR_OPENALIAS 27 +#define DCERPC_SAMR_QUERYALIASINFO 28 #define DCERPC_SAMR_SET_ALIASINFO 29 #define DCERPC_SAMR_DELETE_DOM_ALIAS 30 #define DCERPC_SAMR_ADD_ALIASMEM 31 diff --git a/source4/librpc/rpc/rpc_samr.c b/source4/librpc/rpc/rpc_samr.c index d636618d23..6a1ed98fbb 100644 --- a/source4/librpc/rpc/rpc_samr.c +++ b/source4/librpc/rpc/rpc_samr.c @@ -381,12 +381,12 @@ NTSTATUS dcerpc_samr_SET_MEMBER_ATTRIBUTES_OF_GROUP(struct dcerpc_pipe *p, TALLO return r->out.result; } -NTSTATUS dcerpc_samr_OPEN_ALIAS(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_OPEN_ALIAS *r) +NTSTATUS dcerpc_samr_OpenAlias(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_OpenAlias *r) { NTSTATUS status; - status = dcerpc_ndr_request(p, DCERPC_SAMR_OPEN_ALIAS, mem_ctx, - (ndr_push_fn_t) ndr_push_samr_OPEN_ALIAS, - (ndr_pull_fn_t) ndr_pull_samr_OPEN_ALIAS, + status = dcerpc_ndr_request(p, DCERPC_SAMR_OPENALIAS, mem_ctx, + (ndr_push_fn_t) ndr_push_samr_OpenAlias, + (ndr_pull_fn_t) ndr_pull_samr_OpenAlias, r); if (!NT_STATUS_IS_OK(status)) { return status; @@ -395,12 +395,12 @@ NTSTATUS dcerpc_samr_OPEN_ALIAS(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, stru return r->out.result; } -NTSTATUS dcerpc_samr_QUERY_ALIASINFO(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_QUERY_ALIASINFO *r) +NTSTATUS dcerpc_samr_QueryAliasInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct samr_QueryAliasInfo *r) { NTSTATUS status; - status = dcerpc_ndr_request(p, DCERPC_SAMR_QUERY_ALIASINFO, mem_ctx, - (ndr_push_fn_t) ndr_push_samr_QUERY_ALIASINFO, - (ndr_pull_fn_t) ndr_pull_samr_QUERY_ALIASINFO, + status = dcerpc_ndr_request(p, DCERPC_SAMR_QUERYALIASINFO, mem_ctx, + (ndr_push_fn_t) ndr_push_samr_QueryAliasInfo, + (ndr_pull_fn_t) ndr_pull_samr_QueryAliasInfo, r); if (!NT_STATUS_IS_OK(status)) { return status; |