summaryrefslogtreecommitdiffstats
path: root/src/global/match_parent_style.c
blob: 0ec6b2e229d384e5a651b44ee99bd6e1441b00b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*++
/* NAME
/*	match_parent_style 3
/* SUMMARY
/*	parent domain matching control
/* SYNOPSIS
/*	#include <match_parent_style.h>
/*
/*	int	match_parent_style(name)
/*	const char *name;
/* DESCRIPTION
/*	This module queries configuration parameters for the policy that
/*	controls how wild-card parent domain names are used by various
/*	postfix lookup mechanisms.
/*
/*	match_parent_style() looks up "name" in the
/*	parent_domain_matches_subdomain configuration parameter
/*	and returns either MATCH_FLAG_PARENT (parent domain matches
/*	subdomains) or MATCH_FLAG_NONE.
/* DIAGNOSTICS
/*	Fatal error: out of memory, name listed under both parent wild card
/*	matching policies.
/* SEE ALSO
/*	string_list(3) plain string matching
/*	domain_list(3) match host name patterns
/*	namadr_list(3) match host name/address patterns
/* LICENSE
/* .ad
/* .fi
/*	The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/*	Wietse Venema
/*	IBM T.J. Watson Research
/*	P.O. Box 704
/*	Yorktown Heights, NY 10598, USA
/*--*/

/* System library. */

#include <sys_defs.h>

/* Utility library. */

/* Global library. */

#include <string_list.h>
#include <mail_params.h>
#include <match_parent_style.h>

/* Application-specific. */

static STRING_LIST *match_par_dom_list;

int     match_parent_style(const char *name)
{
    int     result;

    /*
     * Initialize on the fly.
     */
    if (match_par_dom_list == 0)
	match_par_dom_list =
	    string_list_init(VAR_PAR_DOM_MATCH, MATCH_FLAG_NONE,
			     var_par_dom_match);

    /*
     * Look up the parent domain matching policy.
     */
    if (string_list_match(match_par_dom_list, name))
	result = MATCH_FLAG_PARENT;
    else
	result = 0;
    return (result);
}