comparison svr-chansession.c @ 1122:aaf576b27a10

Merge pull request #13 from gazoo74/fix-warnings Fix warnings
author Matt Johnston <matt@ucc.asn.au>
date Thu, 04 Jun 2015 23:08:50 +0800
parents 367d3800555b
children b1fabf797bd3
comparison
equal deleted inserted replaced
1087:1e486f368ec3 1122:aaf576b27a10
341 341
342 /* Handle requests for a channel. These can be execution requests, 342 /* Handle requests for a channel. These can be execution requests,
343 * or x11/authagent forwarding. These are passed to appropriate handlers */ 343 * or x11/authagent forwarding. These are passed to appropriate handlers */
344 static void chansessionrequest(struct Channel *channel) { 344 static void chansessionrequest(struct Channel *channel) {
345 345
346 unsigned char * type = NULL; 346 char * type = NULL;
347 unsigned int typelen; 347 unsigned int typelen;
348 unsigned char wantreply; 348 unsigned char wantreply;
349 int ret = 1; 349 int ret = 1;
350 struct ChanSess *chansess; 350 struct ChanSess *chansess;
351 351
404 404
405 /* Send a signal to a session's process as requested by the client*/ 405 /* Send a signal to a session's process as requested by the client*/
406 static int sessionsignal(struct ChanSess *chansess) { 406 static int sessionsignal(struct ChanSess *chansess) {
407 407
408 int sig = 0; 408 int sig = 0;
409 unsigned char* signame = NULL; 409 char* signame = NULL;
410 int i; 410 int i;
411 411
412 if (chansess->pid == 0) { 412 if (chansess->pid == 0) {
413 /* haven't got a process pid yet */ 413 /* haven't got a process pid yet */
414 return DROPBEAR_FAILURE; 414 return DROPBEAR_FAILURE;
555 * The pty is allocated now, and kept for when the shell/program executes. 555 * The pty is allocated now, and kept for when the shell/program executes.
556 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ 556 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */
557 static int sessionpty(struct ChanSess * chansess) { 557 static int sessionpty(struct ChanSess * chansess) {
558 558
559 unsigned int termlen; 559 unsigned int termlen;
560 unsigned char namebuf[65]; 560 char namebuf[65];
561 struct passwd * pw = NULL; 561 struct passwd * pw = NULL;
562 562
563 TRACE(("enter sessionpty")) 563 TRACE(("enter sessionpty"))
564 564
565 if (!svr_pubkey_allows_pty()) { 565 if (!svr_pubkey_allows_pty()) {
581 if (pty_allocate(&chansess->master, &chansess->slave, namebuf, 64) == 0) { 581 if (pty_allocate(&chansess->master, &chansess->slave, namebuf, 64) == 0) {
582 TRACE(("leave sessionpty: failed to allocate pty")) 582 TRACE(("leave sessionpty: failed to allocate pty"))
583 return DROPBEAR_FAILURE; 583 return DROPBEAR_FAILURE;
584 } 584 }
585 585
586 chansess->tty = (char*)m_strdup(namebuf); 586 chansess->tty = m_strdup(namebuf);
587 if (!chansess->tty) { 587 if (!chansess->tty) {
588 dropbear_exit("Out of memory"); /* TODO disconnect */ 588 dropbear_exit("Out of memory"); /* TODO disconnect */
589 } 589 }
590 590
591 pw = getpwnam(ses.authstate.pw_name); 591 pw = getpwnam(ses.authstate.pw_name);
601 601
602 TRACE(("leave sessionpty")) 602 TRACE(("leave sessionpty"))
603 return DROPBEAR_SUCCESS; 603 return DROPBEAR_SUCCESS;
604 } 604 }
605 605
606 #ifndef USE_VFORK
606 static void make_connection_string(struct ChanSess *chansess) { 607 static void make_connection_string(struct ChanSess *chansess) {
607 char *local_ip, *local_port, *remote_ip, *remote_port; 608 char *local_ip, *local_port, *remote_ip, *remote_port;
608 size_t len; 609 size_t len;
609 get_socket_address(ses.sock_in, &local_ip, &local_port, &remote_ip, &remote_port, 0); 610 get_socket_address(ses.sock_in, &local_ip, &local_port, &remote_ip, &remote_port, 0);
610 611
622 m_free(local_ip); 623 m_free(local_ip);
623 m_free(local_port); 624 m_free(local_port);
624 m_free(remote_ip); 625 m_free(remote_ip);
625 m_free(remote_port); 626 m_free(remote_port);
626 } 627 }
628 #endif
627 629
628 /* Handle a command request from the client. This is used for both shell 630 /* Handle a command request from the client. This is used for both shell
629 * and command-execution requests, and passes the command to 631 * and command-execution requests, and passes the command to
630 * noptycommand or ptycommand as appropriate. 632 * noptycommand or ptycommand as appropriate.
631 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */ 633 * Returns DROPBEAR_SUCCESS or DROPBEAR_FAILURE */