1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00

Use pidl for _lsa_EnumPrivs().

Guenther
This commit is contained in:
Günther Deschner 2008-02-11 10:19:54 +01:00
parent bc04816028
commit 6294400731
2 changed files with 25 additions and 47 deletions

View File

@ -186,28 +186,7 @@ static bool api_lsa_open_secret(pipes_struct *p)
static bool api_lsa_enum_privs(pipes_struct *p)
{
LSA_Q_ENUM_PRIVS q_u;
LSA_R_ENUM_PRIVS r_u;
prs_struct *data = &p->in_data.data;
prs_struct *rdata = &p->out_data.rdata;
ZERO_STRUCT(q_u);
ZERO_STRUCT(r_u);
if(!lsa_io_q_enum_privs("", &q_u, data, 0)) {
DEBUG(0,("api_lsa_enum_privs: failed to unmarshall LSA_Q_ENUM_PRIVS.\n"));
return False;
}
r_u.status = _lsa_enum_privs(p, &q_u, &r_u);
/* store the response in the SMB stream */
if(!lsa_io_r_enum_privs("", &r_u, rdata, 0)) {
DEBUG(0,("api_lsa_enum_privs: Failed to marshall LSA_R_ENUM_PRIVS.\n"));
return False;
}
return True;
return proxy_lsa_call(p, NDR_LSA_ENUMPRIVS);
}
/***************************************************************************

View File

@ -1403,16 +1403,17 @@ NTSTATUS _lsa_DeleteObject(pipes_struct *p,
}
/***************************************************************************
_lsa_enum_privs.
_lsa_EnumPrivs
***************************************************************************/
NTSTATUS _lsa_enum_privs(pipes_struct *p, LSA_Q_ENUM_PRIVS *q_u, LSA_R_ENUM_PRIVS *r_u)
NTSTATUS _lsa_EnumPrivs(pipes_struct *p,
struct lsa_EnumPrivs *r)
{
struct lsa_info *handle;
uint32 i;
uint32 enum_context = q_u->enum_context;
uint32 enum_context = *r->in.resume_handle;
int num_privs = count_all_privileges();
LSA_PRIV_ENTRY *entries = NULL;
struct lsa_PrivEntry *entries = NULL;
LUID_ATTR luid;
/* remember that the enum_context starts at 0 and not 1 */
@ -1423,7 +1424,7 @@ NTSTATUS _lsa_enum_privs(pipes_struct *p, LSA_Q_ENUM_PRIVS *q_u, LSA_R_ENUM_PRIV
DEBUG(10,("_lsa_enum_privs: enum_context:%d total entries:%d\n",
enum_context, num_privs));
if (!find_policy_by_hnd(p, &q_u->pol, (void **)(void *)&handle))
if (!find_policy_by_hnd(p, r->in.handle, (void **)(void *)&handle))
return NT_STATUS_INVALID_HANDLE;
/* check if the user have enough rights
@ -1433,33 +1434,37 @@ NTSTATUS _lsa_enum_privs(pipes_struct *p, LSA_Q_ENUM_PRIVS *q_u, LSA_R_ENUM_PRIV
return NT_STATUS_ACCESS_DENIED;
if (num_privs) {
if ( !(entries = TALLOC_ZERO_ARRAY(p->mem_ctx, LSA_PRIV_ENTRY, num_privs )) )
entries = TALLOC_ZERO_ARRAY(p->mem_ctx, struct lsa_PrivEntry, num_privs);
if (!entries) {
return NT_STATUS_NO_MEMORY;
}
} else {
entries = NULL;
}
for (i = 0; i < num_privs; i++) {
if( i < enum_context) {
init_unistr2(&entries[i].name, NULL, UNI_FLAGS_NONE);
init_uni_hdr(&entries[i].hdr_name, &entries[i].name);
entries[i].luid_low = 0;
entries[i].luid_high = 0;
init_lsa_StringLarge(&entries[i].name, NULL);
entries[i].luid.low = 0;
entries[i].luid.high = 0;
} else {
init_unistr2(&entries[i].name, privs[i].name, UNI_FLAGS_NONE);
init_uni_hdr(&entries[i].hdr_name, &entries[i].name);
init_lsa_StringLarge(&entries[i].name, privs[i].name);
luid = get_privilege_luid( &privs[i].se_priv );
entries[i].luid_low = luid.luid.low;
entries[i].luid_high = luid.luid.high;
entries[i].luid.low = luid.luid.low;
entries[i].luid.high = luid.luid.high;
}
}
enum_context = num_privs;
init_lsa_r_enum_privs(r_u, enum_context, num_privs, entries);
*r->out.resume_handle = enum_context;
r->out.privs->count = num_privs;
r->out.privs->privs = entries;
return NT_STATUS_OK;
}
@ -2188,12 +2193,6 @@ NTSTATUS _lsa_Delete(pipes_struct *p, struct lsa_Delete *r)
return NT_STATUS_NOT_IMPLEMENTED;
}
NTSTATUS _lsa_EnumPrivs(pipes_struct *p, struct lsa_EnumPrivs *r)
{
p->rng_fault_state = True;
return NT_STATUS_NOT_IMPLEMENTED;
}
NTSTATUS _lsa_SetSecObj(pipes_struct *p, struct lsa_SetSecObj *r)
{
p->rng_fault_state = True;