Ignore:
Timestamp:
Oct 10, 2009, 7:16:21 PM (13 years ago)
Author:
charles
Message:

(trunk libT) #2489: tr_torrentSetAnnounceList() should check for invalid and duplicate announce URLs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/torrent.c

    r9251 r9274  
    20122012***/
    20132013
    2014 void
     2014tr_announce_list_err
    20152015tr_torrentSetAnnounceList( tr_torrent *            tor,
    20162016                           const tr_tracker_info * trackers,
    20172017                           int                     trackerCount )
    20182018{
     2019    int i, j;
    20192020    tr_benc metainfo;
    20202021
    20212022    assert( tr_isTorrent( tor ) );
     2023
     2024    /* look for bad URLs */
     2025    for( i=0; i<trackerCount; ++i )
     2026        if( !tr_httpIsValidURL( trackers[i].announce ) )
     2027            return TR_ANNOUNCE_LIST_HAS_BAD;
     2028
     2029    /* look for duplicates */
     2030    for( i=0; i<trackerCount; ++i )
     2031        for( j=0; j<trackerCount; ++j )
     2032            if(    ( i != j )
     2033                && ( trackers[i].tier == trackers[j].tier)
     2034                && ( !strcmp( trackers[i].announce, trackers[j].announce ) ) )
     2035                    return TR_ANNOUNCE_LIST_HAS_DUPLICATES;
    20222036
    20232037    /* save to the .torrent file */
     
    20692083        tr_announcerResetTorrent( tor->session->announcer, tor );
    20702084    }
     2085
     2086    return TR_ANNOUNCE_LIST_OK;
    20712087}
    20722088
Note: See TracChangeset for help on using the changeset viewer.