summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1999-12-01 22:06:53 +0000
committerLuke Leighton <lkcl@samba.org>1999-12-01 22:06:53 +0000
commita76fee73337aca00973ca744f3c41906a72e5855 (patch)
treee95371767e795740b3abb2804a1c87225d43512a /source3/rpc_client
parentc15b95cd1ede75b38d3a2c5192f2d1fd2a310c9a (diff)
downloadsamba-a76fee73337aca00973ca744f3c41906a72e5855.tar.gz
samba-a76fee73337aca00973ca744f3c41906a72e5855.tar.bz2
samba-a76fee73337aca00973ca744f3c41906a72e5855.zip
more cli_session_setup() calls. what the heck are these doing???
they should all be replaced with cli_establish_connection(). created cli_use_wait_keyboard() which waits on multiple cli_states and swallows session keepalives. (This used to be commit fcc39b3f4f2f8d04d3fab09db048b4f3dc1e97d5)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_use.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/source3/rpc_client/cli_use.c b/source3/rpc_client/cli_use.c
index a953d332e1..99cdb129f7 100644
--- a/source3/rpc_client/cli_use.c
+++ b/source3/rpc_client/cli_use.c
@@ -382,3 +382,47 @@ void cli_net_use_enum(uint32 *num_cons, struct use_info ***use)
}
}
+
+/****************************************************************************
+wait for keyboard activity, swallowing network packets on all client states.
+****************************************************************************/
+void cli_use_wait_keyboard(void)
+{
+ fd_set fds;
+ struct timeval timeout;
+
+ while (1)
+ {
+ int i;
+ int maxfd = fileno(stdin);
+ FD_ZERO(&fds);
+ FD_SET(fileno(stdin),&fds);
+ for (i = 0; i < num_clis; i++)
+ {
+ if (clis[i] != NULL && clis[i]->cli != NULL)
+ {
+ int fd = clis[i]->cli->fd;
+ FD_SET(fd,&fds);
+ maxfd = MAX(fd, maxfd);
+ }
+ }
+
+ timeout.tv_sec = 20;
+ timeout.tv_usec = 0;
+ sys_select(maxfd+1,NULL, &fds,&timeout);
+
+ if (FD_ISSET(fileno(stdin),&fds))
+ return;
+
+ /* We deliberately use receive_smb instead of
+ client_receive_smb as we want to receive
+ session keepalives and then drop them here.
+ */
+ for (i = 0; i < num_clis; i++)
+ {
+ int fd = clis[i]->cli->fd;
+ if (FD_ISSET(fd,&fds))
+ receive_smb(fd,clis[i]->cli->inbuf,0);
+ }
+ }
+}