[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.319 and 1.320

version 1.319, 2020/03/13 03:17:07 version 1.320, 2020/06/26 04:45:11
Line 966 
Line 966 
 do_rc_files(struct ssh *ssh, Session *s, const char *shell)  do_rc_files(struct ssh *ssh, Session *s, const char *shell)
 {  {
         FILE *f = NULL;          FILE *f = NULL;
         char cmd[1024];          char *cmd = NULL, *user_rc = NULL;
         int do_xauth;          int do_xauth;
         struct stat st;          struct stat st;
   
         do_xauth =          do_xauth =
             s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL;              s->display != NULL && s->auth_proto != NULL && s->auth_data != NULL;
           user_rc = tilde_expand_filename("~/" _PATH_SSH_USER_RC, getuid());
   
         /* ignore _PATH_SSH_USER_RC for subsystems and admin forced commands */          /* ignore _PATH_SSH_USER_RC for subsystems and admin forced commands */
         if (!s->is_subsystem && options.adm_forced_command == NULL &&          if (!s->is_subsystem && options.adm_forced_command == NULL &&
             auth_opts->permit_user_rc && options.permit_user_rc &&              auth_opts->permit_user_rc && options.permit_user_rc &&
             stat(_PATH_SSH_USER_RC, &st) >= 0) {              stat(user_rc, &st) >= 0) {
                 snprintf(cmd, sizeof cmd, "%s -c '%s %s'",                  if (xasprintf(&cmd, "%s -c '%s %s'", shell, _PATH_BSHELL,
                     shell, _PATH_BSHELL, _PATH_SSH_USER_RC);                      user_rc) == -1)
                           fatal("%s: xasprintf: %s", __func__, strerror(errno));
                 if (debug_flag)                  if (debug_flag)
                         fprintf(stderr, "Running %s\n", cmd);                          fprintf(stderr, "Running %s\n", cmd);
                 f = popen(cmd, "w");                  f = popen(cmd, "w");
Line 989 
Line 991 
                         pclose(f);                          pclose(f);
                 } else                  } else
                         fprintf(stderr, "Could not run %s\n",                          fprintf(stderr, "Could not run %s\n",
                             _PATH_SSH_USER_RC);                              user_rc);
         } else if (stat(_PATH_SSH_SYSTEM_RC, &st) >= 0) {          } else if (stat(_PATH_SSH_SYSTEM_RC, &st) >= 0) {
                 if (debug_flag)                  if (debug_flag)
                         fprintf(stderr, "Running %s %s\n", _PATH_BSHELL,                          fprintf(stderr, "Running %s %s\n", _PATH_BSHELL,
Line 1014 
Line 1016 
                             options.xauth_location, s->auth_display,                              options.xauth_location, s->auth_display,
                             s->auth_proto, s->auth_data);                              s->auth_proto, s->auth_data);
                 }                  }
                 snprintf(cmd, sizeof cmd, "%s -q -",                  if (xasprintf(&cmd, "%s -q -", options.xauth_location) == -1)
                     options.xauth_location);                          fatal("%s: xasprintf: %s", __func__, strerror(errno));
                 f = popen(cmd, "w");                  f = popen(cmd, "w");
                 if (f) {                  if (f) {
                         fprintf(f, "remove %s\n",                          fprintf(f, "remove %s\n",
Line 1029 
Line 1031 
                             cmd);                              cmd);
                 }                  }
         }          }
           free(cmd);
           free(user_rc);
 }  }
   
 static void  static void

Legend:
Removed from v.1.319  
changed lines
  Added in v.1.320