Mercurial > dropbear
comparison common-channel.c @ 6:ab00ef513e97
Sorted out the first channel init issues.
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 01 Jun 2004 10:48:46 +0000 |
parents | fe6bca95afa7 |
children | 425ed5c20157 |
comparison
equal
deleted
inserted
replaced
5:bc6477a6c393 | 6:ab00ef513e97 |
---|---|
59 | 59 |
60 #define FD_UNINIT (-2) | 60 #define FD_UNINIT (-2) |
61 #define FD_CLOSED (-1) | 61 #define FD_CLOSED (-1) |
62 | 62 |
63 /* Initialise all the channels */ | 63 /* Initialise all the channels */ |
64 void chaninitialise(struct ChanType *chantypes[]) { | 64 void chaninitialise(const struct ChanType *chantypes[]) { |
65 | 65 |
66 /* may as well create space for a single channel */ | 66 /* may as well create space for a single channel */ |
67 ses.channels = (struct Channel**)m_malloc(sizeof(struct Channel*)); | 67 ses.channels = (struct Channel**)m_malloc(sizeof(struct Channel*)); |
68 ses.chansize = 1; | 68 ses.chansize = 1; |
69 ses.channels[0] = NULL; | 69 ses.channels[0] = NULL; |
735 | 735 |
736 unsigned char *type; | 736 unsigned char *type; |
737 unsigned int typelen; | 737 unsigned int typelen; |
738 unsigned int remotechan, transwindow, transmaxpacket; | 738 unsigned int remotechan, transwindow, transmaxpacket; |
739 struct Channel *channel; | 739 struct Channel *channel; |
740 struct ChanType *chantype; | 740 const struct ChanType *chantype; |
741 unsigned int errtype = SSH_OPEN_UNKNOWN_CHANNEL_TYPE; | 741 unsigned int errtype = SSH_OPEN_UNKNOWN_CHANNEL_TYPE; |
742 int ret; | 742 int ret; |
743 | 743 |
744 | 744 |
745 TRACE(("enter recv_msg_channel_open")); | 745 TRACE(("enter recv_msg_channel_open")); |
773 | 773 |
774 /* create the channel */ | 774 /* create the channel */ |
775 channel = newchannel(remotechan, chantype, transwindow, transmaxpacket); | 775 channel = newchannel(remotechan, chantype, transwindow, transmaxpacket); |
776 | 776 |
777 if (channel == NULL) { | 777 if (channel == NULL) { |
778 TRACE(("newchannel returned NULL")); | |
778 goto failure; | 779 goto failure; |
779 } | 780 } |
780 | 781 |
781 if (channel->type->inithandler) { | 782 if (channel->type->inithandler) { |
782 ret = channel->type->inithandler(channel); | 783 ret = channel->type->inithandler(channel); |
783 if (ret >= 0) { | 784 if (ret > 0) { |
784 errtype = ret; | 785 errtype = ret; |
785 deletechannel(channel); | 786 deletechannel(channel); |
787 TRACE(("inithandler returned failure %d", ret)); | |
786 goto failure; | 788 goto failure; |
787 } | 789 } |
788 } | 790 } |
789 | 791 |
790 #if 0 | 792 #if 0 |
808 send_msg_channel_open_confirmation(channel, channel->recvwindow, | 810 send_msg_channel_open_confirmation(channel, channel->recvwindow, |
809 channel->recvmaxpacket); | 811 channel->recvmaxpacket); |
810 goto cleanup; | 812 goto cleanup; |
811 | 813 |
812 failure: | 814 failure: |
815 TRACE(("recv_msg_channel_open failure")); | |
813 send_msg_channel_open_failure(remotechan, errtype, "", ""); | 816 send_msg_channel_open_failure(remotechan, errtype, "", ""); |
814 | 817 |
815 cleanup: | 818 cleanup: |
816 m_free(type); | 819 m_free(type); |
817 | 820 |