@@ -156,16 +156,17 @@ protoautossl_setup_dst_new_bev_ssl_connecting(pxy_conn_ctx_t *ctx)
156156 return 0 ;
157157}
158158
159- static void NONNULL (1 )
159+ static int NONNULL (1 ) WUNRES
160160protoautossl_upgrade_dst (pxy_conn_ctx_t * ctx )
161161{
162162 if (protossl_setup_dst_ssl (ctx ) == -1 ) {
163- return ;
163+ return -1 ;
164164 }
165165 if (protoautossl_setup_dst_new_bev_ssl_connecting (ctx ) == -1 ) {
166- return ;
166+ return -1 ;
167167 }
168168 bufferevent_setcb (ctx -> dst .bev , pxy_bev_readcb , pxy_bev_writecb , pxy_bev_eventcb , ctx );
169+ return 0 ;
169170}
170171
171172static int NONNULL (1 ) WUNRES
@@ -184,16 +185,17 @@ protoautossl_setup_srvdst_new_bev_ssl_connecting(pxy_conn_ctx_t *ctx)
184185 return 0 ;
185186}
186187
187- static void NONNULL (1 )
188+ static int NONNULL (1 ) WUNRES
188189protoautossl_upgrade_srvdst (pxy_conn_ctx_t * ctx )
189190{
190191 if (protossl_setup_srvdst_ssl (ctx ) == -1 ) {
191- return ;
192+ return -1 ;
192193 }
193194 if (protoautossl_setup_srvdst_new_bev_ssl_connecting (ctx ) == -1 ) {
194- return ;
195+ return -1 ;
195196 }
196197 bufferevent_setcb (ctx -> srvdst .bev , pxy_bev_readcb , pxy_bev_writecb , pxy_bev_eventcb , ctx );
198+ return 0 ;
197199}
198200
199201static int NONNULL (1 ) WUNRES
@@ -212,16 +214,17 @@ protoautossl_setup_dst_new_bev_ssl_connecting_child(pxy_conn_child_ctx_t *ctx)
212214 return 0 ;
213215}
214216
215- static void NONNULL (1 )
217+ static int NONNULL (1 ) WUNRES
216218protoautossl_upgrade_dst_child (pxy_conn_child_ctx_t * ctx )
217219{
218220 if (protossl_setup_dst_ssl_child (ctx ) == -1 ) {
219- return ;
221+ return -1 ;
220222 }
221223 if (protoautossl_setup_dst_new_bev_ssl_connecting_child (ctx ) == -1 ) {
222- return ;
224+ return -1 ;
223225 }
224226 bufferevent_setcb (ctx -> dst .bev , pxy_bev_readcb_child , pxy_bev_writecb_child , pxy_bev_eventcb_child , ctx );
227+ return 0 ;
225228}
226229
227230/*
@@ -266,13 +269,17 @@ protoautossl_peek_and_upgrade(pxy_conn_ctx_t *ctx)
266269 // This means that there was no autossl handshake prior to ClientHello, e.g. no STARTTLS message
267270 // This is perhaps the SSL handshake of a direct SSL connection
268271 log_fine ("Upgrading srvdst, no child conn set up yet" );
269- protoautossl_upgrade_srvdst (ctx );
272+ if (protoautossl_upgrade_srvdst (ctx ) == -1 ) {
273+ return -1 ;
274+ }
270275 bufferevent_enable (ctx -> srvdst .bev , EV_READ |EV_WRITE );
271276 }
272277 else {
273278 // @attention Autossl protocol should never have multiple children.
274279 log_fine ("Upgrading child dst" );
275- protoautossl_upgrade_dst_child (ctx -> children );
280+ if (protoautossl_upgrade_dst_child (ctx -> children ) == -1 ) {
281+ return -1 ;
282+ }
276283 }
277284
278285 // Change p in sslproxy_header to s
@@ -289,7 +296,9 @@ protoautossl_peek_and_upgrade(pxy_conn_ctx_t *ctx)
289296 }
290297 } else {
291298 // srvdst == dst in split mode
292- protoautossl_upgrade_dst (ctx );
299+ if (protoautossl_upgrade_dst (ctx ) == -1 ) {
300+ return -1 ;
301+ }
293302 bufferevent_enable (ctx -> dst .bev , EV_READ |EV_WRITE );
294303 }
295304
@@ -554,7 +563,9 @@ protoautossl_bev_eventcb_connected_dst(struct bufferevent *bev, pxy_conn_ctx_t *
554563 if (ctx -> srvdst .bev )
555564 bufferevent_enable (ctx -> srvdst .bev , EV_READ );
556565
557- protoautossl_enable_src (ctx );
566+ if (protoautossl_enable_src (ctx ) == -1 ) {
567+ return ;
568+ }
558569 }
559570
560571 if (autossl_ctx -> clienthello_found ) {
0 commit comments