diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-01-16 15:42:03 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:17:11 -0500 |
commit | 62e11c4f1748d98f479110c8c0e656a8f65dca4d (patch) | |
tree | 24dcb7a044c18fe88f7db18540a0062a3da00200 /source3/utils | |
parent | 58efeafa7d0e56766a06e75f473cebb420fe18c3 (diff) | |
download | samba-62e11c4f1748d98f479110c8c0e656a8f65dca4d.tar.gz samba-62e11c4f1748d98f479110c8c0e656a8f65dca4d.tar.bz2 samba-62e11c4f1748d98f479110c8c0e656a8f65dca4d.zip |
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)
Diffstat (limited to 'source3/utils')
-rw-r--r-- | source3/utils/net_rpc.c | 18 | ||||
-rw-r--r-- | source3/utils/net_rpc_registry.c | 45 | ||||
-rw-r--r-- | source3/utils/smbtree.c | 3 |
3 files changed, 24 insertions, 42 deletions
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 <share> <path> [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; i<num_subkeys; i++) { char c, n; struct winreg_StringBuf class_buf; - struct winreg_StringBuf *pclass_buf = &class_buf; struct winreg_StringBuf name_buf; NTTIME modtime; - NTTIME *pmodtime = &modtime; c = '\0'; class_buf.name = &c; @@ -155,8 +153,8 @@ static NTSTATUS registry_enumkeys(TALLOC_CTX *ctx, ZERO_STRUCT(modtime); status = rpccli_winreg_EnumKey(pipe_hnd, mem_ctx, key_hnd, - i, &name_buf, &pclass_buf, - &pmodtime); + i, &name_buf, &class_buf, + &modtime); if (W_ERROR_EQUAL(ntstatus_to_werror(status), WERR_NO_MORE_ITEMS) ) { @@ -169,9 +167,8 @@ static NTSTATUS registry_enumkeys(TALLOC_CTX *ctx, classes[i] = NULL; - if (pclass_buf && pclass_buf->name && - (!(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<num_values; i++) { enum winreg_Type type = REG_NONE; - enum winreg_Type *ptype = &type; - uint8 d = 0; - uint8 *data = &d; - + uint8 *data = NULL; uint32 data_size; - uint32 *pdata_size = &data_size; - uint32 value_length; - uint32 *pvalue_length = &value_length; char n; struct winreg_ValNameBuf name_buf; @@ -276,9 +266,9 @@ static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx, value_length = 0; status = rpccli_winreg_EnumValue(pipe_hnd, mem_ctx, key_hnd, - i, &name_buf, &ptype, - &data, &pdata_size, - &pvalue_length ); + i, &name_buf, &type, + &data, &data_size, + &value_length ); if ( W_ERROR_EQUAL(ntstatus_to_werror(status), WERR_NO_MORE_ITEMS) ) { @@ -290,9 +280,7 @@ static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx, goto error; } - if ((name_buf.name == NULL) || (ptype == NULL) || - (data == NULL) || (pdata_size == 0) || - (pvalue_length == NULL)) { + if (name_buf.name == NULL) { status = NT_STATUS_INVALID_PARAMETER; goto error; } @@ -302,8 +290,8 @@ static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx, goto error; } - err = registry_pull_value(values, &values[i], *ptype, data, - *pdata_size, *pvalue_length); + err = registry_pull_value(values, &values[i], type, data, + data_size, value_length); if (!W_ERROR_IS_OK(err)) { status = werror_to_ntstatus(err); goto error; @@ -477,7 +465,6 @@ static NTSTATUS rpc_registry_createkey_internal(const DOM_SID *domain_sid, struct policy_handle hive_hnd, key_hnd; struct winreg_String key, keyclass; enum winreg_CreateAction action; - enum winreg_CreateAction *paction = &action; NTSTATUS status; if (!reg_hive_key(argv[0], &hive, &key.name)) { @@ -496,7 +483,7 @@ static NTSTATUS rpc_registry_createkey_internal(const DOM_SID *domain_sid, status = rpccli_winreg_CreateKey(pipe_hnd, mem_ctx, &hive_hnd, key, keyclass, 0, REG_KEY_READ, NULL, - &key_hnd, &paction); + &key_hnd, &action); if (!NT_STATUS_IS_OK(status)) { d_fprintf(stderr, "createkey returned %s\n", nt_errstr(status)); @@ -504,8 +491,7 @@ static NTSTATUS rpc_registry_createkey_internal(const DOM_SID *domain_sid, return status; } - if (paction) { - switch (*paction) { + switch (action) { case REG_ACTION_NONE: d_printf("createkey did nothing -- huh?\n"); break; @@ -515,7 +501,6 @@ static NTSTATUS rpc_registry_createkey_internal(const DOM_SID *domain_sid, case REG_OPENED_EXISTING_KEY: d_printf("createkey opened existing %s\n", argv[0]); break; - } } rpccli_winreg_CloseKey(pipe_hnd, mem_ctx, &key_hnd); diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c index e993e5dc41..31ed763565 100644 --- a/source3/utils/smbtree.c +++ b/source3/utils/smbtree.c @@ -135,7 +135,6 @@ static BOOL get_rpc_shares(struct cli_state *cli, struct rpc_pipe_client *pipe_hnd; TALLOC_CTX *mem_ctx; uint32 enum_hnd; - uint32 *penum_hnd = &enum_hnd; struct srvsvc_NetShareCtr1 ctr1; union srvsvc_NetShareCtr ctr; uint32 numentries; @@ -165,7 +164,7 @@ static BOOL get_rpc_shares(struct cli_state *cli, status = rpccli_srvsvc_NetShareEnum(pipe_hnd, mem_ctx, NULL, &info_level, &ctr, 0xffffffff, &numentries, - &penum_hnd); + &enum_hnd); if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(mem_ctx); |