Mercurial > dropbear
comparison cli-tcpfwd.c @ 1219:84cf9062718d coverity
merge
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 15 Dec 2015 22:24:34 +0800 |
parents | d058e15ea213 |
children | 888e3d17e962 2bb4c662d1c2 |
comparison
equal
deleted
inserted
replaced
1196:a29559086628 | 1219:84cf9062718d |
---|---|
58 NULL, | 58 NULL, |
59 NULL | 59 NULL |
60 }; | 60 }; |
61 #endif | 61 #endif |
62 | 62 |
63 #ifdef ENABLE_CLI_ANYTCPFWD | |
64 static void fwd_failed(const char* format, ...) ATTRIB_PRINTF(1,2); | |
65 void fwd_failed(const char* format, ...) | |
66 { | |
67 va_list param; | |
68 va_start(param, format); | |
69 | |
70 if (cli_opts.exit_on_fwd_failure) { | |
71 _dropbear_exit(EXIT_FAILURE, format, param); | |
72 } else { | |
73 _dropbear_log(LOG_WARNING, format, param); | |
74 } | |
75 | |
76 va_end(param); | |
77 } | |
78 #endif | |
79 | |
63 #ifdef ENABLE_CLI_LOCALTCPFWD | 80 #ifdef ENABLE_CLI_LOCALTCPFWD |
64 void setup_localtcp() { | 81 void setup_localtcp() { |
65 m_list_elem *iter; | 82 m_list_elem *iter; |
66 int ret; | 83 int ret; |
67 | 84 |
73 fwd->listenaddr, | 90 fwd->listenaddr, |
74 fwd->listenport, | 91 fwd->listenport, |
75 fwd->connectaddr, | 92 fwd->connectaddr, |
76 fwd->connectport); | 93 fwd->connectport); |
77 if (ret == DROPBEAR_FAILURE) { | 94 if (ret == DROPBEAR_FAILURE) { |
78 dropbear_log(LOG_WARNING, "Failed local port forward %s:%d:%s:%d", | 95 fwd_failed("Failed local port forward %s:%d:%s:%d", |
79 fwd->listenaddr, | 96 fwd->listenaddr, |
80 fwd->listenport, | 97 fwd->listenport, |
81 fwd->connectaddr, | 98 fwd->connectaddr, |
82 fwd->connectport); | 99 fwd->connectport); |
83 } | 100 } |
179 m_list_elem *iter; | 196 m_list_elem *iter; |
180 for (iter = cli_opts.remotefwds->first; iter; iter = iter->next) { | 197 for (iter = cli_opts.remotefwds->first; iter; iter = iter->next) { |
181 struct TCPFwdEntry *fwd = (struct TCPFwdEntry*)iter->item; | 198 struct TCPFwdEntry *fwd = (struct TCPFwdEntry*)iter->item; |
182 if (!fwd->have_reply) { | 199 if (!fwd->have_reply) { |
183 fwd->have_reply = 1; | 200 fwd->have_reply = 1; |
184 dropbear_log(LOG_WARNING, "Remote TCP forward request failed (port %d -> %s:%d)", fwd->listenport, fwd->connectaddr, fwd->connectport); | 201 fwd_failed("Remote TCP forward request failed (port %d -> %s:%d)", |
202 fwd->listenport, | |
203 fwd->connectaddr, | |
204 fwd->connectport); | |
185 return; | 205 return; |
186 } | 206 } |
187 } | 207 } |
188 } | 208 } |
189 | 209 |