1
1

Single-word cmd line values for orted are dealt with in orte_plm_base_orted_append_basic_args, so protect against special characters there. Have the rsh module only deal with multi-word arguments as those were skipped by orte_plm_base_orted_append_basic_args.

Refs trac:4802

This commit was SVN r32293.

The following Trac tickets were found above:
  Ticket 4802 --> https://svn.open-mpi.org/trac/ompi/ticket/4802
Этот коммит содержится в:
Ralph Castain 2014-07-23 17:06:51 +00:00
родитель cbd11abe53
Коммит 0cad281a92
2 изменённых файлов: 14 добавлений и 7 удалений

Просмотреть файл

@ -1074,7 +1074,7 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv,
char *param = NULL;
const char **tmp_value;
int loc_id;
char * tmp_force = NULL;
char *tmp_force = NULL;
int i, j, cnt, rc;
orte_job_t *jdata;
char *rml_uri;
@ -1302,10 +1302,15 @@ int orte_plm_base_orted_append_basic_args(int *argc, char ***argv,
}
}
if (!ignore) {
/* must be okay - pass it along */
/* even if it is a single word, we have to try and quote it
* because it could contain a special character like a colon
* or semicolon */
(void)asprintf(&tmp_force, "\"%s\"", orted_cmd_line[i+2]);
/* pass it along */
opal_argv_append(argc, argv, orted_cmd_line[i]);
opal_argv_append(argc, argv, orted_cmd_line[i+1]);
opal_argv_append(argc, argv, orted_cmd_line[i+2]);
opal_argv_append(argc, argv, tmp_force);
free(tmp_force);
}
}
}

Просмотреть файл

@ -568,13 +568,15 @@ static int setup_launch(int *argcptr, char ***argvptr,
/* in the rsh environment, we can append multi-word arguments
* by enclosing them in quotes. Check for any multi-word
* mca params passed to mpirun and include them
* mca params passed to mpirun and include them - they were
* excluded in append_basic_args
*/
cnt = opal_argv_count(orted_cmd_line);
for (i=0; i < cnt; i+=3) {
/* there could be multi-word values here, or
* values with special characters, so protect
* the value with quotes */
if (NULL != strchr(orted_cmd_line[i+2], ' ')) {
continue;
}
/* protect the value with quotes */
(void)asprintf(&param, "\"%s\"", orted_cmd_line[i+2]);
/* now pass it along */
opal_argv_append(&argc, &argv, orted_cmd_line[i]);