From: Wietse Venema Date: Sun, 28 Mar 1999 05:00:00 +0000 (-0500) Subject: snapshot-19990328 X-Git-Tag: v20010228~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9f9836bab286312b3217b5d1c86975c1d0393194;p=thirdparty%2Fpostfix.git snapshot-19990328 --- diff --git a/postfix/.indent.pro b/postfix/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/.indent.pro +++ b/postfix/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/bounce/.indent.pro b/postfix/bounce/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/bounce/.indent.pro +++ b/postfix/bounce/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/cleanup/.indent.pro b/postfix/cleanup/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/cleanup/.indent.pro +++ b/postfix/cleanup/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/dns/.indent.pro b/postfix/dns/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/dns/.indent.pro +++ b/postfix/dns/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/fsstone/.indent.pro b/postfix/fsstone/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/fsstone/.indent.pro +++ b/postfix/fsstone/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/global/.indent.pro b/postfix/global/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/global/.indent.pro +++ b/postfix/global/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/global/mail_version.h b/postfix/global/mail_version.h index 49562d6a8..cd0a40af2 100644 --- a/postfix/global/mail_version.h +++ b/postfix/global/mail_version.h @@ -15,7 +15,7 @@ * Version of this program. */ #define VAR_MAIL_VERSION "mail_version" -#define DEF_MAIL_VERSION "Snapshot-19990327" +#define DEF_MAIL_VERSION "Snapshot-19990328" extern char *var_mail_version; /* LICENSE diff --git a/postfix/global/maps.c b/postfix/global/maps.c index 13b9280e5..71cf6b337 100644 --- a/postfix/global/maps.c +++ b/postfix/global/maps.c @@ -6,13 +6,15 @@ /* SYNOPSIS /* #include /* -/* MAPS *maps_create(title, map_names) +/* MAPS *maps_create(title, map_names, flags) /* const char *title; /* const char *map_names; +/* int flags; /* -/* const char *maps_find(maps, key) +/* const char *maps_find(maps, key, flags) /* MAPS *maps; /* const char *key; +/* int flags; /* /* void maps_free(maps) /* MAPS *maps; @@ -26,10 +28,14 @@ /* named dictionaries. /* The result is a handle that must be specified along with all /* other maps_xxx() operations. +/* see dict_open(3) for a description of flags. /* /* maps_find() searches the specified list of dictionaries /* in the specified order for the named key. The result is in /* memory that is overwritten upon each call. +/* The flags argument is either 0 or specifies a filter: +/* for example, DICT_FLAG_FIXED | DICT_FLAG_PATTERN selects +/* dictionaries that have fixed keys or pattern keys. /* /* maps_free() releases storage claimed by maps_create() /* and conveniently returns a null pointer. diff --git a/postfix/local/.indent.pro b/postfix/local/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/local/.indent.pro +++ b/postfix/local/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/master/.indent.pro b/postfix/master/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/master/.indent.pro +++ b/postfix/master/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/pickup/.indent.pro b/postfix/pickup/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/pickup/.indent.pro +++ b/postfix/pickup/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/pipe/.indent.pro b/postfix/pipe/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/pipe/.indent.pro +++ b/postfix/pipe/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/postalias/.indent.pro b/postfix/postalias/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/postalias/.indent.pro +++ b/postfix/postalias/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/postcat/.indent.pro b/postfix/postcat/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/postcat/.indent.pro +++ b/postfix/postcat/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/postconf/.indent.pro b/postfix/postconf/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/postconf/.indent.pro +++ b/postfix/postconf/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/postdrop/.indent.pro b/postfix/postdrop/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/postdrop/.indent.pro +++ b/postfix/postdrop/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/postfix/.indent.pro b/postfix/postfix/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/postfix/.indent.pro +++ b/postfix/postfix/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/postkick/.indent.pro b/postfix/postkick/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/postkick/.indent.pro +++ b/postfix/postkick/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/postlock/.indent.pro b/postfix/postlock/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/postlock/.indent.pro +++ b/postfix/postlock/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/postlog/.indent.pro b/postfix/postlog/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/postlog/.indent.pro +++ b/postfix/postlog/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/postmap/.indent.pro b/postfix/postmap/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/postmap/.indent.pro +++ b/postfix/postmap/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/postsuper/.indent.pro b/postfix/postsuper/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/postsuper/.indent.pro +++ b/postfix/postsuper/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/qmgr/.indent.pro b/postfix/qmgr/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/qmgr/.indent.pro +++ b/postfix/qmgr/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/sendmail/.indent.pro b/postfix/sendmail/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/sendmail/.indent.pro +++ b/postfix/sendmail/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/showq/.indent.pro b/postfix/showq/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/showq/.indent.pro +++ b/postfix/showq/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/smtp/.indent.pro b/postfix/smtp/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/smtp/.indent.pro +++ b/postfix/smtp/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/smtpd/.indent.pro b/postfix/smtpd/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/smtpd/.indent.pro +++ b/postfix/smtpd/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/smtpd/smtpd_check.c b/postfix/smtpd/smtpd_check.c index 88f755fc2..98daaecf4 100644 --- a/postfix/smtpd/smtpd_check.c +++ b/postfix/smtpd/smtpd_check.c @@ -563,7 +563,8 @@ static int reject_unknown_hostname(SMTPD_STATE *state, char *name) if (dns_status != DNS_OK) return (smtpd_check_reject(state, MAIL_ERROR_POLICY, "%d <%s>: Host not found", - var_unk_name_code, name)); + dns_status == DNS_NOTFOUND ? + var_unk_name_code : 450, name)); return (SMTPD_CHECK_DUNNO); } diff --git a/postfix/smtpstone/.indent.pro b/postfix/smtpstone/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/smtpstone/.indent.pro +++ b/postfix/smtpstone/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/trivial-rewrite/.indent.pro b/postfix/trivial-rewrite/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/trivial-rewrite/.indent.pro +++ b/postfix/trivial-rewrite/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/util/.indent.pro b/postfix/util/.indent.pro index f683dc2bc..a39288416 100644 --- a/postfix/util/.indent.pro +++ b/postfix/util/.indent.pro @@ -28,7 +28,7 @@ -TDICT_OPEN_INFO -TDICT_PCRE -TDICT_REGEXP --TDICT_REGEXP_LINE +-TDICT_REGEXP_RULE -TDICT_UNIX -TDNS_FIXED -TDNS_REPLY diff --git a/postfix/util/dict.h b/postfix/util/dict.h index 73f2da441..23c0a3917 100644 --- a/postfix/util/dict.h +++ b/postfix/util/dict.h @@ -37,6 +37,8 @@ typedef struct DICT { #define DICT_FLAG_DUP_IGNORE (1<<1) /* if file, ignore dups */ #define DICT_FLAG_TRY0NULL (1<<2) /* do not append 0 to key/value */ #define DICT_FLAG_TRY1NULL (1<<3) /* append 0 to key/value */ +#define DICT_FLAG_FIXED (1<<4) /* fixed key map */ +#define DICT_FLAG_PATTERN (1<<5) /* keys are patterns */ extern int dict_unknown_allowed; extern int dict_errno; diff --git a/postfix/util/dict_db.c b/postfix/util/dict_db.c index 70d50a59c..c188d5f28 100644 --- a/postfix/util/dict_db.c +++ b/postfix/util/dict_db.c @@ -206,7 +206,7 @@ static DICT *dict_db_open(const char *path, int flags, int type, dict_db->dict.close = dict_db_close; dict_db->dict.fd = db->fd(db); close_on_exec(dict_db->dict.fd, CLOSE_ON_EXEC); - dict_db->dict.flags = dict_flags; + dict_db->dict.flags = dict_flags | DICT_FLAG_FIXED; if ((flags & (DICT_FLAG_TRY1NULL | DICT_FLAG_TRY0NULL)) == 0) dict_db->dict.flags |= (DICT_FLAG_TRY1NULL | DICT_FLAG_TRY0NULL); dict_db->db = db; diff --git a/postfix/util/dict_dbm.c b/postfix/util/dict_dbm.c index 87c6faad3..33b802a06 100644 --- a/postfix/util/dict_dbm.c +++ b/postfix/util/dict_dbm.c @@ -180,8 +180,8 @@ DICT *dict_dbm_open(const char *path, int open_flags, int dict_flags) dict_dbm->dict.close = dict_dbm_close; dict_dbm->dict.fd = dbm_dirfno(dbm); close_on_exec(dict_dbm->dict.fd, CLOSE_ON_EXEC); - dict_dbm->dict.flags = dict_flags; - if (dict_flagsflags & (DICT_FLAG_TRY0NULL | DICT_FLAG_TRY1NULL)) == 0) + dict_dbm->dict.flags = dict_flags | DICT_FLAG_FIXED; + if ((dict_flags & (DICT_FLAG_TRY0NULL | DICT_FLAG_TRY1NULL)) == 0) dict_dbm->dict.flags |= (DICT_FLAG_TRY0NULL | DICT_FLAG_TRY1NULL); dict_dbm->dbm = dbm; dict_dbm->path = mystrdup(path); diff --git a/postfix/util/dict_env.c b/postfix/util/dict_env.c index 926a2b947..f9f41506d 100644 --- a/postfix/util/dict_env.c +++ b/postfix/util/dict_env.c @@ -77,7 +77,7 @@ DICT *dict_env_open(const char *unused_name, int unused_flags, int dict_flags) dict->lookup = dict_env_lookup; dict->update = dict_env_update; dict->close = dict_env_close; - dict->flags = dict_flags; + dict->flags = dict_flags | DICT_FLAG_FIXED; dict->fd = -1; return (dict); } diff --git a/postfix/util/dict_ldap.c b/postfix/util/dict_ldap.c index d22adae36..a155f8442 100644 --- a/postfix/util/dict_ldap.c +++ b/postfix/util/dict_ldap.c @@ -321,7 +321,7 @@ DICT *dict_ldap_open(const char *ldapsource, int dummy, int dict_flags) dict_ldap->dict.update = dict_ldap_update; dict_ldap->dict.close = dict_ldap_close; dict_ldap->dict.fd = -1; - dict_ldap->dict.flags = dict_flags; + dict_ldap->dict.flags = dict_flags | DICT_FLAG_FIXED; if (msg_verbose) msg_info("%s: using LDAP source %s", myname, ldapsource); diff --git a/postfix/util/dict_ni.c b/postfix/util/dict_ni.c index 5f7aabd85..cb2a09fe0 100644 --- a/postfix/util/dict_ni.c +++ b/postfix/util/dict_ni.c @@ -184,7 +184,7 @@ DICT *dict_ni_open(const char *path, int unused_flags, int dict_flags) d->dict.update = dict_ni_update; d->dict.close = dict_ni_close; d->dict.fd = -1; - d->dict.flags = dict_flags; + d->dict.flags = dict_flags | DICT_FLAG_FIXED; d->path = mystrdup(path); return &d->dict; diff --git a/postfix/util/dict_nis.c b/postfix/util/dict_nis.c index a042f3299..78d76f52b 100644 --- a/postfix/util/dict_nis.c +++ b/postfix/util/dict_nis.c @@ -226,7 +226,7 @@ DICT *dict_nis_open(const char *map, int unused_flags, int dict_flags) dict_nis->dict.close = dict_nis_close; dict_nis->dict.fd = -1; dict_nis->map = mystrdup(map); - dict_nis->dict.flags = dict_flags; + dict_nis->dict.flags = dict_flags | DICT_FLAG_FIXED; if ((dict_flags & (DICT_FLAG_TRY1NULL | DICT_FLAG_TRY0NULL)) == 0) dict_nis->dict.flags |= (DICT_FLAG_TRY1NULL | DICT_FLAG_TRY0NULL); if (dict_nis_domain == 0) diff --git a/postfix/util/dict_nisplus.c b/postfix/util/dict_nisplus.c index 02a8790f1..83a813936 100644 --- a/postfix/util/dict_nisplus.c +++ b/postfix/util/dict_nisplus.c @@ -87,6 +87,6 @@ DICT *dict_nisplus_open(const char *map, int unused_flags, int dict_flags) dict_nisplus->dict.close = dict_nisplus_close; dict_nisplus->dict.fd = -1; dict_nisplus->map = mystrdup(map); - dict_nisplus->dict.flags = dict_flags; + dict_nisplus->dict.flags = dict_flags | DICT_FLAG_FIXED; return (&dict_nisplus->dict); } diff --git a/postfix/util/dict_pcre.c b/postfix/util/dict_pcre.c index d2e6121db..f6803dd4c 100644 --- a/postfix/util/dict_pcre.c +++ b/postfix/util/dict_pcre.c @@ -158,6 +158,7 @@ static const char *dict_pcre_lookup(DICT *dict, const char *name) return (0); /* Search for a matching expression */ + ctxt.matches = 0; for (pcre_list = dict_pcre->head; pcre_list; pcre_list = pcre_list->next) { if (pcre_list->pattern) { ctxt.matches = pcre_exec(pcre_list->pattern, pcre_list->hints, @@ -233,7 +234,7 @@ static void dict_pcre_close(DICT *dict) /* * dict_pcre_open - load and compile a file containing regular expressions */ -DICT *dict_pcre_open(const char *map, int unused_flags) +DICT *dict_pcre_open(const char *map, int unused_flags, int dict_flags) { DICT_PCRE *dict_pcre; VSTREAM *map_fp; @@ -258,7 +259,7 @@ DICT *dict_pcre_open(const char *map, int unused_flags) dict_pcre->dict.close = dict_pcre_close; dict_pcre->dict.fd = -1; dict_pcre->map = mystrdup(map); - dict_pcre->dict.flags = dict_flags; + dict_pcre->dict.flags = dict_flags | DICT_FLAG_PATTERN; dict_pcre->head = NULL; if (dict_pcre_init == 0) { diff --git a/postfix/util/dict_regexp.c b/postfix/util/dict_regexp.c index b3c402463..7fe2cbf40 100644 --- a/postfix/util/dict_regexp.c +++ b/postfix/util/dict_regexp.c @@ -218,6 +218,9 @@ static void dict_regexp_close(DICT *dict) myfree((char *) rule->replace); myfree((char *) rule); } + if (dict_regexp->pmatch) + myfree((char *) dict_regexp->pmatch); + myfree(dict_regexp->map); myfree((char *) dict_regexp); } @@ -342,6 +345,7 @@ static DICT_REGEXP_RULE *dict_regexp_parseline(int lineno, char *line, int *nsub rule->expr[1] = expr2; rule->replace = mystrdup(p); rule->lineno = lineno; + rule->next = NULL; return rule; } @@ -368,7 +372,9 @@ DICT *dict_regexp_open(const char *map, int unused_flags, int dict_flags) dict_regexp->dict.close = dict_regexp_close; dict_regexp->dict.fd = -1; dict_regexp->map = mystrdup(map); - dict_regexp->dict.flags = dict_flags; + dict_regexp->dict.flags = dict_flags | DICT_FLAG_PATTERN; + dict_regexp->head = 0; + dict_regexp->pmatch = 0; if ((map_fp = vstream_fopen(map, O_RDONLY, 0)) == 0) { msg_fatal("open %s: %m", map); @@ -394,9 +400,10 @@ DICT *dict_regexp_open(const char *map, int unused_flags, int dict_flags) last_rule = rule; } } - last_rule->next = NULL; - dict_regexp->pmatch = (regmatch_t *) mymalloc(sizeof(regmatch_t) * max_nsub); + if (max_nsub > 0) + dict_regexp->pmatch = + (regmatch_t *) mymalloc(sizeof(regmatch_t) * max_nsub); dict_regexp->nmatch = max_nsub; vstring_free(line_buffer); @@ -405,4 +412,4 @@ DICT *dict_regexp_open(const char *map, int unused_flags, int dict_flags) return (&dict_regexp->dict); } -#endif /* NO_POSIX_REGEXP */ +#endif diff --git a/postfix/util/dict_unix.c b/postfix/util/dict_unix.c index efc945130..00b775b7b 100644 --- a/postfix/util/dict_unix.c +++ b/postfix/util/dict_unix.c @@ -122,6 +122,6 @@ DICT *dict_unix_open(const char *map, int unused_flags, int dict_flags) dict_unix->dict.close = dict_unix_close; dict_unix->dict.fd = -1; dict_unix->map = mystrdup(map); - dict_unix->dict.flags = dict_flags; + dict_unix->dict.flags = dict_flags | DICT_FLAG_FIXED; return (&dict_unix->dict); }