more cli_session_setup() calls. what the heck are these doing???
authorLuke Leighton <lkcl@samba.org>
Wed, 1 Dec 1999 22:06:53 +0000 (22:06 +0000)
committerLuke Leighton <lkcl@samba.org>
Wed, 1 Dec 1999 22:06:53 +0000 (22:06 +0000)
they should all be replaced with cli_establish_connection().

created cli_use_wait_keyboard() which waits on multiple cli_states
and swallows session keepalives.

source/include/proto.h
source/libsmb/passchange.c
source/nmbd/nmbd_synclists.c
source/rpc_client/cli_use.c
source/rpcclient/rpcclient.c

index 3c7128efff8c9882f6e0f4c9ff1334e13c87ce95..e84607e726ac27f053406e06a331a55445f56438 100644 (file)
@@ -2182,6 +2182,7 @@ BOOL cli_net_use_del(const char* srv_name,
                                BOOL force_close,
                                BOOL *connection_closed);
 void cli_net_use_enum(uint32 *num_cons, struct use_info ***use);
+void cli_use_wait_keyboard(void);
 
 /*The following definitions come from  rpc_client/cli_wkssvc.c  */
 
index 4cca1927fa027a6e85257690a7e3c7750464a0e6..b5552d4cea18c35f7fe8b7efe4fa9ecdd049fe3b 100644 (file)
@@ -75,7 +75,7 @@ BOOL remote_password_change(const char *remote_machine, const char *user_name,
         * Thanks to <Nicholas.S.Jenkins@cdc.com> for this fix.
         */
 
-       if (!cli_session_setup(&cli, "", "", 0, "", 0, "")) {
+       if (!cli_session_setup(&cli, global_myname, "", "", 0, "", 0, "")) {
                slprintf(err_str, err_str_len-1, "machine %s rejected the session setup. Error was : %s.\n",        
                        remote_machine, cli_errstr(&cli) );
                cli_shutdown(&cli);
index dae25b6eca3b376b1f1b64b40d80c8164a2db805..aab1e4349ca39b122dd76b964aead841f3a36f52 100644 (file)
@@ -92,7 +92,7 @@ static void sync_child(char *name, int nm_type,
                return;
        }
 
-       if (!cli_session_setup(&cli, "", "", 1, "", 0, workgroup)) {
+       if (!cli_session_setup(&cli, local_machine, "", "", 1, "", 0, workgroup)) {
                cli_shutdown(&cli);
                return;
        }
index a953d332e1ecd1db4ad6895ae75d2be98a6556df..99cdb129f75dc6df4f7afe8c370e29a11efe05fb 100644 (file)
@@ -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);
+               }
+       }  
+}
index 4dc919fd97fb15797cd71fcf46064f191d333488..6c9af8815f658677af49735709ff7c0ddf6ad4b8 100644 (file)
@@ -718,36 +718,6 @@ static BOOL do_command(struct client_info *info, char *line)
        return True;
 }
 
-#ifndef HAVE_LIBREADLINE
-/****************************************************************************
-wait for keyboard activity, swallowing network packets
-****************************************************************************/
-static void wait_keyboard(struct cli_state *cli)
-{
-       fd_set fds;
-       struct timeval timeout;
-  
-       while (1) {
-               FD_ZERO(&fds);
-               FD_SET(cli->fd,&fds);
-               FD_SET(fileno(stdin),&fds);
-
-               timeout.tv_sec = 20;
-               timeout.tv_usec = 0;
-               sys_select(MAX(cli->fd,fileno(stdin))+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.
-               */
-               if (FD_ISSET(cli->fd,&fds))
-                       receive_smb(cli->fd,cli->inbuf,0);
-       }  
-}
-#endif
 
 /****************************************************************************
   process commands from the client
@@ -795,26 +765,13 @@ static BOOL process( struct client_info *info, char *cmd_str)
                fprintf(out_hnd, "%s$ ", CNV_LANG(cli_info.dest_host));
                fflush(out_hnd);
 
-#ifdef CLIX
-               line[0] = wait_keyboard(NULL);
-               /* this might not be such a good idea... */
-               if ( line[0] == EOF)
-               {
-                       break;
-               }
-#else
-               wait_keyboard(NULL);
-#endif
+               cli_net_wait_keyboard();
 
                /* and get a response */
-#ifdef CLIX
-               fgets( &line[1],999, stdin);
-#else
                if (!fgets(line,1000,stdin))
                {
                        break;
                }
-#endif
 
 #else /* HAVE_LIBREADLINE */