~ubuntu-branches/debian/sid/postfix/sid

« back to all changes in this revision

Viewing changes to src/global/match_service.c

  • Committer: Package Import Robot
  • Author(s): LaMont Jones, LaMont Jones, localization folks
  • Date: 2014-02-11 07:44:30 UTC
  • mfrom: (1.1.41)
  • Revision ID: package-import@ubuntu.com-20140211074430-91tdwgjriazawdz4
Tags: 2.11.0-1
[LaMont Jones]

* New upstream release: 2.11.0

[localization folks]

* l10n: Updated German translations.  Closes: #734893 (Helge Kreutzmann)

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
/*      that it does not drag in all the LDAP, SQL and other map
27
27
/*      lookup client code into programs that don't need it.
28
28
/*
29
 
/*      Each pattern is of the form "name.type" or "type", where
 
29
/*      Each pattern is of the form "name/type" or "type", where
30
30
/*      "name" and "type" are the first two fields of a master.cf
31
31
/*      entry. Patterns are separated by whitespace and/or commas.
32
32
/*      Matches are case insensitive. Patterns are matched in the
34
34
/*      match.  In order to reverse the result of a pattern match,
35
35
/*      precede a pattern with an exclamation point (!).
36
36
/*
 
37
/*      For backwards compatibility, the form name.type is still
 
38
/*      supported.
 
39
/*
37
40
/*      match_service_init() parses the pattern list. The result
38
41
/*      must be passed to match_service_match() or match_service_free().
39
42
/*
78
81
#include <stringops.h>
79
82
#include <match_service.h>
80
83
 
 
84
/* match_service_compat - backwards compatibility */
 
85
 
 
86
static void match_service_compat(ARGV *argv)
 
87
{
 
88
    char  **cpp;
 
89
    char   *cp;
 
90
 
 
91
    for (cpp = argv->argv; *cpp; cpp++) {
 
92
        if (strrchr(*cpp, '/') == 0 && (cp = strrchr(*cpp, '.')) != 0)
 
93
            *cp = '/';
 
94
    }
 
95
}
 
96
 
81
97
/* match_service_init - initialize pattern list */
82
98
 
83
99
ARGV   *match_service_init(const char *patterns)
92
108
        argv_add(list, item, (char *) 0);
93
109
    argv_terminate(list);
94
110
    myfree(saved_patterns);
 
111
    match_service_compat(list);
95
112
    return (list);
96
113
}
97
114
 
105
122
    for (cpp = patterns; *cpp; cpp++)
106
123
        argv_add(list, *cpp, (char *) 0);
107
124
    argv_terminate(list);
 
125
    match_service_compat(list);
108
126
    return (list);
109
127
}
110
128
 
127
145
    /*
128
146
     * Sanity check.
129
147
     */
130
 
    if ((type = strrchr(name_type, '.')) == 0 || *++type == 0)
131
 
        msg_panic("%s: malformed service: \"%s\"; need \"name.type\" format",
 
148
    if ((type = strrchr(name_type, '/')) == 0 || *++type == 0)
 
149
        msg_panic("%s: malformed service: \"%s\"; need \"name/type\" format",
132
150
                  myname, name_type);
133
151
 
134
152
    /*
139
157
            msg_info("%s: %s ~? %s", myname, name_type, pattern);
140
158
        for (match = 1; *pattern == '!'; pattern++)
141
159
            match = !match;
142
 
        if (strcasecmp(strchr(pattern, '.') ? name_type : type, pattern) == 0) {
 
160
        if (strcasecmp(strchr(pattern, '/') ? name_type : type, pattern) == 0) {
143
161
            if (msg_verbose)
144
162
                msg_info("%s: %s: found match", myname, name_type);
145
163
            return (match);