Navigation


Changeset 738:d666051658bd in freeDiameter for extensions


Ignore:
Timestamp:
Mar 2, 2011, 6:21:59 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Fix broken 'almostcasecmp' logic

Location:
extensions
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/app_radgw/rgw_clients.c

    r718 r738  
    732732               
    733733                /* first, check if the nas_id is the fqdn of the peer or a known alias */
    734                 if (!fd_os_almostcasecmp(nas_id + 1, nas_id_len,
    735                                                 cli->fqdn, cli->fqdn_len)) {
     734                if (!fd_os_almostcasesrch(nas_id + 1, nas_id_len,
     735                                                cli->fqdn, cli->fqdn_len, NULL)) {
    736736                        TRACE_DEBUG(FULL, "NAS-Identifier contains the fqdn of the client");
    737737                        found = 1;
  • extensions/app_redirect/ard_rules.c

    r723 r738  
    9494       
    9595        if (c->is_regex == 0) {
    96                 if ( ! fd_os_almostcasecmp(c->s, c->sl, s, l) )
     96                if ( ! fd_os_almostcasesrch(c->s, c->sl, s, l, NULL) )
    9797                        *match = 1;
    9898        } else {
  • extensions/rt_redirect/redir_fwd.c

    r717 r738  
    150150                                                for (li = task.rh.next; li != &task.rh; li = li->next) {
    151151                                                        struct redir_host * nhost = li->o;
    152                                                         if ( fd_os_almostcasecmp(id, len, nhost->id, nhost->len) <= 0 )
     152                                                        if ( fd_os_cmp(id, len, nhost->id, nhost->len) <= 0 )
    153153                                                                break;
    154154                                                }
  • extensions/rt_redirect/redir_out.c

    r717 r738  
    171171                /* Special case: ALL_HOST rules: we decrease the score of the Origin-Host if present */
    172172                if (e->type == ALL_HOST) {
    173                         cmp = fd_os_almostcasecmp(cand->diamid, cand->diamidlen, e->data.host.s, e->data.host.l);
     173                        cmp = fd_os_almostcasesrch(cand->diamid, cand->diamidlen, e->data.host.s, e->data.host.l, NULL);
    174174                        if (!cmp) {
    175175                                TRACE_DEBUG(FULL, "Redirect msg %p: peer '%.*s' += %d (previous ALL_HOST Redirect originated from this peer)", msg, cand->diamidlen, cand->diamid, FD_SCORE_SENT_REDIRECT);
     
    198198                struct rtd_candidate * cand = (struct rtd_candidate *) lic;
    199199               
    200                 /* Is this candidate in the "Redirect-Host" list ? */
     200                /* Is this candidate in the "Redirect-Host" list ? We must search caseinsentive here. */
    201201                for (lirh = e->target_peers_list.next; lirh != &e->target_peers_list; lirh = lirh->next) {
    202202                        struct redir_host * host = lirh->o;
    203                        
    204                         cmp = fd_os_cmp( cand->diamid, cand->diamidlen, host->id, host->len );
    205                        
    206                         if (cmp < 0)
    207                                 break; /* targets are ordered */
     203                        int cont;
     204                       
     205                        cmp = fd_os_almostcasesrch( cand->diamid, cand->diamidlen, host->id, host->len, &cont );
    208206                       
    209207                        if (cmp == 0) {
    210208                                TRACE_DEBUG(FULL, "Redirect msg %p: peer '%.*s' += %d (rule t:%d @%p)", msg, cand->diamidlen, cand->diamid, redirects_usages[e->type].score, e->type, e);
    211209                                cand->score += redirects_usages[e->type].score;
    212                         }
     210                                break;
     211                        }
     212                        if (!cont)
     213                                break;
    213214                }
    214215        }
Note: See TracChangeset for help on using the changeset viewer.