mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
added idl and test code for lsa_LookupPrivName()
(This used to be commit c742227ec3
)
This commit is contained in:
parent
4659d4f9e2
commit
657dc577b6
@ -278,10 +278,20 @@
|
||||
NTSTATUS SETSECRET ();
|
||||
/* Function: 0x1e */
|
||||
NTSTATUS QUERYSECRET ();
|
||||
|
||||
/* Function: 0x1f */
|
||||
NTSTATUS LOOKUPPRIVVALUE ();
|
||||
|
||||
|
||||
/* Function: 0x20 */
|
||||
NTSTATUS LOOKUPPRIVNAME ();
|
||||
NTSTATUS lsa_LookupPrivName (
|
||||
[in,ref] policy_handle *handle,
|
||||
[in] uint32 luid_high,
|
||||
[in] uint32 luid_low,
|
||||
[out] lsa_Name *name
|
||||
);
|
||||
|
||||
|
||||
/* Function: 0x21 */
|
||||
NTSTATUS PRIV_GET_DISPNAME ();
|
||||
/* Function: 0x22 */
|
||||
|
@ -1127,14 +1127,27 @@ NTSTATUS ndr_pull_LOOKUPPRIVVALUE(struct ndr_pull *ndr, struct LOOKUPPRIVVALUE *
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS ndr_push_LOOKUPPRIVNAME(struct ndr_push *ndr, struct LOOKUPPRIVNAME *r)
|
||||
NTSTATUS ndr_push_lsa_LookupPrivName(struct ndr_push *ndr, struct lsa_LookupPrivName *r)
|
||||
{
|
||||
NDR_CHECK(ndr_push_policy_handle(ndr, r->in.handle));
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->in.luid_high));
|
||||
NDR_CHECK(ndr_push_uint32(ndr, r->in.luid_low));
|
||||
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
NTSTATUS ndr_pull_LOOKUPPRIVNAME(struct ndr_pull *ndr, struct LOOKUPPRIVNAME *r)
|
||||
NTSTATUS ndr_pull_lsa_LookupPrivName(struct ndr_pull *ndr, struct lsa_LookupPrivName *r)
|
||||
{
|
||||
uint32 _ptr_name;
|
||||
NDR_CHECK(ndr_pull_uint32(ndr, &_ptr_name));
|
||||
if (_ptr_name) {
|
||||
NDR_ALLOC(ndr, r->out.name);
|
||||
} else {
|
||||
r->out.name = NULL;
|
||||
}
|
||||
if (r->out.name) {
|
||||
NDR_CHECK(ndr_pull_lsa_Name(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.name));
|
||||
}
|
||||
NDR_CHECK(ndr_pull_NTSTATUS(ndr, &r->out.result));
|
||||
|
||||
return NT_STATUS_OK;
|
||||
|
@ -464,11 +464,15 @@ struct LOOKUPPRIVVALUE {
|
||||
|
||||
};
|
||||
|
||||
struct LOOKUPPRIVNAME {
|
||||
struct lsa_LookupPrivName {
|
||||
struct {
|
||||
struct policy_handle *handle;
|
||||
uint32 luid_high;
|
||||
uint32 luid_low;
|
||||
} in;
|
||||
|
||||
struct {
|
||||
struct lsa_Name *name;
|
||||
NTSTATUS result;
|
||||
} out;
|
||||
|
||||
@ -662,7 +666,7 @@ struct QUERYINFO2 {
|
||||
#define DCERPC_SETSECRET 29
|
||||
#define DCERPC_QUERYSECRET 30
|
||||
#define DCERPC_LOOKUPPRIVVALUE 31
|
||||
#define DCERPC_LOOKUPPRIVNAME 32
|
||||
#define DCERPC_LSA_LOOKUPPRIVNAME 32
|
||||
#define DCERPC_PRIV_GET_DISPNAME 33
|
||||
#define DCERPC_DELETEOBJECT 34
|
||||
#define DCERPC_ENUMACCTWITHRIGHT 35
|
||||
|
@ -451,12 +451,12 @@ NTSTATUS dcerpc_LOOKUPPRIVVALUE(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, stru
|
||||
return r->out.result;
|
||||
}
|
||||
|
||||
NTSTATUS dcerpc_LOOKUPPRIVNAME(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct LOOKUPPRIVNAME *r)
|
||||
NTSTATUS dcerpc_lsa_LookupPrivName(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct lsa_LookupPrivName *r)
|
||||
{
|
||||
NTSTATUS status;
|
||||
status = dcerpc_ndr_request(p, DCERPC_LOOKUPPRIVNAME, mem_ctx,
|
||||
(ndr_push_fn_t) ndr_push_LOOKUPPRIVNAME,
|
||||
(ndr_pull_fn_t) ndr_pull_LOOKUPPRIVNAME,
|
||||
status = dcerpc_ndr_request(p, DCERPC_LSA_LOOKUPPRIVNAME, mem_ctx,
|
||||
(ndr_push_fn_t) ndr_push_lsa_LookupPrivName,
|
||||
(ndr_pull_fn_t) ndr_pull_lsa_LookupPrivName,
|
||||
r);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
|
@ -271,8 +271,32 @@ static BOOL test_LookupSids(struct dcerpc_pipe *p,
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL test_LookupPrivName(struct dcerpc_pipe *p,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct policy_handle *handle,
|
||||
struct lsa_LUID *luid)
|
||||
{
|
||||
NTSTATUS status;
|
||||
struct lsa_LookupPrivName r;
|
||||
|
||||
r.in.handle = handle;
|
||||
r.in.luid_high = luid->high;
|
||||
r.in.luid_low = luid->low;
|
||||
|
||||
status = dcerpc_lsa_LookupPrivName(p, mem_ctx, &r);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
printf("\nLookupPrivName failed - %s\n", nt_errstr(status));
|
||||
return False;
|
||||
}
|
||||
|
||||
printf(" '%s'\n", r.out.name->name);
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
static BOOL test_EnumPrivsAccount(struct dcerpc_pipe *p,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct policy_handle *handle,
|
||||
struct policy_handle *acct_handle)
|
||||
{
|
||||
NTSTATUS status;
|
||||
@ -295,10 +319,12 @@ static BOOL test_EnumPrivsAccount(struct dcerpc_pipe *p,
|
||||
struct lsa_PrivilegeSet *privs = r.out.privs;
|
||||
int i;
|
||||
for (i=0;i<privs->count;i++) {
|
||||
printf("luid=%08x-%08x attribute=0x%08x\n",
|
||||
printf("luid=%08x-%08x attribute=0x%08x ",
|
||||
privs->set[i].luid.low,
|
||||
privs->set[i].luid.high,
|
||||
privs->set[i].attribute);
|
||||
test_LookupPrivName(p, mem_ctx, handle,
|
||||
&privs->set[i].luid);
|
||||
}
|
||||
}
|
||||
|
||||
@ -357,7 +383,7 @@ static BOOL test_OpenAccount(struct dcerpc_pipe *p,
|
||||
return False;
|
||||
}
|
||||
|
||||
if (!test_EnumPrivsAccount(p, mem_ctx, &acct_handle)) {
|
||||
if (!test_EnumPrivsAccount(p, mem_ctx, handle, &acct_handle)) {
|
||||
return False;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user