1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-03 08:13:14 +02:00
Files
unrealircd/src/res_skipname.c
T
2000-05-28 08:55:44 +00:00

36 lines
591 B
C

#include <sys/types.h>
#include <stdio.h>
#include "nameser.h"
#include "common.h"
ID_CVS("$Id$");
/*
* Skip over a compressed domain name. Return the size or -1.
*/
dn_skipname(comp_dn, eom)
u_char *comp_dn, *eom;
{
register u_char *cp;
register int n;
cp = comp_dn;
while (cp < eom && (n = *cp++))
{
/*
* check for indirection
*/
switch (n & INDIR_MASK)
{
case 0: /* normal case, n == len */
cp += n;
continue;
default: /* illegal type */
return (-1);
case INDIR_MASK: /* indirection */
cp++;
}
break;
}
return (cp - comp_dn);
}