[BACK]Return to ssh.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/ssh.c between version 1.175 and 1.176

version 1.175, 2002/06/08 05:07:56 version 1.176, 2002/06/08 05:17:01
Line 192 
Line 192 
         exit(1);          exit(1);
 }  }
   
 /*  
  * Connects to the given host using rsh (or prints an error message and exits  
  * if rsh is not available).  This function never returns.  
  */  
 static void  
 rsh_connect(char *host, char *user, Buffer * command)  
 {  
         char *args[10];  
         int i;  
   
         log("Using rsh.  WARNING: Connection will not be encrypted.");  
         /* Build argument list for rsh. */  
         i = 0;  
         args[i++] = _PATH_RSH;  
         /* host may have to come after user on some systems */  
         args[i++] = host;  
         if (user) {  
                 args[i++] = "-l";  
                 args[i++] = user;  
         }  
         if (buffer_len(command) > 0) {  
                 buffer_append(command, "\0", 1);  
                 args[i++] = buffer_ptr(command);  
         }  
         args[i++] = NULL;  
         if (debug_flag) {  
                 for (i = 0; args[i]; i++) {  
                         if (i != 0)  
                                 fprintf(stderr, " ");  
                         fprintf(stderr, "%s", args[i]);  
                 }  
                 fprintf(stderr, "\n");  
         }  
         execv(_PATH_RSH, args);  
         perror(_PATH_RSH);  
         exit(1);  
 }  
   
 static int ssh_session(void);  static int ssh_session(void);
 static int ssh_session2(void);  static int ssh_session2(void);
 static void load_public_identity_files(void);  static void load_public_identity_files(void);
Line 630 
Line 592 
                     "originating port will not be trusted.");                      "originating port will not be trusted.");
                 options.rhosts_authentication = 0;                  options.rhosts_authentication = 0;
         }          }
         /*  
          * If using rsh has been selected, exec it now (without trying  
          * anything else).  Note that we must release privileges first.  
          */  
         if (options.use_rsh) {  
                 /*  
                  * Restore our superuser privileges.  This must be done  
                  * before permanently setting the uid.  
                  */  
                 restore_uid();  
   
                 /* Switch to the original uid permanently. */  
                 permanently_set_uid(pw);  
   
                 /* Execute rsh. */  
                 rsh_connect(host, options.user, &command);  
                 fatal("rsh_connect returned");  
         }  
         /* Restore our superuser privileges. */          /* Restore our superuser privileges. */
         restore_uid();          restore_uid();
   
Line 708 
Line 652 
                 if (mkdir(buf, 0700) < 0)                  if (mkdir(buf, 0700) < 0)
                         error("Could not create directory '%.200s'.", buf);                          error("Could not create directory '%.200s'.", buf);
   
         /* Check if the connection failed, and try "rsh" if appropriate. */          if (cerr)
         if (cerr) {                  exit(1);
                 if (!options.fallback_to_rsh)  
                         exit(1);  
                 if (options.port != 0)  
                         log("Secure connection to %.100s on port %hu refused; "  
                             "reverting to insecure method",  
                             host, options.port);  
                 else  
                         log("Secure connection to %.100s refused; "  
                             "reverting to insecure method.", host);  
   
                 rsh_connect(host, options.user, &command);  
                 fatal("rsh_connect returned");  
         }  
         /* load options.identity_files */          /* load options.identity_files */
         load_public_identity_files();          load_public_identity_files();
   

Legend:
Removed from v.1.175  
changed lines
  Added in v.1.176