ndr: change NTSTAUS into enum ndr_err_code (samba3 callers)
authorStefan Metzmacher <metze@samba.org>
Fri, 9 Nov 2007 13:39:45 +0000 (14:39 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 9 Nov 2007 20:23:16 +0000 (21:23 +0100)
lib/messages_local.c
rpc_client/ndr.c
smbd/notify_internal.c
utils/net_rpc_registry.c

metze
(This used to be commit c2645d2164c05976a98bafed980b6029baf89977)

source3/lib/messages_local.c
source3/rpc_client/ndr.c
source3/smbd/notify_internal.c
source3/utils/net_rpc_registry.c

index db098f27445844c57325f4a85cd045fc9b9fe85c..5f7c46f61e6dd6f87530de76760c00fea723618b 100644 (file)
@@ -142,7 +142,7 @@ static NTSTATUS messaging_tdb_fetch(TDB_CONTEXT *msg_tdb,
        struct messaging_array *result;
        TDB_DATA data;
        DATA_BLOB blob;
-       NTSTATUS status;
+       enum ndr_err_code ndr_err;
 
        if (!(result = TALLOC_ZERO_P(mem_ctx, struct messaging_array))) {
                return NT_STATUS_NO_MEMORY;
@@ -157,15 +157,15 @@ static NTSTATUS messaging_tdb_fetch(TDB_CONTEXT *msg_tdb,
 
        blob = data_blob_const(data.dptr, data.dsize);
 
-       status = ndr_pull_struct_blob(
+       ndr_err = ndr_pull_struct_blob(
                &blob, result, result,
                (ndr_pull_flags_fn_t)ndr_pull_messaging_array);
 
        SAFE_FREE(data.dptr);
 
-       if (!NT_STATUS_IS_OK(status)) {
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                TALLOC_FREE(result);
-               return status;
+               return ndr_map_error2ntstatus(ndr_err);
        }
 
        if (DEBUGLEVEL >= 10) {
@@ -187,7 +187,7 @@ static NTSTATUS messaging_tdb_store(TDB_CONTEXT *msg_tdb,
 {
        TDB_DATA data;
        DATA_BLOB blob;
-       NTSTATUS status;
+       enum ndr_err_code ndr_err;
        TALLOC_CTX *mem_ctx;
        int ret;
 
@@ -200,13 +200,13 @@ static NTSTATUS messaging_tdb_store(TDB_CONTEXT *msg_tdb,
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = ndr_push_struct_blob(
+       ndr_err = ndr_push_struct_blob(
                &blob, mem_ctx, array,
                (ndr_push_flags_fn_t)ndr_push_messaging_array);
 
-       if (!NT_STATUS_IS_OK(status)) {
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(mem_ctx);
-               return status;
+               return ndr_map_error2ntstatus(ndr_err);
        }
 
        if (DEBUGLEVEL >= 10) {
index c7044aa7d9da7ef166dd970ea3c0e851c57b170b..a64ead809a0f3306f58b7e71694350b3a7165496 100644 (file)
@@ -33,6 +33,7 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
        DATA_BLOB blob;
        struct ndr_push *push;
        NTSTATUS status;
+       enum ndr_err_code ndr_err;
 
        SMB_ASSERT(cli->pipe_idx == p_idx);
        SMB_ASSERT(table->num_calls > opnum);
@@ -44,9 +45,9 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = call->ndr_push(push, NDR_IN, r);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
+       ndr_err = call->ndr_push(push, NDR_IN, r);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               return ndr_map_error2ntstatus(ndr_err);
        }
 
        blob = ndr_push_blob(push);
@@ -85,11 +86,11 @@ NTSTATUS cli_do_rpc_ndr(struct rpc_pipe_client *cli,
 
        /* have the ndr parser alloc memory for us */
        pull->flags |= LIBNDR_FLAG_REF_ALLOC;
-       status = call->ndr_pull(pull, NDR_OUT, r);
+       ndr_err = call->ndr_pull(pull, NDR_OUT, r);
        talloc_free(pull);
 
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               return ndr_map_error2ntstatus(ndr_err);
        }
 
        return NT_STATUS_OK;
index 2a2afe376bf3e6f8dbea1291bbbe7d3b2a2b968a..84b8e1098e77b5aa2efe7c5d23b5c9ef2aa3633b 100644 (file)
@@ -165,8 +165,12 @@ static NTSTATUS notify_load(struct notify_context *notify, struct db_record *rec
 
        status = NT_STATUS_OK;
        if (blob.length > 0) {
-               status = ndr_pull_struct_blob(&blob, notify->array, notify->array, 
-                                             (ndr_pull_flags_fn_t)ndr_pull_notify_array);
+               enum ndr_err_code ndr_err;
+               ndr_err = ndr_pull_struct_blob(&blob, notify->array, notify->array,
+                                              (ndr_pull_flags_fn_t)ndr_pull_notify_array);
+               if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+                       status = ndr_map_error2ntstatus(ndr_err);
+               }
        }
 
        if (DEBUGLEVEL >= 10) {
@@ -199,6 +203,7 @@ static NTSTATUS notify_save(struct notify_context *notify, struct db_record *rec
        TDB_DATA dbuf;
        DATA_BLOB blob;
        NTSTATUS status;
+       enum ndr_err_code ndr_err;
        TALLOC_CTX *tmp_ctx;
 
        /* if possible, remove some depth arrays */
@@ -215,11 +220,11 @@ static NTSTATUS notify_save(struct notify_context *notify, struct db_record *rec
        tmp_ctx = talloc_new(notify);
        NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
 
-       status = ndr_push_struct_blob(&blob, tmp_ctx, notify->array, 
+       ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, notify->array,
                                      (ndr_push_flags_fn_t)ndr_push_notify_array);
-       if (!NT_STATUS_IS_OK(status)) {
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(tmp_ctx);
-               return status;
+               return ndr_map_error2ntstatus(ndr_err);
        }
 
        if (DEBUGLEVEL >= 10) {
@@ -244,7 +249,7 @@ static void notify_handler(struct messaging_context *msg_ctx, void *private_data
                           uint32_t msg_type, struct server_id server_id, DATA_BLOB *data)
 {
        struct notify_context *notify = talloc_get_type(private_data, struct notify_context);
-       NTSTATUS status;
+       enum ndr_err_code ndr_err;
        struct notify_event ev;
        TALLOC_CTX *tmp_ctx = talloc_new(notify);
        struct notify_list *listel;
@@ -253,9 +258,9 @@ static void notify_handler(struct messaging_context *msg_ctx, void *private_data
                return;
        }
 
-       status = ndr_pull_struct_blob(data, tmp_ctx, &ev, 
-                                     (ndr_pull_flags_fn_t)ndr_pull_notify_event);
-       if (!NT_STATUS_IS_OK(status)) {
+       ndr_err = ndr_pull_struct_blob(data, tmp_ctx, &ev,
+                                      (ndr_pull_flags_fn_t)ndr_pull_notify_event);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(tmp_ctx);
                return;
        }
@@ -547,6 +552,7 @@ static NTSTATUS notify_send(struct notify_context *notify, struct notify_entry *
        struct notify_event ev;
        DATA_BLOB data;
        NTSTATUS status;
+       enum ndr_err_code ndr_err;
        TALLOC_CTX *tmp_ctx;
 
        ev.action = action;
@@ -555,11 +561,11 @@ static NTSTATUS notify_send(struct notify_context *notify, struct notify_entry *
 
        tmp_ctx = talloc_new(notify);
 
-       status = ndr_push_struct_blob(&data, tmp_ctx, &ev, 
-                                     (ndr_push_flags_fn_t)ndr_push_notify_event);
-       if (!NT_STATUS_IS_OK(status)) {
+       ndr_err = ndr_push_struct_blob(&data, tmp_ctx, &ev,
+                                      (ndr_push_flags_fn_t)ndr_push_notify_event);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                talloc_free(tmp_ctx);
-               return status;
+               return ndr_map_error2ntstatus(ndr_err);
        }
 
        status = messaging_send(notify->messaging_ctx, e->server, 
index e1d65fb06b0916d6df6c75b54f2d9a70e19ebfbd..c2b9aced69f696141db267648cd787b1a9990516 100644 (file)
@@ -986,6 +986,7 @@ static NTSTATUS rpc_registry_getsd_internal(const DOM_SID *domain_sid,
 {
        POLICY_HND pol_hive, pol_key;
        NTSTATUS status;
+       enum ndr_err_code ndr_err;
        struct KeySecurityData *sd = NULL;
        uint32_t sec_info;
        DATA_BLOB blob;
@@ -1033,11 +1034,13 @@ static NTSTATUS rpc_registry_getsd_internal(const DOM_SID *domain_sid,
        blob.data = sd->data;
        blob.length = sd->size;
 
-       status = ndr_pull_struct_blob(&blob, mem_ctx, &sec_desc,
-                                     (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
-       if (!NT_STATUS_IS_OK(status)) {
+       ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &sec_desc,
+                                      (ndr_pull_flags_fn_t)ndr_pull_security_descriptor);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               status = ndr_map_error2ntstatus(ndr_err);
                goto out;
        }
+       status = NT_STATUS_OK;
 
        display_sec_desc(&sec_desc);