diff options
author | Simo Sorce <idra@samba.org> | 2011-03-24 11:49:27 -0400 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2011-03-24 20:43:49 +0100 |
commit | 72bd60b2fee20dc85c1cc88d5d4e2efdfb74b701 (patch) | |
tree | a1a2e9e80959ce106902061b0d4e5998f1bc6f1c | |
parent | edc26007bf50ce165b8f8dfba5e1c7f86f6918e6 (diff) | |
download | samba-72bd60b2fee20dc85c1cc88d5d4e2efdfb74b701.tar.gz samba-72bd60b2fee20dc85c1cc88d5d4e2efdfb74b701.tar.bz2 samba-72bd60b2fee20dc85c1cc88d5d4e2efdfb74b701.zip |
s3-epmapper: fix vars init and return errors
Properly initialize variables at each cycle.
Convert to the right error when returning EPMAPPER ones.
Autobuild-User: Simo Sorce <idra@samba.org>
Autobuild-Date: Thu Mar 24 20:43:49 CET 2011 on sn-devel-104
-rw-r--r-- | source3/rpc_server/epmapper/srv_epmapper.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/source3/rpc_server/epmapper/srv_epmapper.c b/source3/rpc_server/epmapper/srv_epmapper.c index b9ddd0583f..4fc8ecdeb8 100644 --- a/source3/rpc_server/epmapper/srv_epmapper.c +++ b/source3/rpc_server/epmapper/srv_epmapper.c @@ -287,6 +287,11 @@ error_status_t _epm_Insert(struct pipes_struct *p, error_status_t rc; NTSTATUS status; uint32_t i; + struct dcerpc_binding *b; + struct dcesrv_endpoint *ep; + struct dcesrv_iface_list *iflist; + struct dcesrv_iface *iface; + bool add_ep; /* If this is not a priviledged users, return */ if (p->transport != NCALRPC || @@ -303,19 +308,20 @@ error_status_t _epm_Insert(struct pipes_struct *p, r->in.num_ents)); for (i = 0; i < r->in.num_ents; i++) { - struct dcerpc_binding *b = NULL; - struct dcesrv_endpoint *ep; - struct dcesrv_iface_list *iflist; - struct dcesrv_iface *iface; - bool add_ep = false; + add_ep = false; + b = NULL; status = dcerpc_binding_from_tower(tmp_ctx, &r->in.entries[i].tower->tower, &b); - if (!NT_STATUS_IS_OK(status)) { + if (NT_STATUS_EQUAL(status, NT_STATUS_NO_MEMORY)) { rc = EPMAPPER_STATUS_NO_MEMORY; goto done; } + if (!NT_STATUS_IS_OK(status)) { + rc = EPMAPPER_STATUS_CANT_PERFORM_OP; + goto done; + } DEBUG(3, ("_epm_Insert: Adding transport %s for %s\n", derpc_transport_string_by_transport(b->transport), @@ -327,7 +333,7 @@ error_status_t _epm_Insert(struct pipes_struct *p, /* No entry found, create it */ ep = talloc_zero(NULL, struct dcesrv_endpoint); if (ep == NULL) { - rc = EPMAPPER_STATUS_CANT_PERFORM_OP; + rc = EPMAPPER_STATUS_NO_MEMORY; goto done; } add_ep = true; @@ -415,6 +421,10 @@ error_status_t _epm_Delete(struct pipes_struct *p, error_status_t rc; NTSTATUS status; uint32_t i; + struct dcerpc_binding *b; + struct dcesrv_endpoint *ep; + struct dcesrv_iface iface; + struct dcesrv_iface_list *iflist; DEBUG(3, ("_epm_Delete: Trying to delete %u entries.\n", r->in.num_ents)); @@ -431,10 +441,7 @@ error_status_t _epm_Delete(struct pipes_struct *p, } for (i = 0; i < r->in.num_ents; i++) { - struct dcerpc_binding *b = NULL; - struct dcesrv_endpoint *ep; - struct dcesrv_iface iface; - struct dcesrv_iface_list *iflist; + b = NULL; status = dcerpc_binding_from_tower(tmp_ctx, &r->in.entries[i].tower->tower, |