File: dns_dnequ.c

package info (click to toggle)
rbldnsd 0.998b~pre1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 744 kB
  • ctags: 1,132
  • sloc: ansic: 8,212; python: 549; sh: 502; makefile: 249; awk: 33
file content (21 lines) | stat: -rw-r--r-- 391 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* dns_dneq(): compare to domain names and return true if equal
 * (case-unsensitive)
 */

#include "dns.h"

int dns_dnequ(const unsigned char *dn1, const unsigned char *dn2) {
  unsigned c;

  for(;;) {
    if ((c = *dn1++) != *dn2++)
      return 0;
    if (!c)
      return 1;
    while(c--) {
      if (dns_dnlc(*dn1) != dns_dnlc(*dn2))
        return 0;
      ++dn1; ++dn2;
    }
  }
}