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

Diff for /src/usr.bin/ssh/clientloop.c between version 1.125 and 1.126

version 1.125, 2004/06/15 05:45:04 version 1.126, 2004/06/17 14:52:48
Line 143 
Line 143 
         Buffer cmd;          Buffer cmd;
         char *term;          char *term;
         struct termios tio;          struct termios tio;
           char **env;
 };  };
   
 /*XXX*/  /*XXX*/
Line 538 
Line 539 
 {  {
         struct confirm_ctx *cctx = arg;          struct confirm_ctx *cctx = arg;
         Channel *c;          Channel *c;
           int i;
   
         if (cctx == NULL)          if (cctx == NULL)
                 fatal("%s: cctx == NULL", __func__);                  fatal("%s: cctx == NULL", __func__);
Line 545 
Line 547 
                 fatal("%s: no channel for id %d", __func__, id);                  fatal("%s: no channel for id %d", __func__, id);
   
         client_session2_setup(id, cctx->want_tty, cctx->want_subsys,          client_session2_setup(id, cctx->want_tty, cctx->want_subsys,
             cctx->term, &cctx->tio, c->rfd, &cctx->cmd,              cctx->term, &cctx->tio, c->rfd, &cctx->cmd, cctx->env,
             client_subsystem_reply);              client_subsystem_reply);
   
         c->confirm_ctx = NULL;          c->confirm_ctx = NULL;
         buffer_free(&cctx->cmd);          buffer_free(&cctx->cmd);
         free(cctx->term);          xfree(cctx->term);
         free(cctx);          if (cctx->env != NULL) {
                   for (i = 0; cctx->env[i] != NULL; i++)
                           xfree(cctx->env[i]);
                   xfree(cctx->env);
           }
           xfree(cctx);
 }  }
   
 static void  static void
Line 559 
Line 566 
 {  {
         Buffer m;          Buffer m;
         Channel *c;          Channel *c;
         int client_fd, new_fd[3], ver;          int client_fd, new_fd[3], ver, i;
         socklen_t addrlen;          socklen_t addrlen;
         struct sockaddr_storage addr;          struct sockaddr_storage addr;
         struct confirm_ctx *cctx;          struct confirm_ctx *cctx;
         char *cmd;          char *cmd;
         u_int len;          u_int len, env_len;
         uid_t euid;          uid_t euid;
         gid_t egid;          gid_t egid;
   
Line 631 
Line 638 
         buffer_init(&cctx->cmd);          buffer_init(&cctx->cmd);
         buffer_append(&cctx->cmd, cmd, strlen(cmd));          buffer_append(&cctx->cmd, cmd, strlen(cmd));
   
           env_len = buffer_get_int(&m);
           env_len = MIN(env_len, 4096);
           debug3("%s: receiving %d env vars", __func__, env_len);
           if (env_len != 0) {
                   cctx->env = xmalloc(sizeof(*cctx->env) * (env_len + 1));
                   for (i = 0; i < env_len; i++)
                           cctx->env[i] = buffer_get_string(&m, &len);
                   cctx->env[i] = NULL;
           }
   
         debug2("%s: accepted tty %d, subsys %d, cmd %s", __func__,          debug2("%s: accepted tty %d, subsys %d, cmd %s", __func__,
             cctx->want_tty, cctx->want_subsys, cmd);              cctx->want_tty, cctx->want_subsys, cmd);
   
Line 1626 
Line 1643 
   
 void  void
 client_session2_setup(int id, int want_tty, int want_subsystem,  client_session2_setup(int id, int want_tty, int want_subsystem,
     const char *term, struct termios *tiop, int in_fd, Buffer *cmd,      const char *term, struct termios *tiop, int in_fd, Buffer *cmd, char **env,
     dispatch_fn *subsys_repl)      dispatch_fn *subsys_repl)
 {  {
         int len;          int len;
Line 1654 
Line 1671 
         }          }
   
         /* Transfer any environment variables from client to server */          /* Transfer any environment variables from client to server */
         if (options.num_send_env != 0) {          if (options.num_send_env != 0 && env != NULL) {
                 int i, j, matched;                  int i, j, matched;
                 extern char **environ;  
                 char *name, *val;                  char *name, *val;
   
                 debug("Sending environment.");                  debug("Sending environment.");
                 for (i = 0; environ && environ[i] != NULL; i++) {                  for (i = 0; env[i] != NULL; i++) {
                         /* Split */                          /* Split */
                         name = xstrdup(environ[i]);                          name = xstrdup(env[i]);
                         if ((val = strchr(name, '=')) == NULL) {                          if ((val = strchr(name, '=')) == NULL) {
                                 free(name);                                  free(name);
                                 continue;                                  continue;

Legend:
Removed from v.1.125  
changed lines
  Added in v.1.126