comparison tcp-accept.c @ 478:d4f32c3443ac dbclient-netcat-alike

propagate from branch 'au.asn.ucc.matt.dropbear' (head f21045c791002d81fc6b8dde6537ea481e513eb2) to branch 'au.asn.ucc.matt.dropbear.dbclient-netcat-alike' (head d1f69334581dc4c35f9ca16aa5355074c9dd315d)
author Matt Johnston <matt@ucc.asn.au>
date Sun, 14 Sep 2008 06:47:51 +0000
parents c216212001fc
children 69e98c45db7c
comparison
equal deleted inserted replaced
296:6b41e2cbf071 478:d4f32c3443ac
102 char portstring[NI_MAXSERV]; 102 char portstring[NI_MAXSERV];
103 int socks[DROPBEAR_MAX_SOCKS]; 103 int socks[DROPBEAR_MAX_SOCKS];
104 struct Listener *listener = NULL; 104 struct Listener *listener = NULL;
105 int nsocks; 105 int nsocks;
106 char* errstring = NULL; 106 char* errstring = NULL;
107 // listen_spec = NULL indicates localhost 107 /* listen_spec = NULL indicates localhost */
108 const char* listen_spec = NULL; 108 const char* listen_spec = NULL;
109 109
110 TRACE(("enter listen_tcpfwd")) 110 TRACE(("enter listen_tcpfwd"))
111 111
112 /* first we try to bind, so don't need to do so much cleanup on failure */ 112 /* first we try to bind, so don't need to do so much cleanup on failure */
124 dropbear_log(LOG_INFO, "TCP forward failed: %s", errstring); 124 dropbear_log(LOG_INFO, "TCP forward failed: %s", errstring);
125 m_free(errstring); 125 m_free(errstring);
126 TRACE(("leave listen_tcpfwd: dropbear_listen failed")) 126 TRACE(("leave listen_tcpfwd: dropbear_listen failed"))
127 return DROPBEAR_FAILURE; 127 return DROPBEAR_FAILURE;
128 } 128 }
129 129 m_free(errstring);
130
131 /* new_listener will close the socks if it fails */
130 listener = new_listener(socks, nsocks, CHANNEL_ID_TCPFORWARDED, tcpinfo, 132 listener = new_listener(socks, nsocks, CHANNEL_ID_TCPFORWARDED, tcpinfo,
131 tcp_acceptor, cleanup_tcp); 133 tcp_acceptor, cleanup_tcp);
132 134
133 if (listener == NULL) { 135 if (listener == NULL) {
134 m_free(tcpinfo);
135 TRACE(("leave listen_tcpfwd: listener failed")) 136 TRACE(("leave listen_tcpfwd: listener failed"))
136 return DROPBEAR_FAILURE; 137 return DROPBEAR_FAILURE;
137 } 138 }
138 139
139 TRACE(("leave listen_tcpfwd: success")) 140 TRACE(("leave listen_tcpfwd: success"))