> Am 21.11.2014 um 23:23 schrieb Wietse Venema <wie...@porcupine.org>: > > Wietse Venema: >> A. Schulze: >>> <wish> >>> smtpd_recipient_restrictions = >>> check_foo_to_allow_something, >>> reject "you did this or that wrong, call +49 ... for assistance" >>> </wish> >>> >>> Is that possible? >> >> smtpd_recipient_restrictions does not support free text and the >> main.cf parser does not support quotes. >> >> Fortunately, neither is needed. >> >> An improved "static" table would do the job: >> >> check_recipient_access static:{reject you did this or that ...} >> >> I'll post a patch in a little while. This takes four lines of code. > > Four lines would be cheating. It takes more lines when done right. > Below is a patch for Postfix 2.12 versions after 20141005.
I’ll give it a try. Thanks > > Wietse > > *** /var/tmp/postfix-2.12-20141119/src/util/dict_static.c 2012-01-07 > 10:37:11.000000000 -0500 > --- src/util/dict_static.c 2014-11-21 17:17:40.000000000 -0500 > *************** > *** 37,42 **** > --- 37,43 ---- > > #include "mymalloc.h" > #include "msg.h" > + #include "stringops.h" > #include "dict.h" > #include "dict_static.h" > > *************** > *** 56,69 **** > > /* dict_static_open - make association with static variable */ > > ! DICT *dict_static_open(const char *name, int unused_flags, int dict_flags) > { > DICT *dict; > > dict = dict_alloc(DICT_TYPE_STATIC, name, sizeof(*dict)); > dict->lookup = dict_static_lookup; > dict->close = dict_static_close; > dict->flags = dict_flags | DICT_FLAG_FIXED; > dict->owner.status = DICT_OWNER_TRUSTED; > ! return (DICT_DEBUG (dict)); > } > --- 57,98 ---- > > /* dict_static_open - make association with static variable */ > > ! DICT *dict_static_open(const char *name, int open_flags, int dict_flags) > { > DICT *dict; > + const char *err; > + char *cp, *saved_name = 0; > > + /* > + * Let the optimizer worry about eliminating redundant code. > + */ > + #define DICT_STATIC_OPEN_RETURN(d) do { \ > + DICT *__d = (d); \ > + if (saved_name != 0) \ > + myfree(saved_name); \ > + return (__d); \ > + } while (0) > + > + /* > + * Optionally strip surrounding braces and whitespace. > + */ > + if (name[0] == CHARS_BRACE[0]) { > + saved_name = cp = mystrdup(name); > + if ((err = extpar(&cp, CHARS_BRACE, EXTPAR_FLAG_STRIP)) != 0) > + DICT_STATIC_OPEN_RETURN(dict_surrogate(DICT_TYPE_STATIC, name, > + open_flags, dict_flags, > + "bad %s:name syntax: %s", > + DICT_TYPE_STATIC, err)); > + name = cp; > + } > + > + /* > + * Bundle up the request. > + */ > dict = dict_alloc(DICT_TYPE_STATIC, name, sizeof(*dict)); > dict->lookup = dict_static_lookup; > dict->close = dict_static_close; > dict->flags = dict_flags | DICT_FLAG_FIXED; > dict->owner.status = DICT_OWNER_TRUSTED; > ! DICT_STATIC_OPEN_RETURN(DICT_DEBUG (dict)); > } -- Bachelor of Science Informatik Erlenwiese 14, 36304 Alsfeld T: +49 6631 78823400, F: +49 6631 78823409, M: +49 171 9905345 USt-IdNr.: DE225643613, http://www.roessner-network-solutions.com
signature.asc
Description: Message signed with OpenPGP using GPGMail