Mercurial > dropbear
comparison tcp-accept.c @ 165:0cfba3034be5
Fixed DEBUG_TRACE macro so that we don't get semicolons left about the place
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Sun, 02 Jan 2005 20:25:56 +0000 |
parents | e3adf4cf5465 |
children | 306499676384 |
comparison
equal
deleted
inserted
replaced
161:b9d3f725e00b | 165:0cfba3034be5 |
---|---|
85 int socks[DROPBEAR_MAX_SOCKS]; | 85 int socks[DROPBEAR_MAX_SOCKS]; |
86 struct Listener *listener = NULL; | 86 struct Listener *listener = NULL; |
87 int nsocks; | 87 int nsocks; |
88 char* errstring = NULL; | 88 char* errstring = NULL; |
89 | 89 |
90 TRACE(("enter listen_tcpfwd")); | 90 TRACE(("enter listen_tcpfwd")) |
91 | 91 |
92 /* first we try to bind, so don't need to do so much cleanup on failure */ | 92 /* first we try to bind, so don't need to do so much cleanup on failure */ |
93 snprintf(portstring, sizeof(portstring), "%d", tcpinfo->listenport); | 93 snprintf(portstring, sizeof(portstring), "%d", tcpinfo->listenport); |
94 | 94 |
95 /* XXX Note: we're just listening on localhost, no matter what they tell | 95 /* XXX Note: we're just listening on localhost, no matter what they tell |
98 nsocks = dropbear_listen("", portstring, socks, | 98 nsocks = dropbear_listen("", portstring, socks, |
99 DROPBEAR_MAX_SOCKS, &errstring, &ses.maxfd); | 99 DROPBEAR_MAX_SOCKS, &errstring, &ses.maxfd); |
100 if (nsocks < 0) { | 100 if (nsocks < 0) { |
101 dropbear_log(LOG_INFO, "TCP forward failed: %s", errstring); | 101 dropbear_log(LOG_INFO, "TCP forward failed: %s", errstring); |
102 m_free(errstring); | 102 m_free(errstring); |
103 TRACE(("leave listen_tcpfwd: dropbear_listen failed")); | 103 TRACE(("leave listen_tcpfwd: dropbear_listen failed")) |
104 return DROPBEAR_FAILURE; | 104 return DROPBEAR_FAILURE; |
105 } | 105 } |
106 | 106 |
107 listener = new_listener(socks, nsocks, CHANNEL_ID_TCPFORWARDED, tcpinfo, | 107 listener = new_listener(socks, nsocks, CHANNEL_ID_TCPFORWARDED, tcpinfo, |
108 tcp_acceptor, cleanup_tcp); | 108 tcp_acceptor, cleanup_tcp); |
109 | 109 |
110 if (listener == NULL) { | 110 if (listener == NULL) { |
111 m_free(tcpinfo); | 111 m_free(tcpinfo); |
112 TRACE(("leave listen_tcpfwd: listener failed")); | 112 TRACE(("leave listen_tcpfwd: listener failed")) |
113 return DROPBEAR_FAILURE; | 113 return DROPBEAR_FAILURE; |
114 } | 114 } |
115 | 115 |
116 TRACE(("leave listen_tcpfwd: success")); | 116 TRACE(("leave listen_tcpfwd: success")) |
117 return DROPBEAR_SUCCESS; | 117 return DROPBEAR_SUCCESS; |
118 } | 118 } |
119 | 119 |
120 #endif /* DROPBEAR_TCP_ACCEPT */ | 120 #endif /* DROPBEAR_TCP_ACCEPT */ |