summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@sernet.de>2008-09-09 14:37:17 +0200
committerVolker Lendecke <vl@samba.org>2008-09-09 17:37:34 +0200
commit6ba8c105c541636ee79e20eb7c5547ed6d8117e2 (patch)
tree5c7742f58e858f6e591c3b9fa1ca7e2435175301 /source3
parent6344b8ec27809950810024956161e041d6e83753 (diff)
downloadsamba-6ba8c105c541636ee79e20eb7c5547ed6d8117e2.tar.gz
samba-6ba8c105c541636ee79e20eb7c5547ed6d8117e2.tar.bz2
samba-6ba8c105c541636ee79e20eb7c5547ed6d8117e2.zip
Add utility function cli_in_chain()
This gives a hint whether a function is called from within the middle of a chain. In particular the trans calls don't really like this. (This used to be commit 4252b32db5ef7483f2c5c52312b6e6dc68d1d687)
Diffstat (limited to 'source3')
-rw-r--r--source3/include/async_smb.h1
-rw-r--r--source3/libsmb/async_smb.c15
2 files changed, 16 insertions, 0 deletions
diff --git a/source3/include/async_smb.h b/source3/include/async_smb.h
index e9e10023e3..4e2061813f 100644
--- a/source3/include/async_smb.h
+++ b/source3/include/async_smb.h
@@ -124,6 +124,7 @@ struct async_req *cli_request_send(TALLOC_CTX *mem_ctx,
bool cli_chain_cork(struct cli_state *cli, struct event_context *ev,
size_t size_hint);
void cli_chain_uncork(struct cli_state *cli);
+bool cli_in_chain(struct cli_state *cli);
NTSTATUS cli_pull_reply(struct async_req *req,
uint8_t *pwct, uint16_t **pvwv,
diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
index 435c8c1cb9..c875acbe48 100644
--- a/source3/libsmb/async_smb.c
+++ b/source3/libsmb/async_smb.c
@@ -137,6 +137,21 @@ static int cli_request_destructor(struct cli_request *req)
}
/**
+ * Are there already requests waiting in the chain_accumulator?
+ * @param[in] cli The cli_state we want to check
+ * @retval reply :-)
+ */
+
+bool cli_in_chain(struct cli_state *cli)
+{
+ if (cli->chain_accumulator == NULL) {
+ return false;
+ }
+
+ return (cli->chain_accumulator->num_async != 0);
+}
+
+/**
* Is the SMB command able to hold an AND_X successor
* @param[in] cmd The SMB command in question
* @retval Can we add a chained request after "cmd"?