comparison svr-chansession.c @ 1791:685b47d8faf7

fuzz: wrap kill()
author Matt Johnston <matt@ucc.asn.au>
date Fri, 29 Jan 2021 21:47:56 +0800
parents 4f13df974cf4
children 837cc354b388
comparison
equal deleted inserted replaced
1790:42745af83b7d 1791:685b47d8faf7
421 } 421 }
422 422
423 423
424 /* Send a signal to a session's process as requested by the client*/ 424 /* Send a signal to a session's process as requested by the client*/
425 static int sessionsignal(const struct ChanSess *chansess) { 425 static int sessionsignal(const struct ChanSess *chansess) {
426 TRACE(("sessionsignal"))
426 427
427 int sig = 0; 428 int sig = 0;
428 char* signame = NULL; 429 char* signame = NULL;
429 int i; 430 int i;
430 431
431 if (chansess->pid == 0) { 432 if (chansess->pid == 0) {
433 TRACE(("sessionsignal: done no pid"))
432 /* haven't got a process pid yet */ 434 /* haven't got a process pid yet */
433 return DROPBEAR_FAILURE; 435 return DROPBEAR_FAILURE;
434 } 436 }
435 437
436 signame = buf_getstring(ses.payload, NULL); 438 signame = buf_getstring(ses.payload, NULL);
444 i++; 446 i++;
445 } 447 }
446 448
447 m_free(signame); 449 m_free(signame);
448 450
451 TRACE(("sessionsignal: pid %d signal %d", (int)chansess->pid, sig))
449 if (sig == 0) { 452 if (sig == 0) {
450 /* failed */ 453 /* failed */
451 return DROPBEAR_FAILURE; 454 return DROPBEAR_FAILURE;
452 } 455 }
453 456
454 if (kill(chansess->pid, sig) < 0) { 457 if (kill(chansess->pid, sig) < 0) {
458 TRACE(("sessionsignal: kill() errored"))
455 return DROPBEAR_FAILURE; 459 return DROPBEAR_FAILURE;
456 } 460 }
457 461
458 return DROPBEAR_SUCCESS; 462 return DROPBEAR_SUCCESS;
459 } 463 }