diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-01-23 00:51:20 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:07 -0500 |
commit | 8eb0963c95bde4a8226f5d02ee0d8b478cf2dcc4 (patch) | |
tree | c46970635b936853a56142f9288ba4d3c32080aa /source4/libcli/composite/savefile.c | |
parent | 8c504b22f096cbaa37e943a6497dc76f069f40de (diff) | |
download | samba-8eb0963c95bde4a8226f5d02ee0d8b478cf2dcc4.tar.gz samba-8eb0963c95bde4a8226f5d02ee0d8b478cf2dcc4.tar.bz2 samba-8eb0963c95bde4a8226f5d02ee0d8b478cf2dcc4.zip |
r4935: fixed a bug where "c->status = xxx_handler(x);" could write to c after
it is freed. The problem is that the handler might complete the
request, and called the c->async.fn() async handler. That handler
might free the request handle.
(This used to be commit c4faceadc74e0849f6197ccbec9952f6c94f6176)
Diffstat (limited to 'source4/libcli/composite/savefile.c')
-rw-r--r-- | source4/libcli/composite/savefile.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/source4/libcli/composite/savefile.c b/source4/libcli/composite/savefile.c index 29d26c7eba..c87ea178f9 100644 --- a/source4/libcli/composite/savefile.c +++ b/source4/libcli/composite/savefile.c @@ -186,24 +186,26 @@ static void savefile_handler(struct smbcli_request *req) { struct smbcli_composite *c = req->async.private; struct savefile_state *state = talloc_get_type(c->private, struct savefile_state); + NTSTATUS status; /* when this handler is called, the stage indicates what call has just finished */ switch (state->stage) { case SAVEFILE_OPEN: - c->status = savefile_open(c, state->io); + status = savefile_open(c, state->io); break; case SAVEFILE_WRITE: - c->status = savefile_write(c, state->io); + status = savefile_write(c, state->io); break; case SAVEFILE_CLOSE: - c->status = savefile_close(c, state->io); + status = savefile_close(c, state->io); break; } - if (!NT_STATUS_IS_OK(c->status)) { + if (!NT_STATUS_IS_OK(status)) { + c->status = status; c->state = SMBCLI_REQUEST_ERROR; if (c->async.fn) { c->async.fn(c); |