summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-11 11:57:29 +0100
committerGünther Deschner <gd@samba.org>2008-02-11 19:16:04 +0100
commit419ab84b0188b81025d66637415047cc87986792 (patch)
tree143f6cd0540e51b6d3146458c04f67e2454acb62
parent095d12ed39a2b1f70f786c39a3cc2d1ab4b5541b (diff)
downloadsamba-419ab84b0188b81025d66637415047cc87986792.tar.gz
samba-419ab84b0188b81025d66637415047cc87986792.tar.bz2
samba-419ab84b0188b81025d66637415047cc87986792.zip
Use pidl for _lsa_LookupPrivDisplayName().
Guenther (This used to be commit c86640320199898cc5e3040bc3339db683e98da8)
-rw-r--r--source3/lib/privileges_basic.c4
-rw-r--r--source3/rpc_server/srv_lsa.c23
-rw-r--r--source3/rpc_server/srv_lsa_nt.c51
3 files changed, 27 insertions, 51 deletions
diff --git a/source3/lib/privileges_basic.c b/source3/lib/privileges_basic.c
index ea566c71eb..753f7265a1 100644
--- a/source3/lib/privileges_basic.c
+++ b/source3/lib/privileges_basic.c
@@ -317,6 +317,10 @@ const char* get_privilege_dispname( const char *name )
{
int i;
+ if (!name) {
+ return NULL;
+ }
+
for ( i=0; !se_priv_equal(&privs[i].se_priv, &se_priv_end); i++ ) {
if ( strequal( privs[i].name, name ) ) {
diff --git a/source3/rpc_server/srv_lsa.c b/source3/rpc_server/srv_lsa.c
index d24929b3af..9f3dd9031c 100644
--- a/source3/rpc_server/srv_lsa.c
+++ b/source3/rpc_server/srv_lsa.c
@@ -195,28 +195,7 @@ static bool api_lsa_enum_privs(pipes_struct *p)
static bool api_lsa_priv_get_dispname(pipes_struct *p)
{
- LSA_Q_PRIV_GET_DISPNAME q_u;
- LSA_R_PRIV_GET_DISPNAME 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_priv_get_dispname("", &q_u, data, 0)) {
- DEBUG(0,("api_lsa_priv_get_dispname: failed to unmarshall LSA_Q_PRIV_GET_DISPNAME.\n"));
- return False;
- }
-
- r_u.status = _lsa_priv_get_dispname(p, &q_u, &r_u);
-
- /* store the response in the SMB stream */
- if(!lsa_io_r_priv_get_dispname("", &r_u, rdata, 0)) {
- DEBUG(0,("api_lsa_priv_get_dispname: Failed to marshall LSA_R_PRIV_GET_DISPNAME.\n"));
- return False;
- }
-
- return True;
+ return proxy_lsa_call(p, NDR_LSA_LOOKUPPRIVDISPLAYNAME);
}
/***************************************************************************
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index 60414a9372..bb87422bf9 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -1470,16 +1470,17 @@ NTSTATUS _lsa_EnumPrivs(pipes_struct *p,
}
/***************************************************************************
-_lsa_priv_get_dispname.
+ _lsa_LookupPrivDisplayName
***************************************************************************/
-NTSTATUS _lsa_priv_get_dispname(pipes_struct *p, LSA_Q_PRIV_GET_DISPNAME *q_u, LSA_R_PRIV_GET_DISPNAME *r_u)
+NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p,
+ struct lsa_LookupPrivDisplayName *r)
{
struct lsa_info *handle;
- fstring name_asc;
const char *description;
+ struct lsa_StringLarge *lsa_name;
- 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 */
@@ -1490,29 +1491,27 @@ NTSTATUS _lsa_priv_get_dispname(pipes_struct *p, LSA_Q_PRIV_GET_DISPNAME *q_u, L
if (!(handle->access & POLICY_VIEW_LOCAL_INFORMATION))
return NT_STATUS_ACCESS_DENIED;
- unistr2_to_ascii(name_asc, &q_u->name, sizeof(name_asc));
+ DEBUG(10,("_lsa_LookupPrivDisplayName: name = %s\n", r->in.name->string));
- DEBUG(10,("_lsa_priv_get_dispname: name = %s\n", name_asc));
+ description = get_privilege_dispname(r->in.name->string);
+ if (!description) {
+ DEBUG(10,("_lsa_LookupPrivDisplayName: doesn't exist\n"));
+ return NT_STATUS_NO_SUCH_PRIVILEGE;
+ }
- description = get_privilege_dispname( name_asc );
-
- if ( description ) {
- DEBUG(10,("_lsa_priv_get_dispname: display name = %s\n", description));
-
- init_unistr2(&r_u->desc, description, UNI_FLAGS_NONE);
- init_uni_hdr(&r_u->hdr_desc, &r_u->desc);
+ DEBUG(10,("_lsa_LookupPrivDisplayName: display name = %s\n", description));
- r_u->ptr_info = 0xdeadbeef;
- r_u->lang_id = q_u->lang_id;
-
- return NT_STATUS_OK;
- } else {
- DEBUG(10,("_lsa_priv_get_dispname: doesn't exist\n"));
-
- r_u->ptr_info = 0;
-
- return NT_STATUS_NO_SUCH_PRIVILEGE;
+ lsa_name = TALLOC_ZERO_P(p->mem_ctx, struct lsa_StringLarge);
+ if (!lsa_name) {
+ return NT_STATUS_NO_MEMORY;
}
+
+ init_lsa_StringLarge(lsa_name, description);
+
+ *r->out.returned_language_id = r->in.language_id;
+ *r->out.disp_name = lsa_name;
+
+ return NT_STATUS_OK;
}
/***************************************************************************
@@ -2301,12 +2300,6 @@ NTSTATUS _lsa_LookupPrivName(pipes_struct *p, struct lsa_LookupPrivName *r)
return NT_STATUS_NOT_IMPLEMENTED;
}
-NTSTATUS _lsa_LookupPrivDisplayName(pipes_struct *p, struct lsa_LookupPrivDisplayName *r)
-{
- p->rng_fault_state = True;
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS _lsa_EnumAccountsWithUserRight(pipes_struct *p, struct lsa_EnumAccountsWithUserRight *r)
{
p->rng_fault_state = True;