summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorRafal Szczesniak <mimir@samba.org>2005-12-06 11:11:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:07 -0500
commitb38783f40acc2c974219626d42c18355708d1476 (patch)
tree7b81c09003a19e8711c222e9f9bc93a1f2278a84 /source4/librpc
parentd1c41cb83fd1e159c2aee844fa6d5f8fe388198f (diff)
downloadsamba-b38783f40acc2c974219626d42c18355708d1476.tar.gz
samba-b38783f40acc2c974219626d42c18355708d1476.tar.bz2
samba-b38783f40acc2c974219626d42c18355708d1476.zip
r12089: Couple of fixes in cases of memory outage before we sort
out how and when to use composite_error() and composite_trigger_error(). Spotted by Metze. rafal (This used to be commit 218db3ebc06f2d3e906f23a36bad088861b8e720)
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/rpc/dcerpc_connect.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/source4/librpc/rpc/dcerpc_connect.c b/source4/librpc/rpc/dcerpc_connect.c
index 26f6286b49..d98c296a3f 100644
--- a/source4/librpc/rpc/dcerpc_connect.c
+++ b/source4/librpc/rpc/dcerpc_connect.c
@@ -54,7 +54,7 @@ void continue_pipe_open_smb(struct composite_context *ctx)
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(0,("Failed to open pipe %s - %s\n", s->io.pipe_name, nt_errstr(c->status)));
- composite_trigger_error(c);
+ composite_error(c, c->status);
return;
}
@@ -74,7 +74,7 @@ void continue_smb_connect(struct composite_context *ctx)
if (!NT_STATUS_IS_OK(c->status)) {
DEBUG(0,("Failed to connect to %s - %s\n", s->io.binding->host, nt_errstr(c->status)));
- composite_trigger_error(c);
+ composite_error(c, c->status);
return;
}
@@ -82,6 +82,10 @@ void continue_smb_connect(struct composite_context *ctx)
s->io.pipe_name = s->io.binding->endpoint;
open_ctx = dcerpc_pipe_open_smb_send(s->io.pipe->conn, s->tree, s->io.pipe_name);
+ if (open_ctx == NULL) {
+ composite_error(c, NT_STATUS_NO_MEMORY);
+ return;
+ }
composite_continue(c, open_ctx, continue_pipe_open_smb, c);
}
@@ -102,8 +106,8 @@ struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CTX *tmp_
s = talloc_zero(c, struct pipe_np_smb_state);
if (s == NULL) {
- c->status = NT_STATUS_NO_MEMORY;
- goto failed;
+ composite_error(c, NT_STATUS_NO_MEMORY);
+ goto done;
}
c->state = COMPOSITE_STATE_IN_PROGRESS;
@@ -122,9 +126,13 @@ struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CTX *tmp_
conn->in.workgroup = lp_workgroup();
if (s->io.binding->flags & DCERPC_SCHANNEL) {
- struct cli_credentials *anon_creds
- = cli_credentials_init(tmp_ctx);
- if (composite_nomem(anon_creds, c)) return NULL;
+ struct cli_credentials *anon_creds;
+
+ anon_creds = cli_credentials_init(tmp_ctx);
+ if (!anon_creds) {
+ composite_error(c, NT_STATUS_NO_MEMORY);
+ goto done;
+ }
cli_credentials_set_anonymous(anon_creds);
cli_credentials_guess(anon_creds);
@@ -136,14 +144,15 @@ struct composite_context *dcerpc_pipe_connect_ncacn_np_smb_send(TALLOC_CTX *tmp_
}
conn_req = smb_composite_connect_send(conn, s->io.pipe->conn, s->io.pipe->conn->event_ctx);
+ if (!conn_req) {
+ composite_error(c, NT_STATUS_NO_MEMORY);
+ goto done;
+ }
composite_continue(c, conn_req, continue_smb_connect, c);
-
- return c;
-failed:
- composite_trigger_error(c);
- return NULL;
+done:
+ return c;
}