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

Diff for /src/usr.bin/ssh/session.c between version 1.108 and 1.109

version 1.108, 2001/10/11 13:45:21 version 1.109, 2001/11/29 21:10:51
Line 73 
Line 73 
         int     row, col, xpixel, ypixel;          int     row, col, xpixel, ypixel;
         char    tty[TTYSZ];          char    tty[TTYSZ];
         /* X11 */          /* X11 */
           int     display_number;
         char    *display;          char    *display;
         int     screen;          int     screen;
           char    *auth_display;
         char    *auth_proto;          char    *auth_proto;
         char    *auth_data;          char    *auth_data;
         int     single_connection;          int     single_connection;
Line 1030 
Line 1032 
                                     _PATH_SSH_SYSTEM_RC);                                      _PATH_SSH_SYSTEM_RC);
                 } else if (do_xauth && options.xauth_location != NULL) {                  } else if (do_xauth && options.xauth_location != NULL) {
                         /* Add authority data to .Xauthority if appropriate. */                          /* Add authority data to .Xauthority if appropriate. */
                         char *screen = strchr(s->display, ':');  
   
                         if (debug_flag) {                          if (debug_flag) {
                                 fprintf(stderr,                                  fprintf(stderr,
                                     "Running %.100s add "                                      "Running %.100s add "
                                     "%.100s %.100s %.100s\n",                                      "%.100s %.100s %.100s\n",
                                     options.xauth_location, s->display,                                      options.xauth_location, s->auth_display,
                                     s->auth_proto, s->auth_data);                                      s->auth_proto, s->auth_data);
                                 if (screen != NULL)  
                                         fprintf(stderr,  
                                             "Adding %.*s/unix%s %s %s\n",  
                                             (int)(screen - s->display),  
                                             s->display, screen,  
                                             s->auth_proto, s->auth_data);  
                         }                          }
                         snprintf(cmd, sizeof cmd, "%s -q -",                          snprintf(cmd, sizeof cmd, "%s -q -",
                             options.xauth_location);                              options.xauth_location);
                         f = popen(cmd, "w");                          f = popen(cmd, "w");
                         if (f) {                          if (f) {
                                 fprintf(f, "add %s %s %s\n", s->display,                                  fprintf(f, "add %s %s %s\n", s->auth_display,
                                     s->auth_proto, s->auth_data);                                      s->auth_proto, s->auth_data);
                                 if (screen != NULL)  
                                         fprintf(f, "add %.*s/unix%s %s %s\n",  
                                             (int)(screen - s->display),  
                                             s->display, screen,  
                                             s->auth_proto,  
                                             s->auth_data);  
                                 pclose(f);                                  pclose(f);
                         } else {                          } else {
                                 fprintf(stderr, "Could not run %s\n",                                  fprintf(stderr, "Could not run %s\n",
Line 1549 
Line 1538 
                 xfree(s->term);                  xfree(s->term);
         if (s->display)          if (s->display)
                 xfree(s->display);                  xfree(s->display);
           if (s->auth_display)
                   xfree(s->auth_display);
         if (s->auth_data)          if (s->auth_data)
                 xfree(s->auth_data);                  xfree(s->auth_data);
         if (s->auth_proto)          if (s->auth_proto)
Line 1644 
Line 1635 
 session_setup_x11fwd(Session *s)  session_setup_x11fwd(Session *s)
 {  {
         struct stat st;          struct stat st;
           char display[512], auth_display[512];
           char hostname[MAXHOSTNAMELEN];
   
         if (no_x11_forwarding_flag) {          if (no_x11_forwarding_flag) {
                 packet_send_debug("X11 forwarding disabled in user configuration file.");                  packet_send_debug("X11 forwarding disabled in user configuration file.");
Line 1667 
Line 1660 
                 debug("X11 display already set.");                  debug("X11 display already set.");
                 return 0;                  return 0;
         }          }
         s->display = x11_create_display_inet(s->screen, options.x11_display_offset);          s->display_number = x11_create_display_inet(options.x11_display_offset,
         if (s->display == NULL) {              options.gateway_ports);
           if (s->display_number == -1) {
                 debug("x11_create_display_inet failed.");                  debug("x11_create_display_inet failed.");
                 return 0;                  return 0;
         }          }
   
           /* Set up a suitable value for the DISPLAY variable. */
           if (gethostname(hostname, sizeof(hostname)) < 0)
                   fatal("gethostname: %.100s", strerror(errno));
           /*
            * auth_display must be used as the displayname when the
            * authorization entry is added with xauth(1).  This will be
            * different than the DISPLAY string for localhost displays.
            */
           if (!options.gateway_ports) {
                   snprintf(display, sizeof display, "localhost:%d.%d",
                       s->display_number, s->screen);
                   snprintf(auth_display, sizeof auth_display, "%.400s/unix:%d.%d",
                       hostname, s->display_number, s->screen);
                   s->display = xstrdup(display);
                   s->auth_display = xstrdup(auth_display);
           } else {
                   snprintf(display, sizeof display, "%.400s:%d.%d", hostname,
                       s->display_number, s->screen);
                   s->display = xstrdup(display);
                   s->auth_display = xstrdup(display);
           }
   
         return 1;          return 1;
 }  }
   

Legend:
Removed from v.1.108  
changed lines
  Added in v.1.109