~ubuntu-branches/ubuntu/saucy/postfix/saucy

« back to all changes in this revision

Viewing changes to src/postscreen/postscreen_dnsbl.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, Wietse Venema
  • Date: 2011-03-22 10:37:24 UTC
  • mfrom: (1.1.29 upstream)
  • Revision ID: james.westby@ubuntu.com-20110322103724-k0v7crojhfxn8i61
Tags: 2.8.2-1
[Wietse Venema]

new upstream, various bug fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
    int     total;                      /* combined blocklist score */
144
144
    int     refcount;                   /* score reference count */
145
145
    int     pending_lookups;            /* nr of DNS requests in flight */
 
146
    int     request_id;                 /* duplicate suppression */
146
147
    /* Call-back table support. */
147
148
    int     index;                      /* next table index */
148
149
    int     limit;                      /* last valid index */
344
345
    PSC_DNSBL_HEAD *head;
345
346
    PSC_DNSBL_SITE *site;
346
347
    ARGV   *reply_argv;
 
348
    int     request_id;
347
349
 
348
350
    PSC_CLEAR_EVENT_REQUEST(vstream_fileno(stream), psc_dnsbl_receive, context);
349
351
 
367
369
                     ATTR_FLAG_STRICT,
368
370
                     ATTR_TYPE_STR, MAIL_ATTR_RBL_DOMAIN, reply_dnsbl,
369
371
                     ATTR_TYPE_STR, MAIL_ATTR_ACT_CLIENT_ADDR, reply_client,
 
372
                     ATTR_TYPE_INT, MAIL_ATTR_LABEL, &request_id,
370
373
                     ATTR_TYPE_STR, MAIL_ATTR_RBL_ADDR, reply_addr,
371
 
                     ATTR_TYPE_END) == 3
 
374
                     ATTR_TYPE_END) == 4
372
375
        && (score = (PSC_DNSBL_SCORE *)
373
 
            htable_find(dnsbl_score_cache, STR(reply_client))) != 0) {
 
376
            htable_find(dnsbl_score_cache, STR(reply_client))) != 0
 
377
        && score->request_id == request_id) {
374
378
 
375
379
        /*
376
380
         * Run this response past all applicable DNSBL filters and update the
429
433
    HTABLE_INFO **ht;
430
434
    PSC_DNSBL_SCORE *score;
431
435
    HTABLE_INFO *hash_node;
 
436
    static int request_count;
432
437
 
433
438
    /*
434
439
     * Some spambots make several connections at nearly the same time,
468
473
    if (msg_verbose > 1)
469
474
        msg_info("%s: create blocklist score for %s", myname, client_addr);
470
475
    score = (PSC_DNSBL_SCORE *) mymalloc(sizeof(*score));
 
476
    score->request_id = request_count++;
471
477
    score->dnsbl = 0;
472
478
    score->total = 0;
473
479
    score->refcount = 1;
492
498
        attr_print(stream, ATTR_FLAG_NONE,
493
499
                   ATTR_TYPE_STR, MAIL_ATTR_RBL_DOMAIN, ht[0]->key,
494
500
                   ATTR_TYPE_STR, MAIL_ATTR_ACT_CLIENT_ADDR, client_addr,
 
501
                   ATTR_TYPE_INT, MAIL_ATTR_LABEL, score->request_id,
495
502
                   ATTR_TYPE_END);
496
503
        if (vstream_fflush(stream) != 0) {
497
504
            msg_warn("%s: error sending to %s service: %m",