[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.10 and 1.11

version 1.10, 1999/09/29 18:27:23 version 1.11, 1999/09/29 21:14:16
Line 171 
Line 171 
   
 /* Main program for the ssh client. */  /* Main program for the ssh client. */
   
   uid_t original_real_uid;
   
 int  int
 main(int ac, char **av)  main(int ac, char **av)
 {  {
Line 396 
Line 398 
               usage();                usage();
               /*NOTREACHED*/                /*NOTREACHED*/
             }              }
           if (fwd_port < 1024 && original_real_uid != 0)  
             {  
               fprintf(stderr,  
                       "Privileged ports can only be forwarded by root.\n");  
               exit(1);  
             }  
           add_local_forward(&options, fwd_port, buf, fwd_host_port);            add_local_forward(&options, fwd_port, buf, fwd_host_port);
           break;            break;
   
Line 497 
Line 493 
   log_init(av[0], 1, debug_flag, quiet_flag, SYSLOG_FACILITY_USER);    log_init(av[0], 1, debug_flag, quiet_flag, SYSLOG_FACILITY_USER);
   
   /* Read per-user configuration file. */    /* Read per-user configuration file. */
   sprintf(buf, "%.100s/%.100s", pw->pw_dir, SSH_USER_CONFFILE);    snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir, SSH_USER_CONFFILE);
   read_config_file(buf, host, &options);    read_config_file(buf, host, &options);
   
   /* Read systemwide configuration file. */    /* Read systemwide configuration file. */
Line 578 
Line 574 
   
   /* Now that we are back to our own permissions, create ~/.ssh directory    /* Now that we are back to our own permissions, create ~/.ssh directory
      if it doesn\'t already exist. */       if it doesn\'t already exist. */
   sprintf(buf, "%.100s/%.100s", pw->pw_dir, SSH_USER_DIR);    snprintf(buf, sizeof buf, "%.100s/%.100s", pw->pw_dir, SSH_USER_DIR);
   if (stat(buf, &st) < 0)    if (stat(buf, &st) < 0)
     if (mkdir(buf, 0755) < 0)      if (mkdir(buf, 0755) < 0)
       error("Could not create directory '%.200s'.", buf);        error("Could not create directory '%.200s'.", buf);
Line 710 
Line 706 
   
 #ifdef XAUTH_PATH  #ifdef XAUTH_PATH
       /* Try to get Xauthority information for the display. */        /* Try to get Xauthority information for the display. */
       sprintf(line, "%.100s list %.200s 2>/dev/null",        snprintf(line, sizeof line, "%.100s list %.200s 2>/dev/null",
               XAUTH_PATH, getenv("DISPLAY"));                XAUTH_PATH, getenv("DISPLAY"));
       f = popen(line, "r");        f = popen(line, "r");
       if (f && fgets(line, sizeof(line), f) &&        if (f && fgets(line, sizeof(line), f) &&
Line 728 
Line 724 
         {          {
           u_int32_t rand = 0;            u_int32_t rand = 0;
   
           strcpy(proto, "MIT-MAGIC-COOKIE-1");            strlcpy(proto, "MIT-MAGIC-COOKIE-1", sizeof proto);
           for (i = 0; i < 16; i++) {            for (i = 0; i < 16; i++) {
             if (i % 4 == 0)              if (i % 4 == 0)
               rand = arc4random();                rand = arc4random();
             sprintf(data + 2 * i, "%02x", rand & 0xff);              snprintf(data + 2 * i, sizeof data - 2 * i, "%02x", rand & 0xff);
             rand >>= 8;              rand >>= 8;
           }            }
         }          }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11