summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-11-18 10:30:33 +0100
committerStefan Metzmacher <metze@samba.org>2011-11-24 19:02:30 +0100
commit1a0ce02a238fb0384b0a05783a0e277613dd0cb0 (patch)
tree92cc0199ed78c9f4e0036093b9075304e73a0876
parent4d8e1517798577d55479629d01826583a02aa43a (diff)
downloadsamba-1a0ce02a238fb0384b0a05783a0e277613dd0cb0.tar.gz
samba-1a0ce02a238fb0384b0a05783a0e277613dd0cb0.tar.bz2
samba-1a0ce02a238fb0384b0a05783a0e277613dd0cb0.zip
smbXcli: also notify chained requests about broken connections
metze
-rw-r--r--libcli/smb/smbXcli_base.c63
1 files changed, 49 insertions, 14 deletions
diff --git a/libcli/smb/smbXcli_base.c b/libcli/smb/smbXcli_base.c
index ae14ad7daa..c2e628c342 100644
--- a/libcli/smb/smbXcli_base.c
+++ b/libcli/smb/smbXcli_base.c
@@ -606,29 +606,64 @@ void smbXcli_conn_disconnect(struct smbXcli_conn *conn, NTSTATUS status)
while (talloc_array_length(conn->pending) > 0) {
struct tevent_req *req;
struct smbXcli_req_state *state;
+ struct tevent_req **chain;
+ size_t num_chained;
+ size_t i;
req = conn->pending[0];
state = tevent_req_data(req, struct smbXcli_req_state);
- /*
- * We're dead. No point waiting for trans2
- * replies.
- */
- state->smb1.mid = 0;
+ if (state->smb1.chained_requests == NULL) {
+ /*
+ * We're dead. No point waiting for trans2
+ * replies.
+ */
+ state->smb1.mid = 0;
- smbXcli_req_unset_pending(req);
+ smbXcli_req_unset_pending(req);
- if (NT_STATUS_IS_OK(status)) {
- /* do not notify the callers */
+ if (NT_STATUS_IS_OK(status)) {
+ /* do not notify the callers */
+ continue;
+ }
+
+ /*
+ * we need to defer the callback, because we may notify
+ * more then one caller.
+ */
+ tevent_req_defer_callback(req, state->ev);
+ tevent_req_nterror(req, status);
continue;
}
- /*
- * we need to defer the callback, because we may notify more
- * then one caller.
- */
- tevent_req_defer_callback(req, state->ev);
- tevent_req_nterror(req, status);
+ chain = talloc_move(conn, &state->smb1.chained_requests);
+ num_chained = talloc_array_length(chain);
+
+ for (i=0; i<num_chained; i++) {
+ req = chain[i];
+ state = tevent_req_data(req, struct smbXcli_req_state);
+
+ /*
+ * We're dead. No point waiting for trans2
+ * replies.
+ */
+ state->smb1.mid = 0;
+
+ smbXcli_req_unset_pending(req);
+
+ if (NT_STATUS_IS_OK(status)) {
+ /* do not notify the callers */
+ continue;
+ }
+
+ /*
+ * we need to defer the callback, because we may notify
+ * more then one caller.
+ */
+ tevent_req_defer_callback(req, state->ev);
+ tevent_req_nterror(req, status);
+ }
+ TALLOC_FREE(chain);
}
}