[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-test-2064-g793e5a6
Günther Deschner
gd at samba.org
Mon Feb 11 09:53:39 GMT 2008
The branch, v3-2-test has been updated
via 793e5a608b1a40174088db6fbfcfc8cc6263a0da (commit)
via bb24cccfc87dd8b97cc68a0dd205dc338f21f37d (commit)
via 62944007315c1744e2d2db7db593bc72af4b643b (commit)
via bc04816028bfd75d4bb080085dcc953d7f511211 (commit)
via bd1dbdbe88e935d6aa5d0f2927f15c83abed27f6 (commit)
from e71a48bb80cee85afcccacbce2884c0d600f4d72 (commit)
http://gitweb.samba.org/?samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 793e5a608b1a40174088db6fbfcfc8cc6263a0da
Author: Günther Deschner <gd at samba.org>
Date: Mon Feb 11 10:38:06 2008 +0100
Remove unused marshalling for LSA_ENUM_PRIVS.
Guenther
commit bb24cccfc87dd8b97cc68a0dd205dc338f21f37d
Author: Günther Deschner <gd at samba.org>
Date: Mon Feb 11 10:33:31 2008 +0100
Use rpccli_lsa_EnumPrivs() in net and rpcclient.
Guenther
commit 62944007315c1744e2d2db7db593bc72af4b643b
Author: Günther Deschner <gd at samba.org>
Date: Mon Feb 11 10:19:54 2008 +0100
Use pidl for _lsa_EnumPrivs().
Guenther
commit bc04816028bfd75d4bb080085dcc953d7f511211
Author: Günther Deschner <gd at samba.org>
Date: Mon Feb 11 10:49:15 2008 +0100
Re-run make idl.
Guenther
commit bd1dbdbe88e935d6aa5d0f2927f15c83abed27f6
Author: Günther Deschner <gd at samba.org>
Date: Mon Feb 11 10:18:41 2008 +0100
Fix IDL for lsa_EnumPrivs.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source/include/rpc_lsa.h | 29 ---------
source/librpc/gen_ndr/cli_lsa.c | 4 +-
source/librpc/gen_ndr/cli_lsa.h | 4 +-
source/librpc/idl/lsa.idl | 6 +-
source/rpc_client/cli_lsarpc.c | 75 ----------------------
source/rpc_parse/parse_lsa.c | 133 ---------------------------------------
source/rpc_server/srv_lsa.c | 23 +-------
source/rpc_server/srv_lsa_nt.c | 49 +++++++-------
source/rpcclient/cmd_lsarpc.c | 27 +++++----
source/utils/net_rpc_rights.c | 23 ++++---
10 files changed, 59 insertions(+), 314 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/include/rpc_lsa.h b/source/include/rpc_lsa.h
index 5cdcd21..95faf22 100644
--- a/source/include/rpc_lsa.h
+++ b/source/include/rpc_lsa.h
@@ -546,35 +546,6 @@ typedef struct lsa_r_lookup_names4
NTSTATUS status; /* return code */
} LSA_R_LOOKUP_NAMES4;
-typedef struct lsa_enum_priv_entry
-{
- UNIHDR hdr_name;
- uint32 luid_low;
- uint32 luid_high;
- UNISTR2 name;
-
-} LSA_PRIV_ENTRY;
-
-/* LSA_Q_ENUM_PRIVS - LSA enum privileges */
-typedef struct lsa_q_enum_privs
-{
- POLICY_HND pol; /* policy handle */
- uint32 enum_context;
- uint32 pref_max_length;
-} LSA_Q_ENUM_PRIVS;
-
-typedef struct lsa_r_enum_privs
-{
- uint32 enum_context;
- uint32 count;
- uint32 ptr;
- uint32 count1;
-
- LSA_PRIV_ENTRY *privs;
-
- NTSTATUS status;
-} LSA_R_ENUM_PRIVS;
-
/* LSA_Q_ENUM_ACCT_RIGHTS - LSA enum account rights */
typedef struct
{
diff --git a/source/librpc/gen_ndr/cli_lsa.c b/source/librpc/gen_ndr/cli_lsa.c
index ddd0c78..5ff1d14 100644
--- a/source/librpc/gen_ndr/cli_lsa.c
+++ b/source/librpc/gen_ndr/cli_lsa.c
@@ -89,8 +89,8 @@ NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle,
uint32_t *resume_handle,
- uint32_t max_count,
- struct lsa_PrivArray *privs)
+ struct lsa_PrivArray *privs,
+ uint32_t max_count)
{
struct lsa_EnumPrivs r;
NTSTATUS status;
diff --git a/source/librpc/gen_ndr/cli_lsa.h b/source/librpc/gen_ndr/cli_lsa.h
index 3f64bb4..f868197 100644
--- a/source/librpc/gen_ndr/cli_lsa.h
+++ b/source/librpc/gen_ndr/cli_lsa.h
@@ -11,8 +11,8 @@ NTSTATUS rpccli_lsa_EnumPrivs(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle,
uint32_t *resume_handle,
- uint32_t max_count,
- struct lsa_PrivArray *privs);
+ struct lsa_PrivArray *privs,
+ uint32_t max_count);
NTSTATUS rpccli_lsa_QuerySecurity(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx,
struct policy_handle *handle,
diff --git a/source/librpc/idl/lsa.idl b/source/librpc/idl/lsa.idl
index 516b435..53bf17d 100644
--- a/source/librpc/idl/lsa.idl
+++ b/source/librpc/idl/lsa.idl
@@ -71,9 +71,9 @@ import "security.idl";
[public] NTSTATUS lsa_EnumPrivs (
[in] policy_handle *handle,
- [in,out] uint32 *resume_handle,
- [in] uint32 max_count,
- [out] lsa_PrivArray *privs
+ [in,out,ref] uint32 *resume_handle,
+ [out,ref] lsa_PrivArray *privs,
+ [in] uint32 max_count
);
/******************/
diff --git a/source/rpc_client/cli_lsarpc.c b/source/rpc_client/cli_lsarpc.c
index 150d55d..82611d3 100644
--- a/source/rpc_client/cli_lsarpc.c
+++ b/source/rpc_client/cli_lsarpc.c
@@ -550,81 +550,6 @@ NTSTATUS rpccli_lsa_enum_trust_dom(struct rpc_pipe_client *cli,
return out.status;
}
-/** Enumerate privileges*/
-
-NTSTATUS rpccli_lsa_enum_privilege(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *pol, uint32 *enum_context, uint32 pref_max_length,
- uint32 *count, char ***privs_name, uint32 **privs_high, uint32 **privs_low)
-{
- prs_struct qbuf, rbuf;
- LSA_Q_ENUM_PRIVS q;
- LSA_R_ENUM_PRIVS r;
- NTSTATUS result;
- int i;
-
- ZERO_STRUCT(q);
- ZERO_STRUCT(r);
-
- init_q_enum_privs(&q, pol, *enum_context, pref_max_length);
-
- CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_ENUM_PRIVS,
- q, r,
- qbuf, rbuf,
- lsa_io_q_enum_privs,
- lsa_io_r_enum_privs,
- NT_STATUS_UNSUCCESSFUL);
-
- result = r.status;
-
- if (!NT_STATUS_IS_OK(result)) {
- goto done;
- }
-
- /* Return output parameters */
-
- *enum_context = r.enum_context;
- *count = r.count;
-
- if (r.count) {
- if (!((*privs_name = TALLOC_ARRAY(mem_ctx, char *, r.count)))) {
- DEBUG(0, ("(cli_lsa_enum_privilege): out of memory\n"));
- result = NT_STATUS_UNSUCCESSFUL;
- goto done;
- }
-
- if (!((*privs_high = TALLOC_ARRAY(mem_ctx, uint32, r.count)))) {
- DEBUG(0, ("(cli_lsa_enum_privilege): out of memory\n"));
- result = NT_STATUS_UNSUCCESSFUL;
- goto done;
- }
-
- if (!((*privs_low = TALLOC_ARRAY(mem_ctx, uint32, r.count)))) {
- DEBUG(0, ("(cli_lsa_enum_privilege): out of memory\n"));
- result = NT_STATUS_UNSUCCESSFUL;
- goto done;
- }
- } else {
- *privs_name = NULL;
- *privs_high = NULL;
- *privs_low = NULL;
- }
-
- for (i = 0; i < r.count; i++) {
- fstring name;
-
- rpcstr_pull_unistr2_fstring( name, &r.privs[i].name);
-
- (*privs_name)[i] = talloc_strdup(mem_ctx, name);
-
- (*privs_high)[i] = r.privs[i].luid_high;
- (*privs_low)[i] = r.privs[i].luid_low;
- }
-
- done:
-
- return result;
-}
-
/** Get privilege name */
NTSTATUS rpccli_lsa_get_dispname(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
diff --git a/source/rpc_parse/parse_lsa.c b/source/rpc_parse/parse_lsa.c
index 5f22a28..7e9f8b4 100644
--- a/source/rpc_parse/parse_lsa.c
+++ b/source/rpc_parse/parse_lsa.c
@@ -1615,139 +1615,6 @@ bool lsa_io_r_lookup_names4(const char *desc, LSA_R_LOOKUP_NAMES4 *out, prs_stru
return True;
}
-/*******************************************************************
- Inits an LSA_Q_ENUM_PRIVS structure.
-********************************************************************/
-
-void init_q_enum_privs(LSA_Q_ENUM_PRIVS *in, POLICY_HND *hnd, uint32 enum_context, uint32 pref_max_length)
-{
- DEBUG(5, ("init_q_enum_privs\n"));
-
- memcpy(&in->pol, hnd, sizeof(in->pol));
-
- in->enum_context = enum_context;
- in->pref_max_length = pref_max_length;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool lsa_io_q_enum_privs(const char *desc, LSA_Q_ENUM_PRIVS *in, prs_struct *ps, int depth)
-{
- if (in == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_q_enum_privs");
- depth++;
-
- if (!smb_io_pol_hnd("", &in->pol, ps, depth))
- return False;
-
- if(!prs_uint32("enum_context ", ps, depth, &in->enum_context))
- return False;
- if(!prs_uint32("pref_max_length", ps, depth, &in->pref_max_length))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-static bool lsa_io_priv_entries(const char *desc, LSA_PRIV_ENTRY *entries, uint32 count, prs_struct *ps, int depth)
-{
- uint32 i;
-
- if (entries == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_priv_entries");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- for (i = 0; i < count; i++) {
- if (!smb_io_unihdr("", &entries[i].hdr_name, ps, depth))
- return False;
- if(!prs_uint32("luid_low ", ps, depth, &entries[i].luid_low))
- return False;
- if(!prs_uint32("luid_high", ps, depth, &entries[i].luid_high))
- return False;
- }
-
- for (i = 0; i < count; i++)
- if (!smb_io_unistr2("", &entries[i].name, entries[i].hdr_name.buffer, ps, depth))
- return False;
-
- return True;
-}
-
-/*******************************************************************
- Inits an LSA_R_ENUM_PRIVS structure.
-********************************************************************/
-
-void init_lsa_r_enum_privs(LSA_R_ENUM_PRIVS *out, uint32 enum_context,
- uint32 count, LSA_PRIV_ENTRY *entries)
-{
- DEBUG(5, ("init_lsa_r_enum_privs\n"));
-
- out->enum_context=enum_context;
- out->count=count;
-
- if (entries!=NULL) {
- out->ptr=1;
- out->count1=count;
- out->privs=entries;
- } else {
- out->ptr=0;
- out->count1=0;
- out->privs=NULL;
- }
-}
-
-/*******************************************************************
-reads or writes a structure.
-********************************************************************/
-bool lsa_io_r_enum_privs(const char *desc, LSA_R_ENUM_PRIVS *out, prs_struct *ps, int depth)
-{
- if (out == NULL)
- return False;
-
- prs_debug(ps, depth, desc, "lsa_io_r_enum_privs");
- depth++;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("enum_context", ps, depth, &out->enum_context))
- return False;
- if(!prs_uint32("count", ps, depth, &out->count))
- return False;
- if(!prs_uint32("ptr", ps, depth, &out->ptr))
- return False;
-
- if (out->ptr) {
- if(!prs_uint32("count1", ps, depth, &out->count1))
- return False;
-
- if (UNMARSHALLING(ps) && out->count1)
- if (!(out->privs = PRS_ALLOC_MEM(ps, LSA_PRIV_ENTRY, out->count1)))
- return False;
-
- if (!lsa_io_priv_entries("", out->privs, out->count1, ps, depth))
- return False;
- }
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_ntstatus("status", ps, depth, &out->status))
- return False;
-
- return True;
-}
-
void init_lsa_priv_get_dispname(LSA_Q_PRIV_GET_DISPNAME *trn, POLICY_HND *hnd, const char *name, uint16 lang_id, uint16 lang_id_sys)
{
memcpy(&trn->pol, hnd, sizeof(trn->pol));
diff --git a/source/rpc_server/srv_lsa.c b/source/rpc_server/srv_lsa.c
index 24bc65c..d24929b 100644
--- a/source/rpc_server/srv_lsa.c
+++ b/source/rpc_server/srv_lsa.c
@@ -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);
}
/***************************************************************************
diff --git a/source/rpc_server/srv_lsa_nt.c b/source/rpc_server/srv_lsa_nt.c
index 6e25a64..60414a9 100644
--- a/source/rpc_server/srv_lsa_nt.c
+++ b/source/rpc_server/srv_lsa_nt.c
@@ -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;
diff --git a/source/rpcclient/cmd_lsarpc.c b/source/rpcclient/cmd_lsarpc.c
index e5d131e..5d42cff 100644
--- a/source/rpcclient/cmd_lsarpc.c
+++ b/source/rpcclient/cmd_lsarpc.c
@@ -439,13 +439,10 @@ static NTSTATUS cmd_lsa_enum_privilege(struct rpc_pipe_client *cli,
{
POLICY_HND pol;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+ struct lsa_PrivArray priv_array;
uint32 enum_context=0;
uint32 pref_max_length=0x1000;
- uint32 count=0;
- char **privs_name;
- uint32 *privs_high;
- uint32 *privs_low;
int i;
if (argc > 3) {
@@ -466,18 +463,24 @@ static NTSTATUS cmd_lsa_enum_privilege(struct rpc_pipe_client *cli,
if (!NT_STATUS_IS_OK(result))
goto done;
- result = rpccli_lsa_enum_privilege(cli, mem_ctx, &pol, &enum_context, pref_max_length,
- &count, &privs_name, &privs_high, &privs_low);
-
+ result = rpccli_lsa_EnumPrivs(cli, mem_ctx,
+ &pol,
+ &enum_context,
+ &priv_array,
+ pref_max_length);
if (!NT_STATUS_IS_OK(result))
goto done;
/* Print results */
- printf("found %d privileges\n\n", count);
-
- for (i = 0; i < count; i++) {
- printf("%s \t\t%d:%d (0x%x:0x%x)\n", privs_name[i] ? privs_name[i] : "*unknown*",
- privs_high[i], privs_low[i], privs_high[i], privs_low[i]);
+ printf("found %d privileges\n\n", priv_array.count);
+
+ for (i = 0; i < priv_array.count; i++) {
+ printf("%s \t\t%d:%d (0x%x:0x%x)\n",
+ priv_array.privs[i].name.string ? priv_array.privs[i].name.string : "*unknown*",
+ priv_array.privs[i].luid.high,
+ priv_array.privs[i].luid.low,
+ priv_array.privs[i].luid.high,
+ priv_array.privs[i].luid.low);
--
Samba Shared Repository
More information about the samba-cvs
mailing list