summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-01-18 16:21:24 +0100
committerGünther Deschner <gd@samba.org>2011-02-02 19:03:00 +0100
commit61d18b7f086eef4e9a6366306dfc441710d57209 (patch)
treef9afb82b5e558d9dee5e3901bc56047ce5ea4abc
parentd38d7431660e36628a1edebdf1557d4eae0f981c (diff)
downloadsamba-61d18b7f086eef4e9a6366306dfc441710d57209.tar.gz
samba-61d18b7f086eef4e9a6366306dfc441710d57209.tar.bz2
samba-61d18b7f086eef4e9a6366306dfc441710d57209.zip
s3-net: prefer dcerpc_lsa_X functions in "net rpc audit".
Guenther
-rw-r--r--source3/utils/net_rpc_audit.c83
1 files changed, 60 insertions, 23 deletions
diff --git a/source3/utils/net_rpc_audit.c b/source3/utils/net_rpc_audit.c
index 1f76da756d..cd6d1da8c3 100644
--- a/source3/utils/net_rpc_audit.c
+++ b/source3/utils/net_rpc_audit.c
@@ -18,7 +18,7 @@
#include "includes.h"
#include "utils/net.h"
-#include "../librpc/gen_ndr/cli_lsa.h"
+#include "../librpc/gen_ndr/ndr_lsa_c.h"
#include "rpc_client/cli_lsarpc.h"
/********************************************************************
@@ -65,10 +65,11 @@ static NTSTATUS rpc_audit_get_internal(struct net_context *c,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
union lsa_PolicyInformation *info = NULL;
int i;
uint32_t audit_category;
+ struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
if (argc < 1 || argc > 2) {
d_printf(_("insufficient arguments\n"));
@@ -89,14 +90,18 @@ static NTSTATUS rpc_audit_get_internal(struct net_context *c,
goto done;
}
- status = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
+ status = dcerpc_lsa_QueryInfoPolicy(b, mem_ctx,
&pol,
LSA_POLICY_INFO_AUDIT_EVENTS,
- &info);
-
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
for (i=0; i < info->audit_events.count; i++) {
@@ -133,9 +138,10 @@ static NTSTATUS rpc_audit_set_internal(struct net_context *c,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
union lsa_PolicyInformation *info = NULL;
uint32_t audit_policy, audit_category;
+ struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
if (argc < 2 || argc > 3) {
d_printf(_("insufficient arguments\n"));
@@ -171,30 +177,45 @@ static NTSTATUS rpc_audit_set_internal(struct net_context *c,
goto done;
}
- status = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
+ status = dcerpc_lsa_QueryInfoPolicy(b, mem_ctx,
&pol,
LSA_POLICY_INFO_AUDIT_EVENTS,
- &info);
-
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
info->audit_events.settings[audit_category] = audit_policy;
- status = rpccli_lsa_SetInfoPolicy(pipe_hnd, mem_ctx,
+ status = dcerpc_lsa_SetInfoPolicy(b, mem_ctx,
&pol,
LSA_POLICY_INFO_AUDIT_EVENTS,
- info);
-
+ info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
- status = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
+ status = dcerpc_lsa_QueryInfoPolicy(b, mem_ctx,
&pol,
LSA_POLICY_INFO_AUDIT_EVENTS,
- &info);
+ &info,
+ &result);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto done;
+ }
+
+ status = result;
+
{
const char *val = audit_policy_str(mem_ctx, info->audit_events.settings[audit_category]);
const char *policy = audit_description_str(audit_category);
@@ -220,8 +241,9 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd,
bool enable)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
union lsa_PolicyInformation *info = NULL;
+ struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
status = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
SEC_FLAG_MAXIMUM_ALLOWED,
@@ -231,24 +253,33 @@ static NTSTATUS rpc_audit_enable_internal_ext(struct rpc_pipe_client *pipe_hnd,
goto done;
}
- status = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
+ status = dcerpc_lsa_QueryInfoPolicy(b, mem_ctx,
&pol,
LSA_POLICY_INFO_AUDIT_EVENTS,
- &info);
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
info->audit_events.auditing_mode = enable;
- status = rpccli_lsa_SetInfoPolicy(pipe_hnd, mem_ctx,
+ status = dcerpc_lsa_SetInfoPolicy(b, mem_ctx,
&pol,
LSA_POLICY_INFO_AUDIT_EVENTS,
- info);
-
+ info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
done:
if (!NT_STATUS_IS_OK(status)) {
@@ -306,9 +337,10 @@ static NTSTATUS rpc_audit_list_internal(struct net_context *c,
const char **argv)
{
struct policy_handle pol;
- NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
+ NTSTATUS status, result;
union lsa_PolicyInformation *info = NULL;
int i;
+ struct dcerpc_binding_handle *b = pipe_hnd->binding_handle;
status = rpccli_lsa_open_policy(pipe_hnd, mem_ctx, true,
SEC_FLAG_MAXIMUM_ALLOWED,
@@ -318,13 +350,18 @@ static NTSTATUS rpc_audit_list_internal(struct net_context *c,
goto done;
}
- status = rpccli_lsa_QueryInfoPolicy(pipe_hnd, mem_ctx,
+ status = dcerpc_lsa_QueryInfoPolicy(b, mem_ctx,
&pol,
LSA_POLICY_INFO_AUDIT_EVENTS,
- &info);
+ &info,
+ &result);
if (!NT_STATUS_IS_OK(status)) {
goto done;
}
+ if (!NT_STATUS_IS_OK(result)) {
+ status = result;
+ goto done;
+ }
printf(_("Auditing:\t\t"));
switch (info->audit_events.auditing_mode) {