hostmatch(3)

NAME
hostmatch() - see if given host matches netperm-table host entry

SYNOPSIS
#include "fwfunc.h"

int hostmatch(char *pattern,char *name)

DESCRIPTION
hostmatch is generic host pattern match function used when determining if source or destination addresses match vaules configured in netperm-table.

name can be fqdn or dot-delimited ip as text string.

if the name is dot-delimited ip and the pattern is fqdn-based, a reverse lookup and attempt to resolve returned name are performed. if some of those fail, 'unknown' is assumed for matching function as name.

RETURN VALUES
the function returns 0 if host does not match (incuding all error conditions, unresolvable name and so on) or 1 if it does.

SECURITY CONDITIONS
name or pattern too long (exceed builtin limit, currently 512 characters),

action: fwtkcfgerr is generated, 0 returned

address entry returned by name lookup exceeds sizeof appropriate structure, action: 'invalid host address length' securityalert is generated, 0 returned.

no ip addresses of hostnames returned by lookup match name initially specified,

action: match as 'unknown' is performed, a 'possible spoof' securityalert is generated.

SEE ALSO
getpeername(3),ip2name(3),peername(3),namatch(3)

HISTORY
present in fwtk since v1