From 62e11c4f1748d98f479110c8c0e656a8f65dca4d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 16 Jan 2007 15:42:03 +0000 Subject: r20832: Remove extra pointers previously added to unique [out] pointers. Instead, add [ref] pointers where necessary (top-level [ref] pointers, by spec, don't appear on the wire). This brings us closer to the DCE/RPC standard again. (This used to be commit 580f2a7197b1bc9db14a643fdd112b40ef37aaef) --- source3/utils/net_rpc.c | 18 +++++++--------- source3/utils/net_rpc_registry.c | 45 ++++++++++++++-------------------------- source3/utils/smbtree.c | 3 +-- 3 files changed, 24 insertions(+), 42 deletions(-) (limited to 'source3/utils') diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index e29d0495d1..29fba09eb7 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -3021,7 +3021,7 @@ static NTSTATUS rpc_share_add_internals(const DOM_SID *domain_sid, uint32 num_users=0, perms=0; char *password=NULL; /* don't allow a share password */ uint32 level = 2; - uint32 *pparm_error = NULL; + uint32 parm_error; union srvsvc_NetShareInfo info; struct srvsvc_NetShareInfo2 info2; @@ -3046,7 +3046,7 @@ static NTSTATUS rpc_share_add_internals(const DOM_SID *domain_sid, info2.name = sharename; result = rpccli_srvsvc_NetShareAdd(pipe_hnd, mem_ctx, NULL, level, - info, &pparm_error); + info, &parm_error); return result; } @@ -3158,11 +3158,10 @@ static NTSTATUS get_share_info(struct rpc_pipe_client *pipe_hnd, /* no specific share requested, enumerate all */ if (argc == 0) { uint32 hnd = 0; - uint32 *phnd = &hnd; return rpccli_srvsvc_NetShareEnum(pipe_hnd, mem_ctx, NULL, &level, ctr, 0xffffffff, - numentries, &phnd); + numentries, &hnd); } /* request just one share */ @@ -3330,7 +3329,7 @@ static NTSTATUS rpc_share_migrate_shares_internals(const DOM_SID *domain_sid, for (i = 0; i < numentries; i++) { - uint32 *pparm_error = NULL; + uint32 parm_error = 0; union srvsvc_NetShareInfo info; /* reset error-code */ @@ -3351,7 +3350,7 @@ static NTSTATUS rpc_share_migrate_shares_internals(const DOM_SID *domain_sid, info.info502 = &ctr_src.ctr502->array[i]; result = rpccli_srvsvc_NetShareAdd(srvsvc_pipe, mem_ctx, NULL, - 502, info, &pparm_error); + 502, info, &parm_error); if (NT_STATUS_EQUAL(result, NT_STATUS_OBJECT_NAME_COLLISION)) { printf(" [%s] does already exist\n", ctr_src.ctr502->array[i].name); @@ -3726,7 +3725,7 @@ static NTSTATUS rpc_share_migrate_security_internals(const DOM_SID *domain_sid, struct cli_state *cli_dst = NULL; uint32 level = 502; /* includes secdesc */ uint32 numentries; - uint32 *parm_error = NULL; + uint32 parm_error = 0; result = get_share_info(pipe_hnd, mem_ctx, level, argc, argv, &ctr_src, &numentries); @@ -4693,7 +4692,7 @@ static NTSTATUS rpc_sh_share_add(TALLOC_CTX *mem_ctx, union srvsvc_NetShareInfo info; struct srvsvc_NetShareInfo2 info2; NTSTATUS result; - uint32 *parm_error = NULL; + uint32 parm_error = 0; if ((argc < 2) || (argc > 3)) { d_fprintf(stderr, "usage: %s [comment]\n", @@ -4875,7 +4874,6 @@ static NTSTATUS rpc_file_list_internals(const DOM_SID *domain_sid, union srvsvc_NetFileCtr ctr; NTSTATUS result; uint32 hnd; - uint32 *phnd = &hnd; uint32 preferred_len = 0xffffffff, i; const char *username=NULL; uint32 level = 3; @@ -4889,7 +4887,7 @@ static NTSTATUS rpc_file_list_internals(const DOM_SID *domain_sid, result = rpccli_srvsvc_NetFileEnum(pipe_hnd, mem_ctx, NULL, NULL, username, &level, &ctr, - preferred_len, &numentries, &phnd); + preferred_len, &numentries, &hnd); if (!NT_STATUS_IS_OK(result)) goto done; diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c index e63471f176..0a3ceb2233 100644 --- a/source3/utils/net_rpc_registry.c +++ b/source3/utils/net_rpc_registry.c @@ -139,10 +139,8 @@ static NTSTATUS registry_enumkeys(TALLOC_CTX *ctx, for (i=0; iname && - (!(classes[i] = talloc_strdup(classes, - pclass_buf->name)))) { + if (class_buf.name && + (!(classes[i] = talloc_strdup(classes, class_buf.name)))) { status = NT_STATUS_NO_MEMORY; goto error; } @@ -181,9 +178,8 @@ static NTSTATUS registry_enumkeys(TALLOC_CTX *ctx, goto error; } - if ((pmodtime) && - (!(modtimes[i] = (NTTIME *)talloc_memdup( - modtimes, pmodtime, sizeof(*pmodtime))))) { + if ((!(modtimes[i] = (NTTIME *)talloc_memdup( + modtimes, &modtime, sizeof(modtime))))) { status = NT_STATUS_NO_MEMORY; goto error; } @@ -254,15 +250,9 @@ static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx, for (i=0; i