[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.264 and 1.265

version 1.264, 2013/04/19 01:03:01 version 1.265, 2013/05/17 00:13:14
Line 182 
Line 182 
                 packet_send_debug("Agent forwarding disabled: "                  packet_send_debug("Agent forwarding disabled: "
                     "mkdtemp() failed: %.100s", strerror(errno));                      "mkdtemp() failed: %.100s", strerror(errno));
                 restore_uid();                  restore_uid();
                 xfree(auth_sock_dir);                  free(auth_sock_dir);
                 auth_sock_dir = NULL;                  auth_sock_dir = NULL;
                 goto authsock_err;                  goto authsock_err;
         }          }
Line 227 
Line 227 
         return 1;          return 1;
   
  authsock_err:   authsock_err:
         if (auth_sock_name != NULL)          free(auth_sock_name);
                 xfree(auth_sock_name);  
         if (auth_sock_dir != NULL) {          if (auth_sock_dir != NULL) {
                 rmdir(auth_sock_dir);                  rmdir(auth_sock_dir);
                 xfree(auth_sock_dir);                  free(auth_sock_dir);
         }          }
         if (sock != -1)          if (sock != -1)
                 close(sock);                  close(sock);
Line 347 
Line 346 
                         packet_check_eom();                          packet_check_eom();
                         success = session_setup_x11fwd(s);                          success = session_setup_x11fwd(s);
                         if (!success) {                          if (!success) {
                                 xfree(s->auth_proto);                                  free(s->auth_proto);
                                 xfree(s->auth_data);                                  free(s->auth_data);
                                 s->auth_proto = NULL;                                  s->auth_proto = NULL;
                                 s->auth_data = NULL;                                  s->auth_data = NULL;
                         }                          }
Line 395 
Line 394 
                                 if (do_exec(s, command) != 0)                                  if (do_exec(s, command) != 0)
                                         packet_disconnect(                                          packet_disconnect(
                                             "command execution failed");                                              "command execution failed");
                                 xfree(command);                                  free(command);
                         } else {                          } else {
                                 if (do_exec(s, NULL) != 0)                                  if (do_exec(s, NULL) != 0)
                                         packet_disconnect(                                          packet_disconnect(
Line 860 
Line 859 
                         break;                          break;
         if (env[i]) {          if (env[i]) {
                 /* Reuse the slot. */                  /* Reuse the slot. */
                 xfree(env[i]);                  free(env[i]);
         } else {          } else {
                 /* New variable.  Expand if necessary. */                  /* New variable.  Expand if necessary. */
                 envsize = *envsizep;                  envsize = *envsizep;
Line 983 
Line 982 
                                 child_set_env(&env, &envsize, str, str + i + 1);                                  child_set_env(&env, &envsize, str, str + i + 1);
                         }                          }
                         custom_environment = ce->next;                          custom_environment = ce->next;
                         xfree(ce->s);                          free(ce->s);
                         xfree(ce);                          free(ce);
                 }                  }
         }          }
   
Line 996 
Line 995 
         laddr = get_local_ipaddr(packet_get_connection_in());          laddr = get_local_ipaddr(packet_get_connection_in());
         snprintf(buf, sizeof buf, "%.50s %d %.50s %d",          snprintf(buf, sizeof buf, "%.50s %d %.50s %d",
             get_remote_ipaddr(), get_remote_port(), laddr, get_local_port());              get_remote_ipaddr(), get_remote_port(), laddr, get_local_port());
         xfree(laddr);          free(laddr);
         child_set_env(&env, &envsize, "SSH_CONNECTION", buf);          child_set_env(&env, &envsize, "SSH_CONNECTION", buf);
   
         if (s->ttyfd != -1)          if (s->ttyfd != -1)
Line 1117 
Line 1116 
   
         if (stat(nl, &sb) == -1) {          if (stat(nl, &sb) == -1) {
                 if (nl != def_nl)                  if (nl != def_nl)
                         xfree(nl);                          free(nl);
                 return;                  return;
         }          }
   
Line 1692 
Line 1691 
         s->ypixel = packet_get_int();          s->ypixel = packet_get_int();
   
         if (strcmp(s->term, "") == 0) {          if (strcmp(s->term, "") == 0) {
                 xfree(s->term);                  free(s->term);
                 s->term = NULL;                  s->term = NULL;
         }          }
   
Line 1700 
Line 1699 
         debug("Allocating pty.");          debug("Allocating pty.");
         if (!PRIVSEP(pty_allocate(&s->ptyfd, &s->ttyfd, s->tty,          if (!PRIVSEP(pty_allocate(&s->ptyfd, &s->ttyfd, s->tty,
             sizeof(s->tty)))) {              sizeof(s->tty)))) {
                 if (s->term)                  free(s->term);
                         xfree(s->term);  
                 s->term = NULL;                  s->term = NULL;
                 s->ptyfd = -1;                  s->ptyfd = -1;
                 s->ttyfd = -1;                  s->ttyfd = -1;
Line 1762 
Line 1760 
                 logit("subsystem request for %.100s failed, subsystem not found",                  logit("subsystem request for %.100s failed, subsystem not found",
                     subsys);                      subsys);
   
         xfree(subsys);          free(subsys);
         return success;          return success;
 }  }
   
Line 1784 
Line 1782 
   
         success = session_setup_x11fwd(s);          success = session_setup_x11fwd(s);
         if (!success) {          if (!success) {
                 xfree(s->auth_proto);                  free(s->auth_proto);
                 xfree(s->auth_data);                  free(s->auth_data);
                 s->auth_proto = NULL;                  s->auth_proto = NULL;
                 s->auth_data = NULL;                  s->auth_data = NULL;
         }          }
Line 1807 
Line 1805 
         char *command = packet_get_string(&len);          char *command = packet_get_string(&len);
         packet_check_eom();          packet_check_eom();
         success = do_exec(s, command) == 0;          success = do_exec(s, command) == 0;
         xfree(command);          free(command);
         return success;          return success;
 }  }
   
Line 1853 
Line 1851 
         debug2("Ignoring env request %s: disallowed name", name);          debug2("Ignoring env request %s: disallowed name", name);
   
  fail:   fail:
         xfree(name);          free(name);
         xfree(val);          free(val);
         return (0);          return (0);
 }  }
   
Line 2036 
Line 2034 
                 if (s->x11_chanids[i] != id)                  if (s->x11_chanids[i] != id)
                         session_close_x11(s->x11_chanids[i]);                          session_close_x11(s->x11_chanids[i]);
         }          }
         xfree(s->x11_chanids);          free(s->x11_chanids);
         s->x11_chanids = NULL;          s->x11_chanids = NULL;
         if (s->display) {          free(s->display);
                 xfree(s->display);          s->display = NULL;
                 s->display = NULL;          free(s->auth_proto);
         }          s->auth_proto = NULL;
         if (s->auth_proto) {          free(s->auth_data);
                 xfree(s->auth_proto);          s->auth_data = NULL;
                 s->auth_proto = NULL;          free(s->auth_display);
         }          s->auth_display = NULL;
         if (s->auth_data) {  
                 xfree(s->auth_data);  
                 s->auth_data = NULL;  
         }  
         if (s->auth_display) {  
                 xfree(s->auth_display);  
                 s->auth_display = NULL;  
         }  
 }  }
   
 static void  static void
Line 2111 
Line 2101 
         debug("session_close: session %d pid %ld", s->self, (long)s->pid);          debug("session_close: session %d pid %ld", s->self, (long)s->pid);
         if (s->ttyfd != -1)          if (s->ttyfd != -1)
                 session_pty_cleanup(s);                  session_pty_cleanup(s);
         if (s->term)          free(s->term);
                 xfree(s->term);          free(s->display);
         if (s->display)          free(s->x11_chanids);
                 xfree(s->display);          free(s->auth_display);
         if (s->x11_chanids)          free(s->auth_data);
                 xfree(s->x11_chanids);          free(s->auth_proto);
         if (s->auth_display)  
                 xfree(s->auth_display);  
         if (s->auth_data)  
                 xfree(s->auth_data);  
         if (s->auth_proto)  
                 xfree(s->auth_proto);  
         if (s->env != NULL) {          if (s->env != NULL) {
                 for (i = 0; i < s->num_env; i++) {                  for (i = 0; i < s->num_env; i++) {
                         xfree(s->env[i].name);                          free(s->env[i].name);
                         xfree(s->env[i].val);                          free(s->env[i].val);
                 }                  }
                 xfree(s->env);                  free(s->env);
         }          }
         session_proctitle(s);          session_proctitle(s);
         session_unused(s->self);          session_unused(s->self);

Legend:
Removed from v.1.264  
changed lines
  Added in v.1.265