[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.277.2.1 and 1.278

version 1.277.2.1, 2016/03/10 11:53:34 version 1.278, 2015/04/24 01:36:00
Line 40 
Line 40 
 #include <sys/socket.h>  #include <sys/socket.h>
 #include <sys/queue.h>  #include <sys/queue.h>
   
 #include <ctype.h>  
 #include <errno.h>  #include <errno.h>
 #include <fcntl.h>  #include <fcntl.h>
 #include <grp.h>  #include <grp.h>
Line 256 
Line 255 
         do_cleanup(authctxt);          do_cleanup(authctxt);
 }  }
   
 /* Check untrusted xauth strings for metacharacters */  
 static int  
 xauth_valid_string(const char *s)  
 {  
         size_t i;  
   
         for (i = 0; s[i] != '\0'; i++) {  
                 if (!isalnum((u_char)s[i]) &&  
                     s[i] != '.' && s[i] != ':' && s[i] != '/' &&  
                     s[i] != '-' && s[i] != '_')  
                 return 0;  
         }  
         return 1;  
 }  
   
 /*  /*
  * Prepares for an interactive session.  This is called after the user has   * Prepares for an interactive session.  This is called after the user has
  * been successfully authenticated.  During this message exchange, pseudo   * been successfully authenticated.  During this message exchange, pseudo
Line 344 
Line 328 
                                 s->screen = 0;                                  s->screen = 0;
                         }                          }
                         packet_check_eom();                          packet_check_eom();
                         if (xauth_valid_string(s->auth_proto) &&                          success = session_setup_x11fwd(s);
                             xauth_valid_string(s->auth_data))  
                                 success = session_setup_x11fwd(s);  
                         else {  
                                 success = 0;  
                                 error("Invalid X11 forwarding data");  
                         }  
                         if (!success) {                          if (!success) {
                                 free(s->auth_proto);                                  free(s->auth_proto);
                                 free(s->auth_data);                                  free(s->auth_data);
Line 901 
Line 879 
                         if (envsize >= 1000)                          if (envsize >= 1000)
                                 fatal("child_set_env: too many env vars");                                  fatal("child_set_env: too many env vars");
                         envsize += 50;                          envsize += 50;
                         env = (*envp) = xrealloc(env, envsize, sizeof(char *));                          env = (*envp) = xreallocarray(env, envsize, sizeof(char *));
                         *envsizep = envsize;                          *envsizep = envsize;
                 }                  }
                 /* Need to set the NULL pointer at end of array beyond the new slot. */                  /* Need to set the NULL pointer at end of array beyond the new slot. */
Line 1555 
Line 1533 
                         return NULL;                          return NULL;
                 debug2("%s: allocate (allocated %d max %d)",                  debug2("%s: allocate (allocated %d max %d)",
                     __func__, sessions_nalloc, options.max_sessions);                      __func__, sessions_nalloc, options.max_sessions);
                 tmp = xrealloc(sessions, sessions_nalloc + 1,                  tmp = xreallocarray(sessions, sessions_nalloc + 1,
                     sizeof(*sessions));                      sizeof(*sessions));
                 if (tmp == NULL) {                  if (tmp == NULL) {
                         error("%s: cannot allocate %d sessions",                          error("%s: cannot allocate %d sessions",
Line 1822 
Line 1800 
         s->screen = packet_get_int();          s->screen = packet_get_int();
         packet_check_eom();          packet_check_eom();
   
         if (xauth_valid_string(s->auth_proto) &&          success = session_setup_x11fwd(s);
             xauth_valid_string(s->auth_data))  
                 success = session_setup_x11fwd(s);  
         else {  
                 success = 0;  
                 error("Invalid X11 forwarding data");  
         }  
         if (!success) {          if (!success) {
                 free(s->auth_proto);                  free(s->auth_proto);
                 free(s->auth_data);                  free(s->auth_data);
Line 1888 
Line 1860 
         for (i = 0; i < options.num_accept_env; i++) {          for (i = 0; i < options.num_accept_env; i++) {
                 if (match_pattern(name, options.accept_env[i])) {                  if (match_pattern(name, options.accept_env[i])) {
                         debug2("Setting env %d: %s=%s", s->num_env, name, val);                          debug2("Setting env %d: %s=%s", s->num_env, name, val);
                         s->env = xrealloc(s->env, s->num_env + 1,                          s->env = xreallocarray(s->env, s->num_env + 1,
                             sizeof(*s->env));                              sizeof(*s->env));
                         s->env[s->num_env].name = name;                          s->env[s->num_env].name = name;
                         s->env[s->num_env].val = val;                          s->env[s->num_env].val = val;

Legend:
Removed from v.1.277.2.1  
changed lines
  Added in v.1.278