@@ -233,44 +233,51 @@ check_reject(rb_fde_t *F, struct sockaddr *addr)
233
233
rb_patricia_node_t * pnode ;
234
234
reject_t * rdata ;
235
235
delay_t * ddata ;
236
+
236
237
/* Reject is disabled */
237
- if (ConfigFileEntry .reject_after_count == 0 || ConfigFileEntry .reject_duration == 0 )
238
+ if (ConfigFileEntry .reject_after_count == 0 || ConfigFileEntry .reject_duration == 0 )
238
239
return 0 ;
239
240
240
241
pnode = rb_match_ip (reject_tree , addr );
241
- if (pnode != NULL )
242
+ if (pnode == NULL )
243
+ return 0 ;
244
+
245
+ rdata = pnode -> data ;
246
+ rdata -> time = rb_current_time ();
247
+
248
+ if (rdata -> count <= (unsigned long )ConfigFileEntry .reject_after_count )
249
+ return 0 ;
250
+
251
+ if (rdata -> aconf != NULL && rdata -> aconf -> status & CONF_ILLEGAL )
242
252
{
243
- rdata = pnode -> data ;
253
+ rb_dlinkDelete (& rdata -> rnode , & reject_list );
254
+ reject_free (rdata );
255
+ rb_patricia_remove (reject_tree , pnode );
256
+ return 0 ;
257
+ }
244
258
245
- rdata -> time = rb_current_time ();
246
- if (rdata -> count > (unsigned long )ConfigFileEntry .reject_after_count )
247
- {
248
- ddata = rb_malloc (sizeof (delay_t ));
249
- ServerStats .is_rej ++ ;
250
- rb_setselect (F , RB_SELECT_WRITE | RB_SELECT_READ , NULL , NULL );
251
- if (rdata -> aconf )
252
- {
253
- ddata -> aconf = rdata -> aconf ;
254
- ddata -> aconf -> clients ++ ;
255
- ddata -> reason = NULL ;
256
- }
257
- else if (rdata -> reason )
258
- {
259
- ddata -> reason = rdata -> reason ;
260
- ddata -> aconf = NULL ;
261
- }
262
- else
263
- {
264
- ddata -> aconf = NULL ;
265
- ddata -> reason = NULL ;
266
- }
267
- ddata -> F = F ;
268
- rb_dlinkAdd (ddata , & ddata -> node , & delay_exit );
269
- return 1 ;
270
- }
259
+ ddata = rb_malloc (sizeof (delay_t ));
260
+ ServerStats .is_rej ++ ;
261
+ rb_setselect (F , RB_SELECT_WRITE | RB_SELECT_READ , NULL , NULL );
262
+ if (rdata -> aconf )
263
+ {
264
+ ddata -> aconf = rdata -> aconf ;
265
+ ddata -> aconf -> clients ++ ;
266
+ ddata -> reason = NULL ;
271
267
}
272
- /* Caller does what it wants */
273
- return 0 ;
268
+ else if (rdata -> reason )
269
+ {
270
+ ddata -> reason = rdata -> reason ;
271
+ ddata -> aconf = NULL ;
272
+ }
273
+ else
274
+ {
275
+ ddata -> aconf = NULL ;
276
+ ddata -> reason = NULL ;
277
+ }
278
+ ddata -> F = F ;
279
+ rb_dlinkAdd (ddata , & ddata -> node , & delay_exit );
280
+ return 1 ;
274
281
}
275
282
276
283
int
0 commit comments