MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / prepareForExec

Function prepareForExec

src/plugin/ipc/ssh/ssh.cpp:346–536  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346static void
347prepareForExec(DmtcpEventData_t *data)
348{
349 const char **argv = data->preExec.argv;
350 size_t maxArgs = data->preExec.maxArgs;
351
352 isSshProcess = (jalib::Filesystem::BaseName(data->preExec.filename) == "ssh");
353 isRshProcess = (jalib::Filesystem::BaseName(data->preExec.filename) == "rsh");
354
355 if (!isSshProcess && !isRshProcess) {
356 return;
357 }
358
359 updateCoordHost();
360
361 size_t nargs = 0;
362 bool noStrictChecking = false;
363 string precmd, postcmd, tempcmd;
364
365 while (argv[nargs++] != NULL) {}
366
367 if (nargs < 3) {
368 if (!isRshProcess) {
369 JNOTE("ssh with less than 3 args") (argv[0]) (argv[1]);
370 return;
371 } else if (nargs < 2) {
372 JNOTE("rsh with less than 2 args") (argv[0]);
373 return;
374 }
375 }
376
377 // find command part
378 size_t commandStart = 2;
379 for (size_t i = 1; i < nargs; ++i) {
380 string s = argv[i];
381 if (strcmp(argv[i], "-o") == 0) {
382 if (strcmp(argv[i + 1], "StrictHostKeyChecking=no") == 0) {
383 noStrictChecking = true;
384 }
385 i++;
386 continue;
387 }
388
389 // The following flags have additional parameters and aren't fully
390 // supported. We simply forward them to the ssh command.
391 if (s == "-b" || s == "-c" || s == "-E" || s == "-e" || s == "-F" ||
392 s == "-I" || s == "-i" || s == "-l" || s == "-O" || s == "-o" ||
393 s == "-p" || s == "-Q" || s == "-S") {
394 i++;
395 continue;
396 }
397
398 // These options have a higher probability of failure due to binding
399 // addresses, etc.
400 if (s == "-b" || s == "-D" || s == "-L" || s == "-m" || s == "-R" ||
401 s == "-W" || s == "-w") {
402 JNOTE("The '" + s + "' ssh option isn't fully supported!");
403 i++;

Callers 1

dmtcp_SSH_EventHookFunction · 0.85

Calls 2

updateCoordHostFunction · 0.85
memsetFunction · 0.85

Tested by

no test coverage detected