diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-11-09 19:24:51 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:45:02 +0100 |
commit | 529763a9aa192a6785ba878aceeb1683c2510913 (patch) | |
tree | 5fc843ffa644969ecd967d8b4133fc19333c33b5 /source4/lib | |
parent | b2ddeeb79d2622b3fd216465716dfa6b8c3e0b86 (diff) | |
download | samba-529763a9aa192a6785ba878aceeb1683c2510913.tar.gz samba-529763a9aa192a6785ba878aceeb1683c2510913.tar.bz2 samba-529763a9aa192a6785ba878aceeb1683c2510913.zip |
r25920: ndr: change NTSTAUS into enum ndr_err_code (samba4 callers)
lib/messaging/
lib/registry/
lib/ldb-samba/
librpc/rpc/
auth/auth_winbind.c
auth/gensec/
auth/kerberos/
dsdb/repl/
dsdb/samdb/
dsdb/schema/
torture/
cluster/ctdb/
kdc/
ntvfs/ipc/
torture/rap/
ntvfs/
utils/getntacl.c
ntptr/
smb_server/
libcli/wrepl/
wrepl_server/
libcli/cldap/
libcli/dgram/
libcli/ldap/
libcli/raw/
libcli/nbt/
libnet/
winbind/
rpc_server/
metze
(This used to be commit 6223c7fddc972687eb577e04fc1c8e0604c35435)
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb-samba/ldif_handlers.c | 48 | ||||
-rw-r--r-- | source4/lib/messaging/messaging.c | 42 | ||||
-rw-r--r-- | source4/lib/registry/regf.c | 4 |
3 files changed, 53 insertions, 41 deletions
diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c index 928a06ab43..13f9c19fb4 100644 --- a/source4/lib/ldb-samba/ldif_handlers.c +++ b/source4/lib/ldb-samba/ldif_handlers.c @@ -36,16 +36,16 @@ static int ldif_read_objectSid(struct ldb_context *ldb, void *mem_ctx, const struct ldb_val *in, struct ldb_val *out) { + enum ndr_err_code ndr_err; struct dom_sid *sid; - NTSTATUS status; sid = dom_sid_parse_talloc(mem_ctx, (const char *)in->data); if (sid == NULL) { return -1; } - status = ndr_push_struct_blob(out, mem_ctx, sid, - (ndr_push_flags_fn_t)ndr_push_dom_sid); + ndr_err = ndr_push_struct_blob(out, mem_ctx, sid, + (ndr_push_flags_fn_t)ndr_push_dom_sid); talloc_free(sid); - if (!NT_STATUS_IS_OK(status)) { + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return -1; } return 0; @@ -58,14 +58,15 @@ static int ldif_write_objectSid(struct ldb_context *ldb, void *mem_ctx, const struct ldb_val *in, struct ldb_val *out) { struct dom_sid *sid; - NTSTATUS status; + enum ndr_err_code ndr_err; + sid = talloc(mem_ctx, struct dom_sid); if (sid == NULL) { return -1; } - status = ndr_pull_struct_blob(in, sid, sid, - (ndr_pull_flags_fn_t)ndr_pull_dom_sid); - if (!NT_STATUS_IS_OK(status)) { + ndr_err = ndr_pull_struct_blob(in, sid, sid, + (ndr_pull_flags_fn_t)ndr_pull_dom_sid); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(sid); return -1; } @@ -141,15 +142,16 @@ static int ldif_read_objectGUID(struct ldb_context *ldb, void *mem_ctx, { struct GUID guid; NTSTATUS status; + enum ndr_err_code ndr_err; status = GUID_from_string((const char *)in->data, &guid); if (!NT_STATUS_IS_OK(status)) { return -1; } - status = ndr_push_struct_blob(out, mem_ctx, &guid, - (ndr_push_flags_fn_t)ndr_push_GUID); - if (!NT_STATUS_IS_OK(status)) { + ndr_err = ndr_push_struct_blob(out, mem_ctx, &guid, + (ndr_push_flags_fn_t)ndr_push_GUID); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return -1; } return 0; @@ -162,10 +164,10 @@ static int ldif_write_objectGUID(struct ldb_context *ldb, void *mem_ctx, const struct ldb_val *in, struct ldb_val *out) { struct GUID guid; - NTSTATUS status; - status = ndr_pull_struct_blob(in, mem_ctx, &guid, - (ndr_pull_flags_fn_t)ndr_pull_GUID); - if (!NT_STATUS_IS_OK(status)) { + enum ndr_err_code ndr_err; + ndr_err = ndr_pull_struct_blob(in, mem_ctx, &guid, + (ndr_pull_flags_fn_t)ndr_pull_GUID); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return -1; } out->data = (uint8_t *)GUID_string(mem_ctx, &guid); @@ -246,16 +248,16 @@ static int ldif_read_ntSecurityDescriptor(struct ldb_context *ldb, void *mem_ctx const struct ldb_val *in, struct ldb_val *out) { struct security_descriptor *sd; - NTSTATUS status; + enum ndr_err_code ndr_err; sd = sddl_decode(mem_ctx, (const char *)in->data, NULL); if (sd == NULL) { return -1; } - status = ndr_push_struct_blob(out, mem_ctx, sd, - (ndr_push_flags_fn_t)ndr_push_security_descriptor); + ndr_err = ndr_push_struct_blob(out, mem_ctx, sd, + (ndr_push_flags_fn_t)ndr_push_security_descriptor); talloc_free(sd); - if (!NT_STATUS_IS_OK(status)) { + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { return -1; } return 0; @@ -268,15 +270,15 @@ static int ldif_write_ntSecurityDescriptor(struct ldb_context *ldb, void *mem_ct const struct ldb_val *in, struct ldb_val *out) { struct security_descriptor *sd; - NTSTATUS status; + enum ndr_err_code ndr_err; sd = talloc(mem_ctx, struct security_descriptor); if (sd == NULL) { return -1; } - status = ndr_pull_struct_blob(in, sd, sd, - (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); - if (!NT_STATUS_IS_OK(status)) { + ndr_err = ndr_pull_struct_blob(in, sd, sd, + (ndr_pull_flags_fn_t)ndr_pull_security_descriptor); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(sd); return -1; } diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 36cf9aa609..963dfe4f0c 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -666,16 +666,18 @@ NTSTATUS irpc_register(struct messaging_context *msg_ctx, static void irpc_handler_reply(struct messaging_context *msg_ctx, struct irpc_message *m) { struct irpc_request *irpc; + enum ndr_err_code ndr_err; irpc = (struct irpc_request *)idr_find(msg_ctx->idr, m->header.callid); if (irpc == NULL) return; /* parse the reply data */ - irpc->status = irpc->table->calls[irpc->callnum].ndr_pull(m->ndr, NDR_OUT, irpc->r); - if (NT_STATUS_IS_OK(irpc->status)) { + ndr_err = irpc->table->calls[irpc->callnum].ndr_pull(m->ndr, NDR_OUT, irpc->r); + if (NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { irpc->status = m->header.status; talloc_steal(irpc->mem_ctx, m); } else { + irpc->status = ndr_map_error2ntstatus(ndr_err); talloc_steal(irpc, m); } irpc->done = true; @@ -691,6 +693,7 @@ NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status) { struct ndr_push *push; DATA_BLOB packet; + enum ndr_err_code ndr_err; m->header.status = status; @@ -704,11 +707,17 @@ NTSTATUS irpc_send_reply(struct irpc_message *m, NTSTATUS status) m->header.flags |= IRPC_FLAG_REPLY; /* construct the packet */ - status = ndr_push_irpc_header(push, NDR_SCALARS|NDR_BUFFERS, &m->header); - if (!NT_STATUS_IS_OK(status)) goto failed; + ndr_err = ndr_push_irpc_header(push, NDR_SCALARS|NDR_BUFFERS, &m->header); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + status = ndr_map_error2ntstatus(ndr_err); + goto failed; + } - status = m->irpc->table->calls[m->irpc->callnum].ndr_push(push, NDR_OUT, m->data); - if (!NT_STATUS_IS_OK(status)) goto failed; + ndr_err = m->irpc->table->calls[m->irpc->callnum].ndr_push(push, NDR_OUT, m->data); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + status = ndr_map_error2ntstatus(ndr_err); + goto failed; + } /* send the reply message */ packet = ndr_push_blob(push); @@ -728,7 +737,7 @@ static void irpc_handler_request(struct messaging_context *msg_ctx, { struct irpc_list *i; void *r; - NTSTATUS status; + enum ndr_err_code ndr_err; for (i=msg_ctx->irpc; i; i=i->next) { if (GUID_equal(&i->uuid, &m->header.uuid) && @@ -749,8 +758,8 @@ static void irpc_handler_request(struct messaging_context *msg_ctx, if (r == NULL) goto failed; /* parse the request data */ - status = i->table->calls[i->callnum].ndr_pull(m->ndr, NDR_IN, r); - if (!NT_STATUS_IS_OK(status)) goto failed; + ndr_err = i->table->calls[i->callnum].ndr_pull(m->ndr, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed; /* make the call */ m->private = i->private; @@ -782,7 +791,7 @@ static void irpc_handler(struct messaging_context *msg_ctx, void *private, uint32_t msg_type, struct server_id src, DATA_BLOB *packet) { struct irpc_message *m; - NTSTATUS status; + enum ndr_err_code ndr_err; m = talloc(msg_ctx, struct irpc_message); if (m == NULL) goto failed; @@ -794,8 +803,8 @@ static void irpc_handler(struct messaging_context *msg_ctx, void *private, m->ndr->flags |= LIBNDR_FLAG_REF_ALLOC; - status = ndr_pull_irpc_header(m->ndr, NDR_BUFFERS|NDR_SCALARS, &m->header); - if (!NT_STATUS_IS_OK(status)) goto failed; + ndr_err = ndr_pull_irpc_header(m->ndr, NDR_BUFFERS|NDR_SCALARS, &m->header); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed; if (m->header.flags & IRPC_FLAG_REPLY) { irpc_handler_reply(msg_ctx, m); @@ -853,6 +862,7 @@ struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, NTSTATUS status; DATA_BLOB packet; struct irpc_request *irpc; + enum ndr_err_code ndr_err; irpc = talloc(msg_ctx, struct irpc_request); if (irpc == NULL) goto failed; @@ -883,11 +893,11 @@ struct irpc_request *irpc_call_send(struct messaging_context *msg_ctx, ndr = ndr_push_init_ctx(irpc); if (ndr == NULL) goto failed; - status = ndr_push_irpc_header(ndr, NDR_SCALARS|NDR_BUFFERS, &header); - if (!NT_STATUS_IS_OK(status)) goto failed; + ndr_err = ndr_push_irpc_header(ndr, NDR_SCALARS|NDR_BUFFERS, &header); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed; - status = table->calls[callnum].ndr_push(ndr, NDR_IN, r); - if (!NT_STATUS_IS_OK(status)) goto failed; + ndr_err = table->calls[callnum].ndr_push(ndr, NDR_IN, r); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) goto failed; /* and send it */ packet = ndr_push_blob(ndr); diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index 2dd27ca33d..3ae299b3ef 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -1021,7 +1021,7 @@ static WERROR regf_set_sec_desc(struct hive_key *key, (tdr_pull_fn_t) tdr_pull_nk_block, &root); /* Push the security descriptor to a blob */ - if (NT_STATUS_IS_ERR(ndr_push_struct_blob(&data, regf, sec_desc, + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_push_struct_blob(&data, regf, sec_desc, (ndr_push_flags_fn_t)ndr_push_security_descriptor))) { DEBUG(0, ("Unable to push security descriptor\n")); return WERR_GENERAL_FAILURE; @@ -1174,7 +1174,7 @@ static WERROR regf_get_sec_desc(TALLOC_CTX *ctx, const struct hive_key *key, data.data = sk.sec_desc; data.length = sk.rec_size; - if (NT_STATUS_IS_ERR(ndr_pull_struct_blob(&data, ctx, *sd, + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_pull_struct_blob(&data, ctx, *sd, (ndr_pull_flags_fn_t)ndr_pull_security_descriptor))) { DEBUG(0, ("Error parsing security descriptor\n")); return WERR_GENERAL_FAILURE; |