comparison svr-chansession.c @ 666:0ad95abf8d3c

check for fork() and not __uClinux__
author Mike Frysinger <vapier@gentoo.org>
date Sun, 08 Apr 2012 01:50:52 -0400
parents d4d0279710b9
children fc7ae88e63b3
comparison
equal deleted inserted replaced
665:4d9511f98462 666:0ad95abf8d3c
656 } 656 }
657 #endif 657 #endif
658 658
659 /* uClinux will vfork(), so there'll be a race as 659 /* uClinux will vfork(), so there'll be a race as
660 connection_string is freed below. */ 660 connection_string is freed below. */
661 #ifndef __uClinux__ 661 #ifdef HAVE_FORK
662 chansess->connection_string = make_connection_string(); 662 chansess->connection_string = make_connection_string();
663 #endif 663 #endif
664 664
665 if (chansess->term == NULL) { 665 if (chansess->term == NULL) {
666 /* no pty */ 666 /* no pty */
668 } else { 668 } else {
669 /* want pty */ 669 /* want pty */
670 ret = ptycommand(channel, chansess); 670 ret = ptycommand(channel, chansess);
671 } 671 }
672 672
673 #ifndef __uClinux__ 673 #ifdef HAVE_FORK
674 m_free(chansess->connection_string); 674 m_free(chansess->connection_string);
675 #endif 675 #endif
676 676
677 if (ret == DROPBEAR_FAILURE) { 677 if (ret == DROPBEAR_FAILURE) {
678 m_free(chansess->cmd); 678 m_free(chansess->cmd);
743 if (chansess->master == -1 || chansess->tty == NULL) { 743 if (chansess->master == -1 || chansess->tty == NULL) {
744 dropbear_log(LOG_WARNING, "No pty was allocated, couldn't execute"); 744 dropbear_log(LOG_WARNING, "No pty was allocated, couldn't execute");
745 return DROPBEAR_FAILURE; 745 return DROPBEAR_FAILURE;
746 } 746 }
747 747
748 #ifdef __uClinux__ 748 #ifndef HAVE_FORK
749 pid = vfork(); 749 pid = vfork();
750 #else 750 #else
751 pid = fork(); 751 pid = fork();
752 #endif 752 #endif
753 if (pid < 0) 753 if (pid < 0)
861 * the command/shell. This function does not return. */ 861 * the command/shell. This function does not return. */
862 static void execchild(void *user_data) { 862 static void execchild(void *user_data) {
863 struct ChanSess *chansess = user_data; 863 struct ChanSess *chansess = user_data;
864 char *usershell = NULL; 864 char *usershell = NULL;
865 865
866 /* with uClinux we'll have vfork()ed, so don't want to overwrite the 866 /* with uClinux we'll have vfork()ed, so don't want to overwrite the
867 * hostkey. can't think of a workaround to clear it */ 867 * hostkey. can't think of a workaround to clear it */
868 #ifndef __uClinux__ 868 #ifdef HAVE_FORK
869 /* wipe the hostkey */ 869 /* wipe the hostkey */
870 sign_key_free(svr_opts.hostkey); 870 sign_key_free(svr_opts.hostkey);
871 svr_opts.hostkey = NULL; 871 svr_opts.hostkey = NULL;
872 872
873 /* overwrite the prng state */ 873 /* overwrite the prng state */