diff -ruN inn-2.4.2/innd/art.c inn-2.4.2-new/innd/art.c
old
|
new
|
|
1547 | 1547 | } |
1548 | 1548 | |
1549 | 1549 | /* |
| 1550 | ** Return true if an element of the QHASHLIST matches the |
| 1551 | ** quickhash of the message-id. |
| 1552 | */ |
| 1553 | static bool |
| 1554 | QHashMatch(QHASHLIST *qh, char *MessageID) |
| 1555 | { |
| 1556 | unsigned char *p = (unsigned char *)MessageID; |
| 1557 | int h = 0; |
| 1558 | |
| 1559 | while (*p) |
| 1560 | h += *p++; |
| 1561 | |
| 1562 | while (qh) { |
| 1563 | if ((h % qh->mod + 1) >= qh->begin && |
| 1564 | (h % qh->mod + 1) <= qh->end) |
| 1565 | return true; |
| 1566 | qh = qh->next; |
| 1567 | } |
| 1568 | |
| 1569 | return false; |
| 1570 | } |
| 1571 | |
| 1572 | /* |
1550 | 1573 | ** Propagate an article to the sites have "expressed an interest." |
1551 | 1574 | */ |
1552 | 1575 | static void |
… |
… |
|
1619 | 1642 | * cross-posting. */ |
1620 | 1643 | continue; |
1621 | 1644 | |
| 1645 | if (sp->QHashList && !QHashMatch(sp->QHashList, HDR(HDR__MESSAGE_ID))) |
| 1646 | /* quickhash doesn't match */ |
| 1647 | continue; |
| 1648 | |
1622 | 1649 | if (list && *list != NULL && sp->Distributions && |
1623 | 1650 | !DISTwantany(sp->Distributions, list)) |
1624 | 1651 | /* Not in the site's desired list of distributions. */ |
diff -ruN inn-2.4.2/innd/innd.h inn-2.4.2-new/innd/innd.h
old
|
new
|
|
407 | 407 | |
408 | 408 | |
409 | 409 | /* |
| 410 | ** Diablo-style hashed feeds or hashfeeds. |
| 411 | */ |
| 412 | typedef struct _QHASHLIST { |
| 413 | int begin; |
| 414 | int end; |
| 415 | int mod; |
| 416 | struct _QHASHLIST *next; |
| 417 | } QHASHLIST; |
| 418 | |
| 419 | |
| 420 | /* |
410 | 421 | ** A site may reject something in its subscription list if it has |
411 | 422 | ** too many hops, or a bad distribution. |
412 | 423 | */ |
… |
… |
|
458 | 469 | struct buffer Buffer; |
459 | 470 | bool Buffered; |
460 | 471 | char ** Originator; |
| 472 | QHASHLIST * QHashList; |
461 | 473 | int Next; |
462 | 474 | int Prev; |
463 | 475 | } SITE; |
diff -ruN inn-2.4.2/innd/newsfeeds.c inn-2.4.2-new/innd/newsfeeds.c
old
|
new
|
|
448 | 448 | int isp; |
449 | 449 | SITE *nsp; |
450 | 450 | struct buffer b; |
| 451 | QHASHLIST *qh; |
451 | 452 | |
452 | 453 | b = sp->Buffer; |
453 | 454 | *sp = SITEnull; |
… |
… |
|
467 | 468 | sp->NeedOverviewCreation = false; |
468 | 469 | sp->FeedwithoutOriginator = false; |
469 | 470 | sp->DropFiltered = false; |
| 471 | sp->QHashList = NULL; |
470 | 472 | |
471 | 473 | /* Nip off the first field, the site name. */ |
472 | 474 | if ((f2 = strchr(Entry, NF_FIELD_SEP)) == NULL) |
… |
… |
|
603 | 605 | if (*++p && CTYPE(isdigit, *p)) |
604 | 606 | sp->Nice = atoi(p); |
605 | 607 | break; |
| 608 | case 'Q': |
| 609 | qh = xmalloc(sizeof(QHASHLIST)); |
| 610 | p++; |
| 611 | if (sscanf(p, "%d/%d", &qh->begin, &qh->mod) == 2) { |
| 612 | qh->end = qh->begin; |
| 613 | } else if (sscanf(p, "%d-%d/%d", &qh->begin, &qh->end, &qh->mod) != 3) { |
| 614 | free(qh); |
| 615 | return "hash not in x/z or x-y/z format"; |
| 616 | } |
| 617 | qh->next = sp->QHashList; |
| 618 | sp->QHashList = qh; |
| 619 | break; |
606 | 620 | case 'S': |
607 | 621 | if (*++p && CTYPE(isdigit, *p)) |
608 | 622 | sp->StartSpooling = atol(p); |
diff -ruN inn-2.4.2/innd/site.c inn-2.4.2-new/innd/site.c
old
|
new
|
|
997 | 997 | SITEfree(SITE *sp) |
998 | 998 | { |
999 | 999 | SITE *s; |
| 1000 | QHASHLIST *qh, *qn; |
1000 | 1001 | int new; |
1001 | 1002 | int i; |
1002 | 1003 | |
… |
… |
|
1051 | 1052 | sp->FNLnames.data = NULL; |
1052 | 1053 | sp->FNLnames.size = 0; |
1053 | 1054 | } |
| 1055 | if (sp->QHashList) { |
| 1056 | for (qh = sp->QHashList; qh; qh = qn) { |
| 1057 | qn = qh->next; |
| 1058 | free(qh); |
| 1059 | } |
| 1060 | sp->QHashList = NULL; |
| 1061 | } |
1054 | 1062 | |
1055 | 1063 | /* If this site was a master, find a new one. */ |
1056 | 1064 | if (sp->IsMaster) { |