[SCM] Samba Shared Repository - branch master updated
Andreas Schneider
asn at samba.org
Fri Jul 8 08:33:03 MDT 2011
The branch, master has been updated
via 2a02f1c winreg: Ensure server return status is set on success
via 127106620 winreg: Use the ntstatus return code for client side errors
from d6cd1ee s3:libsmb: remove unused cli->inbuf and cli->bufsize
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 2a02f1c4af00915c750e4b71c0beafe9fb765815
Author: David Disseldorp <ddiss at suse.de>
Date: Mon Jul 4 11:59:36 2011 +0200
winreg: Ensure server return status is set on success
Currently cli_winreg.c functions only set the returned server werror
status on failure, if the server request succeeds the value remains
uninitialised.
Signed-off-by: Andreas Schneider <asn at samba.org>
Autobuild-User: Andreas Schneider <asn at cryptomilk.org>
Autobuild-Date: Fri Jul 8 16:32:39 CEST 2011 on sn-devel-104
commit 12710662006594156abcaa94f5574e52bb66fdf6
Author: David Disseldorp <ddiss at suse.de>
Date: Wed Jul 6 12:19:05 2011 +0200
winreg: Use the ntstatus return code for client side errors
cli_winreg.c functions indicate status to the caller in two ways. The
ntstatus return code indicates client side errors, the pwerr argument
carries the server response error code.
Many functions are filling the pwerr argument on client side error, this
change removes these cases.
Signed-off-by: Andreas Schneider <asn at samba.org>
-----------------------------------------------------------------------
Summary of changes:
source3/rpc_client/cli_winreg.c | 171 ++++++++++++---------------------------
1 files changed, 51 insertions(+), 120 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/rpc_client/cli_winreg.c b/source3/rpc_client/cli_winreg.c
index e5ebc25..69982da 100644
--- a/source3/rpc_client/cli_winreg.c
+++ b/source3/rpc_client/cli_winreg.c
@@ -36,7 +36,6 @@ NTSTATUS dcerpc_winreg_query_dword(TALLOC_CTX *mem_ctx,
enum winreg_Type type = REG_NONE;
uint32_t value_len = 0;
uint32_t data_size = 0;
- WERROR result = WERR_OK;
NTSTATUS status;
DATA_BLOB blob;
@@ -50,29 +49,25 @@ NTSTATUS dcerpc_winreg_query_dword(TALLOC_CTX *mem_ctx,
NULL,
&data_size,
&value_len,
- &result);
+ pwerr);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
+ if (!W_ERROR_IS_OK(*pwerr)) {
return status;
}
if (type != REG_DWORD) {
- *pwerr = WERR_INVALID_DATATYPE;
- return status;
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
}
if (data_size != 4) {
- *pwerr = WERR_INVALID_DATA;
- return status;
+ return NT_STATUS_INVALID_PARAMETER;
}
blob = data_blob_talloc_zero(mem_ctx, data_size);
if (blob.data == NULL) {
- *pwerr = WERR_NOMEM;
- return status;
+ return NT_STATUS_NO_MEMORY;
}
value_len = 0;
@@ -84,12 +79,11 @@ NTSTATUS dcerpc_winreg_query_dword(TALLOC_CTX *mem_ctx,
blob.data,
&data_size,
&value_len,
- &result);
+ pwerr);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
+ if (!W_ERROR_IS_OK(*pwerr)) {
return status;
}
@@ -109,7 +103,6 @@ NTSTATUS dcerpc_winreg_query_binary(TALLOC_CTX *mem_ctx,
{
struct winreg_String wvalue;
enum winreg_Type type = REG_NONE;
- WERROR result = WERR_OK;
uint32_t value_len = 0;
uint32_t data_size = 0;
NTSTATUS status;
@@ -126,24 +119,21 @@ NTSTATUS dcerpc_winreg_query_binary(TALLOC_CTX *mem_ctx,
NULL,
&data_size,
&value_len,
- &result);
+ pwerr);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
+ if (!W_ERROR_IS_OK(*pwerr)) {
return status;
}
if (type != REG_BINARY) {
- *pwerr = WERR_INVALID_DATATYPE;
- return status;
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
}
blob = data_blob_talloc_zero(mem_ctx, data_size);
if (blob.data == NULL) {
- *pwerr = WERR_NOMEM;
- return status;
+ return NT_STATUS_NO_MEMORY;
}
value_len = 0;
@@ -155,12 +145,11 @@ NTSTATUS dcerpc_winreg_query_binary(TALLOC_CTX *mem_ctx,
blob.data,
&data_size,
&value_len,
- &result);
+ pwerr);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
+ if (!W_ERROR_IS_OK(*pwerr)) {
return status;
}
@@ -181,7 +170,6 @@ NTSTATUS dcerpc_winreg_query_multi_sz(TALLOC_CTX *mem_ctx,
{
struct winreg_String wvalue;
enum winreg_Type type = REG_NONE;
- WERROR result = WERR_OK;
uint32_t value_len = 0;
uint32_t data_size = 0;
NTSTATUS status;
@@ -197,24 +185,21 @@ NTSTATUS dcerpc_winreg_query_multi_sz(TALLOC_CTX *mem_ctx,
NULL,
&data_size,
&value_len,
- &result);
+ pwerr);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
+ if (!W_ERROR_IS_OK(*pwerr)) {
return status;
}
if (type != REG_MULTI_SZ) {
- *pwerr = WERR_INVALID_DATATYPE;
- return status;
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
}
blob = data_blob_talloc_zero(mem_ctx, data_size);
if (blob.data == NULL) {
- *pwerr = WERR_NOMEM;
- return status;
+ return NT_STATUS_NO_MEMORY;
}
value_len = 0;
@@ -226,12 +211,11 @@ NTSTATUS dcerpc_winreg_query_multi_sz(TALLOC_CTX *mem_ctx,
blob.data,
&data_size,
&value_len,
- &result);
+ pwerr);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
+ if (!W_ERROR_IS_OK(*pwerr)) {
return status;
}
@@ -240,7 +224,7 @@ NTSTATUS dcerpc_winreg_query_multi_sz(TALLOC_CTX *mem_ctx,
ok = pull_reg_multi_sz(mem_ctx, &blob, data);
if (!ok) {
- *pwerr = WERR_NOMEM;
+ status = NT_STATUS_NO_MEMORY;
}
}
@@ -256,7 +240,6 @@ NTSTATUS dcerpc_winreg_query_sz(TALLOC_CTX *mem_ctx,
{
struct winreg_String wvalue;
enum winreg_Type type = REG_NONE;
- WERROR result = WERR_OK;
uint32_t value_len = 0;
uint32_t data_size = 0;
NTSTATUS status;
@@ -272,24 +255,21 @@ NTSTATUS dcerpc_winreg_query_sz(TALLOC_CTX *mem_ctx,
NULL,
&data_size,
&value_len,
- &result);
+ pwerr);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
+ if (!W_ERROR_IS_OK(*pwerr)) {
return status;
}
if (type != REG_SZ) {
- *pwerr = WERR_INVALID_DATATYPE;
- return status;
+ return NT_STATUS_OBJECT_TYPE_MISMATCH;
}
blob = data_blob_talloc_zero(mem_ctx, data_size);
if (blob.data == NULL) {
- *pwerr = WERR_NOMEM;
- return status;
+ return NT_STATUS_NO_MEMORY;
}
value_len = 0;
@@ -301,12 +281,11 @@ NTSTATUS dcerpc_winreg_query_sz(TALLOC_CTX *mem_ctx,
blob.data,
&data_size,
&value_len,
- &result);
+ pwerr);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
+ if (!W_ERROR_IS_OK(*pwerr)) {
return status;
}
@@ -315,7 +294,7 @@ NTSTATUS dcerpc_winreg_query_sz(TALLOC_CTX *mem_ctx,
ok = pull_reg_sz(mem_ctx, &blob, data);
if (!ok) {
- *pwerr = WERR_NOMEM;
+ status = NT_STATUS_NO_MEMORY;
}
}
@@ -329,7 +308,6 @@ NTSTATUS dcerpc_winreg_query_sd(TALLOC_CTX *mem_ctx,
struct security_descriptor **data,
WERROR *pwerr)
{
- WERROR result = WERR_OK;
NTSTATUS status;
DATA_BLOB blob;
@@ -338,12 +316,11 @@ NTSTATUS dcerpc_winreg_query_sd(TALLOC_CTX *mem_ctx,
key_handle,
value,
&blob,
- &result);
+ pwerr);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
+ if (!W_ERROR_IS_OK(*pwerr)) {
return status;
}
@@ -353,8 +330,7 @@ NTSTATUS dcerpc_winreg_query_sd(TALLOC_CTX *mem_ctx,
sd = talloc_zero(mem_ctx, struct security_descriptor);
if (sd == NULL) {
- *pwerr = WERR_NOMEM;
- return NT_STATUS_OK;
+ return NT_STATUS_NO_MEMORY;
}
ndr_err = ndr_pull_struct_blob(&blob,
@@ -364,8 +340,7 @@ NTSTATUS dcerpc_winreg_query_sd(TALLOC_CTX *mem_ctx,
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
DEBUG(2, ("dcerpc_winreg_query_sd: Failed to marshall "
"security descriptor\n"));
- *pwerr = WERR_NOMEM;
- return NT_STATUS_OK;
+ return NT_STATUS_NO_MEMORY;
}
*data = sd;
@@ -383,7 +358,6 @@ NTSTATUS dcerpc_winreg_set_dword(TALLOC_CTX *mem_ctx,
{
struct winreg_String wvalue;
DATA_BLOB blob;
- WERROR result = WERR_OK;
NTSTATUS status;
ZERO_STRUCT(wvalue);
@@ -398,13 +372,7 @@ NTSTATUS dcerpc_winreg_set_dword(TALLOC_CTX *mem_ctx,
REG_DWORD,
blob.data,
blob.length,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
- }
+ pwerr);
return status;
}
@@ -418,7 +386,6 @@ NTSTATUS dcerpc_winreg_set_sz(TALLOC_CTX *mem_ctx,
{
struct winreg_String wvalue = { 0, };
DATA_BLOB blob;
- WERROR result = WERR_OK;
NTSTATUS status;
wvalue.name = value;
@@ -429,8 +396,7 @@ NTSTATUS dcerpc_winreg_set_sz(TALLOC_CTX *mem_ctx,
DEBUG(2, ("dcerpc_winreg_set_sz: Could not marshall "
"string %s for %s\n",
data, wvalue.name));
- *pwerr = WERR_NOMEM;
- return NT_STATUS_OK;
+ return NT_STATUS_NO_MEMORY;
}
}
@@ -441,13 +407,7 @@ NTSTATUS dcerpc_winreg_set_sz(TALLOC_CTX *mem_ctx,
REG_SZ,
blob.data,
blob.length,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
- }
+ pwerr);
return status;
}
@@ -461,7 +421,6 @@ NTSTATUS dcerpc_winreg_set_expand_sz(TALLOC_CTX *mem_ctx,
{
struct winreg_String wvalue = { 0, };
DATA_BLOB blob;
- WERROR result = WERR_OK;
NTSTATUS status;
wvalue.name = value;
@@ -472,8 +431,7 @@ NTSTATUS dcerpc_winreg_set_expand_sz(TALLOC_CTX *mem_ctx,
DEBUG(2, ("dcerpc_winreg_set_expand_sz: Could not marshall "
"string %s for %s\n",
data, wvalue.name));
- *pwerr = WERR_NOMEM;
- return NT_STATUS_OK;
+ return NT_STATUS_NO_MEMORY;
}
}
@@ -484,13 +442,7 @@ NTSTATUS dcerpc_winreg_set_expand_sz(TALLOC_CTX *mem_ctx,
REG_EXPAND_SZ,
blob.data,
blob.length,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
- }
+ pwerr);
return status;
}
@@ -504,7 +456,6 @@ NTSTATUS dcerpc_winreg_set_multi_sz(TALLOC_CTX *mem_ctx,
{
struct winreg_String wvalue = { 0, };
DATA_BLOB blob;
- WERROR result = WERR_OK;
NTSTATUS status;
wvalue.name = value;
@@ -512,8 +463,7 @@ NTSTATUS dcerpc_winreg_set_multi_sz(TALLOC_CTX *mem_ctx,
DEBUG(2, ("dcerpc_winreg_set_multi_sz: Could not marshall "
"string multi sz for %s\n",
wvalue.name));
- *pwerr = WERR_NOMEM;
- return NT_STATUS_OK;
+ return NT_STATUS_NO_MEMORY;
}
status = dcerpc_winreg_SetValue(h,
@@ -523,13 +473,7 @@ NTSTATUS dcerpc_winreg_set_multi_sz(TALLOC_CTX *mem_ctx,
REG_MULTI_SZ,
blob.data,
blob.length,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
- }
+ pwerr);
return status;
}
@@ -542,7 +486,6 @@ NTSTATUS dcerpc_winreg_set_binary(TALLOC_CTX *mem_ctx,
WERROR *pwerr)
{
struct winreg_String wvalue = { 0, };
- WERROR result = WERR_OK;
NTSTATUS status;
wvalue.name = value;
@@ -554,13 +497,7 @@ NTSTATUS dcerpc_winreg_set_binary(TALLOC_CTX *mem_ctx,
REG_BINARY,
data->data,
data->length,
- &result);
- if (!NT_STATUS_IS_OK(status)) {
- return status;
- }
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
- }
+ pwerr);
return status;
}
@@ -582,8 +519,7 @@ NTSTATUS dcerpc_winreg_set_sd(TALLOC_CTX *mem_ctx,
if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
DEBUG(2, ("dcerpc_winreg_set_sd: Failed to marshall security "
"descriptor\n"));
- *pwerr = WERR_NOMEM;
- return NT_STATUS_OK;
+ return NT_STATUS_NO_MEMORY;
}
return dcerpc_winreg_set_binary(mem_ctx,
@@ -604,7 +540,6 @@ NTSTATUS dcerpc_winreg_add_multi_sz(TALLOC_CTX *mem_ctx,
const char **a = NULL;
const char **p;
uint32_t i;
- WERROR result = WERR_OK;
NTSTATUS status;
status = dcerpc_winreg_query_multi_sz(mem_ctx,
@@ -612,15 +547,14 @@ NTSTATUS dcerpc_winreg_add_multi_sz(TALLOC_CTX *mem_ctx,
key_handle,
value,
&a,
- &result);
+ pwerr);
/* count the elements */
for (p = a, i = 0; p && *p; p++, i++);
p = talloc_realloc(mem_ctx, a, const char *, i + 2);
if (p == NULL) {
- *pwerr = WERR_NOMEM;
- return NT_STATUS_OK;
+ return NT_STATUS_NO_MEMORY;
}
p[i] = data;
@@ -650,7 +584,6 @@ NTSTATUS dcerpc_winreg_enum_keys(TALLOC_CTX *mem_ctx,
NTTIME last_changed_time;
uint32_t secdescsize;
struct winreg_String classname;
- WERROR result = WERR_OK;
NTSTATUS status;
TALLOC_CTX *tmp_ctx;
@@ -673,25 +606,24 @@ NTSTATUS dcerpc_winreg_enum_keys(TALLOC_CTX *mem_ctx,
&max_valbufsize,
&secdescsize,
&last_changed_time,
- &result);
+ pwerr);
if (!NT_STATUS_IS_OK(status)) {
goto error;
}
- if (!W_ERROR_IS_OK(result)) {
- *pwerr = result;
+ if (!W_ERROR_IS_OK(*pwerr)) {
goto error;
}
subkeys = talloc_zero_array(tmp_ctx, const char *, num_subkeys + 2);
if (subkeys == NULL) {
- *pwerr = WERR_NOMEM;
+ status = NT_STATUS_NO_MEMORY;
goto error;
}
if (num_subkeys == 0) {
subkeys[0] = talloc_strdup(subkeys, "");
if (subkeys[0] == NULL) {
- *pwerr = WERR_NOMEM;
+ status = NT_STATUS_NO_MEMORY;
goto error;
}
*pnum_subkeys = 0;
@@ -728,21 +660,20 @@ NTSTATUS dcerpc_winreg_enum_keys(TALLOC_CTX *mem_ctx,
&name_buf,
--
Samba Shared Repository
More information about the samba-cvs
mailing list