]> diplodocus.org Git - nmh/commitdiff
Garbage collect "normalize".
authorKen Hornstein <kenh@pobox.com>
Thu, 5 Dec 2013 02:56:50 +0000 (21:56 -0500)
committerKen Hornstein <kenh@pobox.com>
Thu, 5 Dec 2013 03:00:12 +0000 (22:00 -0500)
The code to normalize addresses (look up the hostnames in DNS for the
"official" hostnames) was disabled when we made DUMB the default configuration
in 1.5.  Since them, the -normalize switch was still around in various
utilities, but it didn't do anything.  Remove all of those switches and
garbage collect various other bits of the "normalize" functionality.

At the same time, improve getm() a bit; it now takes an argument specifying
the length of the error buffer.

19 files changed:
Makefile.am
h/addrsbr.h
h/fmt_scan.h
man/ali.man
man/ap.man
man/fmttest.man
sbr/addrsbr.c
sbr/encode_rfc2047.c
sbr/fmt_addr.c
sbr/fmt_def.c [deleted file]
sbr/fmt_scan.c
test/ali/test-ali
uip/ali.c
uip/aliasbr.c
uip/ap.c
uip/fmttest.c
uip/mhlsbr.c
uip/post.c
uip/replsbr.c

index a056b24..13b6d44 100644 (file)
@@ -551,7 +551,7 @@ sbr_libmh_a_SOURCES = sbr/addrsbr.c sbr/ambigsw.c sbr/atooi.c sbr/arglist.c \
                      sbr/snprintb.c sbr/ssequal.c \
                      sbr/strindex.c sbr/trimcpy.c sbr/unquote.c \
                      sbr/uprf.c sbr/vfgets.c \
-                     sbr/fmt_def.c sbr/mf.c sbr/utils.c sbr/ctype-checked.c \
+                     sbr/mf.c sbr/utils.c sbr/ctype-checked.c \
                      sbr/m_mktemp.c sbr/getansreadline.c sbr/vector.c \
                      config/config.c config/version.c
 
index fbb4cd0..de5dc3b 100644 (file)
@@ -3,10 +3,6 @@
  * addrsbr.h -- definitions for the address parsing system
  */
 
-#define        AD_HOST 1               /* getm(): lookup official hostname    */
-#define        AD_NHST 0               /* getm(): do not lookup official name */
-#define        AD_NAME AD_NHST         /* AD_HOST is TOO slow                 */
-
 #define        UUCPHOST        (-1)
 #define        LOCALHOST       0
 #define        NETHOST         1
@@ -93,21 +89,17 @@ char *auxformat(struct mailname *mp, int extras);
  *               localhost().
  * dftype      - If dfhost is given, use dftype as the email address type
  *               if no host is in the email address.
- * wanthost    - One of AD_HOST or AD_NHST.  If AD_HOST, look up the
- *               "official name" of the host.  Well, that's what the
- *               documentation says, at least ... support for that
- *               functionality was removed when hostable support was
- *               removed and the address parser was converted by default
- *               to always being in DUMB mode.  So nowadays this only
- *               affects where error messages are put if there is no
- *               host part (set it to AD_HOST if you want error messages
- *               to appear on standard error).
- * eresult     - Any error string returned by the address parser.  String
- *               must contain sufficient room for the error message.
- *               (BUFSIZ is used in general by the code).  Can be NULL.
+ * eresult     - A buffer containing an error message returned by the
+ *               address parser.  May be NULL.
+ * eresultsize - The size of the buffer passed in eresult.
  *
  * A pointer to an allocated struct mailname corresponding to the email
  * address is returned.
+ *
+ * This function used to have an argument called 'wanthost' which would
+ * control whether or not it would canonicalize hostnames in email
+ * addresses.  This functionalit was removed for nmh 1.5, and eventually
+ * all of the code that used this argument was garbage collected.
  */
-struct mailname *getm(char *str, char *dfhost, int dftype,
-                     int wanthost, char *eresult);
+struct mailname *getm(char *str, char *dfhost, int dftype, char *eresult,
+                     size_t eresultsize);
index 771d9fb..4d768b7 100644 (file)
@@ -49,8 +49,6 @@ struct comp {
 
 #define CF_BITS       "\020\01TRUE\02PARSED\03CF_DATEFAB\04TRIMMED"
 
-extern int fmt_norm;
-
 /*
  * This structure defines one formatting instruction.
  */
index 4ef473e..3e43bad 100644 (file)
@@ -11,7 +11,6 @@ ali \- list mail aliases
 .RB [ \-alias
 .IR aliasfile ]
 .RB [ \-list " | " \-nolist ]
-.RB [ \-normalize " | " \-nonormalize ]
 .RB [ \-user " | " \-nouser ]
 .RB [ \-version ]
 .RB [ \-help ] 
@@ -42,12 +41,7 @@ an inverted fashion: instead of listing the addresses that each given
 alias expands to,
 .B ali
 will list the aliases that expand to each
-given address.  If the
-.B \-normalize
-switch is given,
-.B ali
-will
-try to track down the official hostname of the address.
+given address.
 .PP
 The files specified by the profile entry
 .RI \*(lq Aliasfile \*(rq
@@ -94,8 +88,6 @@ aliasfile
 .TP
 \-nolist
 .TP
-\-nonormalize
-.TP
 \-nouser
 .PD
 .SH CONTEXT
index cc5575c..5c5fa40 100644 (file)
@@ -12,7 +12,6 @@ ap \- parse addresses RFC 822-style
 .IR formatfile ]
 .RB [ \-format
 .IR string ]
-.RB [ \-normalize " | " \-nonormalize ]
 .RB [ \-width
 .IR columns ]
 .RB [ \-version ]
@@ -60,13 +59,6 @@ error        string  A diagnostic if the parse failed
 .RE
 .fi
 .PP
-If the
-.B \-normalize
-switch is given,
-.B ap
-will try to track down
-the official hostname of the address.
-.PP
 Here is the default format string used by
 .BR ap :
 .PP
@@ -100,8 +92,6 @@ Standard for the Format of ARPA Internet Text Messages
 -format
 As described above.
 .TP
-\-normalize
-.TP
 \-width
 The width of the terminal.
 .PD
index 0925442..b34d2e9 100644 (file)
@@ -20,7 +20,6 @@ language
 .IR component-text ]
 .RB [ \-dupaddrs " | " \-nodupaddrs ]
 .RB [ \-ccme " | " \-noccme ]
-.RB [ \-normalize " | " \-nonormalize ]
 .RB [ \-outsize
 .IR size-in-characters ]
 .RB [ \-bufsize
@@ -207,15 +206,6 @@ and only applies if
 is in effect.
 .PP
 The
-.B \-normalize
-and
-.B \-nonormalize
-switches control whether or not email addresses are normalized by the
-address parsing routines.  This is only functional when in address
-mode and is designed to replicate the switch of the same name to
-.IR ap (8).
-.PP
-The
 .B \-outsize
 switch controls the maximum number of printable characters that the format
 engine will produce.  Characters marked as non-printing by the format
index e5b2052..b2079bd 100644 (file)
@@ -104,35 +104,32 @@ getname (const char *addrs)
 
 
 struct mailname *
-getm (char *str, char *dfhost, int dftype, int wanthost, char *eresult)
+getm (char *str, char *dfhost, int dftype, char *eresult, size_t eresultsize)
 {
     char *pp;
     struct mailname *mp;
 
     if (err[0]) {
-       if (eresult)
-           strcpy (eresult, err);
-       else
-           if (wanthost == AD_HOST)
-               admonish (NULL, "bad address '%s' - %s", str, err);
+       if (eresult) {
+           strncpy (eresult, err, eresultsize);
+           eresult[eresultsize - 1] = '\0';
+       }
        return NULL;
     }
     if (pers == NULL
            && mbox == NULL && host == NULL && route == NULL
            && grp == NULL) {
-       if (eresult)
-           strcpy (eresult, "null address");
-       else
-           if (wanthost == AD_HOST)
-               admonish (NULL, "null address '%s'", str);
+       if (eresult) {
+           strncpy (eresult, "null address", eresultsize);
+           eresult[eresultsize - 1] = '\0';
+       }
        return NULL;
     }
     if (mbox == NULL && grp == NULL) {
-       if (eresult)
-           strcpy (eresult, "no mailbox in address");
-       else
-           if (wanthost == AD_HOST)
-               admonish (NULL, "no mailbox in address '%s'", str);
+       if (eresult) {
+           strncpy (eresult, "no mailbox in address", eresultsize);
+           eresult[eresultsize - 1] = '\0';
+       }
        return NULL;
     }
 
@@ -143,11 +140,11 @@ getm (char *str, char *dfhost, int dftype, int wanthost, char *eresult)
 
     mp = (struct mailname *) calloc ((size_t) 1, sizeof(*mp));
     if (mp == NULL) {
-       if (eresult)
-          strcpy (eresult, "insufficient memory to represent address");
-       else
-           if (wanthost == AD_HOST)
-               adios (NULL, "insufficient memory to represent address");
+       if (eresult) {
+           strncpy (eresult, "insufficient memory to represent address",
+                    eresultsize);
+           eresult[eresultsize - 1] = '\0';
+       }
        return NULL;
     }
 
@@ -317,7 +314,7 @@ ismymbox (struct mailname *np)
                return 0;
            }
 
-           if ((mq.m_next = getm (cp, NULL, 0, AD_NAME, NULL)) == NULL) {
+           if ((mq.m_next = getm (cp, NULL, 0, NULL, 0)) == NULL) {
                admonish (NULL, "invalid entry in local-mailbox: %s", cp);
                return 0;
            }
@@ -337,7 +334,7 @@ ismymbox (struct mailname *np)
            mp = mq.m_next ? mq.m_next : &mq;
            oops = 0;
            while ((cp = getname (am))) {
-               if ((mp->m_next = getm (cp, NULL, 0, AD_NAME, NULL)) == NULL) {
+               if ((mp->m_next = getm (cp, NULL, 0, NULL, 0)) == NULL) {
                    admonish (NULL, "illegal address: %s", cp);
                    oops++;
                } else {
index 953f6e5..537a275 100644 (file)
@@ -550,6 +550,7 @@ field_encode_address(const char *name, char **value, int encoding,
     char *tmpbuf = NULL;
     size_t tmpbufsize = 0;
     struct mailname *mn;
+    char errbuf[BUFSIZ];
 
     /*
      * Because these are addresses, we need to handle them individually.
@@ -566,7 +567,8 @@ field_encode_address(const char *name, char **value, int encoding,
     output = add(" ", output);
 
     for (groupflag = 0; (mp = getname(*value)); ) {
-       if ((mn = getm(mp, NULL, 0, AD_HOST, NULL)) == NULL) {
+       if ((mn = getm(mp, NULL, 0, errbuf, sizeof(errbuf))) == NULL) {
+           advise(mp, "%s", errbuf);
            errflag++;
            continue;
        }
index 3186dea..07c0cec 100644 (file)
@@ -82,7 +82,7 @@ formataddr (char *orig, char *str)
 
     /* concatenate all the new addresses onto 'buf' */
     for (isgroup = 0; (cp = getname (str)); ) {
-       if ((mp = getm (cp, NULL, 0, fmt_norm, NULL)) == NULL)
+       if ((mp = getm (cp, NULL, 0, NULL, 0)) == NULL)
            continue;
 
        if (isgroup && (mp->m_gname || !mp->m_ingrp)) {
diff --git a/sbr/fmt_def.c b/sbr/fmt_def.c
deleted file mode 100644 (file)
index 1edb787..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-/*
- * fmt_def.c -- some defines for sbr/fmt_scan.c
- *
- * This code is Copyright (c) 2002, by the authors of nmh.  See the
- * COPYRIGHT file in the root directory of the nmh distribution for
- * complete copyright information.
- */
-
-#include <h/addrsbr.h>
-
-int fmt_norm = AD_NAME;
index 408b109..a7ad124 100644 (file)
@@ -25,7 +25,6 @@
 #  include <wchar.h>
 #endif
 
-extern int fmt_norm;           /* defined in sbr/fmt_def.c = AD_NAME */
 struct mailname fmt_mnull = { NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0,
                              NULL, NULL };
 
@@ -987,7 +986,7 @@ fmt_scan (struct format *format, char *scanl, size_t max, int width, int *dat,
            if (comp->c_mn != &fmt_mnull)
                mnfree (comp->c_mn);
            if ((sp = comp->c_text) && (sp = getname(sp)) &&
-               (mn = getm (sp, NULL, 0, fmt_norm, NULL))) {
+               (mn = getm (sp, NULL, 0, NULL, 0))) {
                comp->c_mn = mn;
                while (getname(""))
                    ;
@@ -1009,7 +1008,7 @@ fmt_scan (struct format *format, char *scanl, size_t max, int width, int *dat,
            if (comp->c_mn != &fmt_mnull)
                mnfree (comp->c_mn);
            if ((sp = comp->c_text) && (sp = getname(sp)) &&
-               (mn = getm (sp, NULL, 0, AD_NAME, NULL))) {
+               (mn = getm (sp, NULL, 0, NULL, 0))) {
                comp->c_mn = mn;
                if (ismymbox(mn))
                    comp->c_flags |= CF_TRUE;
@@ -1017,7 +1016,7 @@ fmt_scan (struct format *format, char *scanl, size_t max, int width, int *dat,
                    comp->c_flags &= ~CF_TRUE;
                while ((sp = getname(sp)))
                    if ((comp->c_flags & CF_TRUE) == 0 &&
-                       (mn = getm (sp, NULL, 0, AD_NAME, NULL)))
+                       (mn = getm (sp, NULL, 0, NULL, 0)))
                        if (ismymbox(mn))
                            comp->c_flags |= CF_TRUE;
            } else {
index 4079790..4f25ef6 100755 (executable)
@@ -31,7 +31,6 @@ Usage: ali [switches] aliases ...
   switches are:
   -alias aliasfile
   -[no]list
-  -[no]normalize
   -[no]user
   -version
   -help
index 1fa7ef8..dda0a2c 100644 (file)
--- a/uip/ali.c
+++ b/uip/ali.c
@@ -18,8 +18,6 @@
     X("noalias", -7, NALIASW) \
     X("list", 0, LISTSW) \
     X("nolist", 0, NLISTSW) \
-    X("normalize", 0, NORMSW) \
-    X("nonormalize", 0, NNORMSW) \
     X("user", 0, USERSW) \
     X("nouser", 0, NUSERSW) \
     X("version", 0, VERSIONSW) \
@@ -41,14 +39,14 @@ extern struct aka *akahead;
  * prototypes
  */
 static void print_aka (char *, int, int);
-static void print_usr (char *, int, int);
+static void print_usr (char *, int);
 
 
 int
 main (int argc, char **argv)
 {
     int i, vecp = 0, inverted = 0, list = 0;
-    int noalias = 0, normalize = AD_NHST;
+    int noalias = 0;
     char *cp, **ap, **argp, buf[BUFSIZ];
     /* Really only need to allocate for argc-1, but must allocate at least 1,
        so go ahead and allocate for argc char pointers. */
@@ -102,13 +100,6 @@ main (int argc, char **argv)
                    list = 0;
                    continue;
 
-               case NORMSW: 
-                   normalize = AD_HOST;
-                   continue;
-               case NNORMSW: 
-                   normalize = AD_NHST;
-                   continue;
-
                case USERSW: 
                    inverted++;
                    continue;
@@ -150,7 +141,7 @@ main (int argc, char **argv)
                   invo_name);
 
        for (i = 0; i < vecp; i++)
-           print_usr (vec[i], list, normalize);
+           print_usr (vec[i], list);
     } else {
        if (vecp) {
            /* print specified aliases */
@@ -212,7 +203,7 @@ print_aka (char *p, int list, int margin)
 }
 
 static void
-print_usr (char *s, int list, int norm)
+print_usr (char *s, int list)
 {
     register char *cp, *pp, *vp;
     register struct aka *ak;
@@ -220,7 +211,7 @@ print_usr (char *s, int list, int norm)
 
     if ((pp = getname (s)) == NULL)
        adios (NULL, "no address in \"%s\"", s);
-    if ((mp = getm (pp, NULL, 0, norm, NULL)) == NULL)
+    if ((mp = getm (pp, NULL, 0, NULL, 0)) == NULL)
        adios (NULL, "bad address \"%s\"", s);
     while (getname (""))
        continue;
@@ -229,7 +220,7 @@ print_usr (char *s, int list, int norm)
     for (ak = akahead; ak; ak = ak->ak_next) {
        pp = akresult (ak);
        while ((cp = getname (pp))) {
-           if ((np = getm (cp, NULL, 0, norm, NULL)) == NULL)
+           if ((np = getm (cp, NULL, 0, NULL, 0)) == NULL)
                continue;
            if (!strcasecmp (mp->m_host ? mp->m_host : "",
                             np->m_host ? np->m_host : "")  &&
index 2e83d07..6600f74 100644 (file)
@@ -126,7 +126,7 @@ akval (struct aka *ak, char *s)
            if (name) {
                /* s is of the form "Blind list: address".  If address
                   is an alias, expand it. */
-               struct mailname *mp = getm (name, NULL, 0, AD_NAME, NULL);
+               struct mailname *mp = getm (name, NULL, 0, NULL, 0);
 
                if (mp  &&  mp->m_ingrp) {
                    char *gname = add (mp->m_gname, NULL);
index c42d732..f0b0baa 100644 (file)
--- a/uip/ap.c
+++ b/uip/ap.c
@@ -22,8 +22,6 @@
 #define AP_SWITCHES \
     X("form formatfile", 0, FORMSW) \
     X("format string", 5, FMTSW) \
-    X("normalize", 0, NORMSW) \
-    X("nonormalize", 0, NNORMSW) \
     X("width columns", 0, WIDTHSW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
@@ -43,13 +41,13 @@ static int dat[5];
 /*
  * static prototypes
  */
-static int process (char *, int, int);
+static int process (char *, int);
 
 
 int
 main (int argc, char **argv)
 {
-    int addrp = 0, normalize = AD_HOST;
+    int addrp = 0;
     int width = 0, status = 0;
     char *cp, *form = NULL, *format = NULL, *nfs;
     char buf[BUFSIZ], **argp;
@@ -102,13 +100,6 @@ main (int argc, char **argv)
                        adios (NULL, "missing argument to %s", argp[-2]);
                    width = atoi (cp);
                    continue;
-
-               case NORMSW: 
-                   normalize = AD_HOST;
-                   continue;
-               case NNORMSW: 
-                   normalize = AD_NHST;
-                   continue;
            }
        }
        if (addrp > NADDRS)
@@ -131,7 +122,6 @@ main (int argc, char **argv)
     }
     if (width > WBUFSIZ)
        width = WBUFSIZ;
-    fmt_norm = normalize;
     fmt_compile (nfs, &fmt, 1);
 
     dat[0] = 0;
@@ -141,7 +131,7 @@ main (int argc, char **argv)
     dat[4] = 0;
 
     for (addrp = 0; addrs[addrp]; addrp++)
-       status += process (addrs[addrp], width, normalize);
+       status += process (addrs[addrp], width);
 
     fmt_free (fmt, 1);
     done (status);
@@ -156,7 +146,7 @@ struct pqpair {
 
 
 static int
-process (char *arg, int length, int norm)
+process (char *arg, int length)
 {
     int        status = 0;
     register char *cp;
@@ -170,7 +160,7 @@ process (char *arg, int length, int norm)
     while ((cp = getname (arg))) {
        if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
            adios (NULL, "unable to allocate pqpair memory");
-       if ((mp = getm (cp, NULL, 0, norm, error)) == NULL) {
+       if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) {
            p->pq_text = getcpy (cp);
            p->pq_error = getcpy (error);
            status++;
index 4794c7b..2bcebd7 100644 (file)
@@ -28,8 +28,6 @@
     X("nodupaddrs", 0, NDUPADDRSW) \
     X("ccme", 0, CCMESW) \
     X("noccme", 0, NCCMESW) \
-    X("normalize", 0, NORMSW) \
-    X("nonormalize", 0, NNORMSW) \
     X("outsize size-in-characters", 0, OUTSIZESW) \
     X("bufsize size-in-bytes", 0, BUFSZSW) \
     X("width column-width", 0, WIDTHSW) \
@@ -88,7 +86,7 @@ static char *c_flagsstr(int);
 static void litputs(char *);
 static void litputc(char);
 static void process_addresses(struct format *, struct msgs_array *, char *,
-                             int, int, int *, int, struct fmt_callbacks *);
+                             int, int, int *, struct fmt_callbacks *);
 static void process_raw(struct format *, struct msgs_array *, char *,
                        int, int, int *, struct fmt_callbacks *);
 static void process_messages(struct format *, struct msgs_array *,
@@ -119,7 +117,6 @@ main (int argc, char **argv)
     int dump = 0, i;
     int outputsize = 0, bufsize = 0, dupaddrs = 1, trace = 0, files = 0;
     int colwidth = -1, msgnum = -1, msgcur = -1, msgsize = -1, msgunseen = -1;
-    int normalize = AD_HOST;
     enum mode_t mode = MESSAGE;
     int dat[5];
     struct fmt_callbacks cb, *cbp = NULL;
@@ -196,13 +193,6 @@ main (int argc, char **argv)
                    form = NULL;
                    continue;
 
-               case NORMSW:
-                   normalize = AD_HOST;
-                   continue;
-               case NNORMSW:
-                   normalize = AD_NHST;
-                   continue;
-
                case TRACESW:
                    trace++;
                    continue;
@@ -403,9 +393,8 @@ main (int argc, char **argv)
        }
 
        if (mode == ADDRESS) {
-           fmt_norm = normalize;
            process_addresses(fmt, &msgs, buffer, bufsize, outputsize,
-                             dat, normalize, cbp);
+                             dat, cbp);
        } else /* Fall-through for RAW or DATE */
            process_raw(fmt, &msgs, buffer, bufsize, outputsize, dat, cbp);
     }
@@ -428,8 +417,7 @@ struct pqpair {
 
 static void
 process_addresses(struct format *fmt, struct msgs_array *addrs, char *buffer,
-                 int bufsize, int outwidth, int *dat, int norm,
-                 struct fmt_callbacks *cb)
+                 int bufsize, int outwidth, int *dat, struct fmt_callbacks *cb)
 {
     int i;
     char *cp, error[BUFSIZ];
@@ -452,7 +440,7 @@ process_addresses(struct format *fmt, struct msgs_array *addrs, char *buffer,
        while ((cp = getname(addrs->msgs[i]))) {
            if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
                adios (NULL, "unable to allocate pqpair memory");
-           if ((mp = getm(cp, NULL, 0, norm, error)) == NULL) {
+           if ((mp = getm(cp, NULL, 0, error, sizeof(error))) == NULL) {
                p->pq_text = getcpy(cp);
                p->pq_error = getcpy(error);
            } else {
@@ -1280,7 +1268,7 @@ test_formataddr (char *orig, char *str)
 
     /* concatenate all the new addresses onto 'buf' */
     for (isgroup = 0; (cp = getname (str)); ) {
-       if ((mp = getm (cp, NULL, 0, AD_NAME, error)) == NULL) {
+       if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) {
            fprintf(stderr, "bad address \"%s\" -- %s\n", cp, error);
            continue;
        }
index 8d759d6..6854ab9 100644 (file)
@@ -1180,7 +1180,7 @@ mcomp_format (struct mcomp *c1, struct mcomp *c2)
        if ((p = (struct pqpair *) calloc ((size_t) 1, sizeof(*p))) == NULL)
            adios (NULL, "unable to allocate pqpair memory");
 
-       if ((mp = getm (cp, NULL, 0, AD_NAME, error)) == NULL) {
+       if ((mp = getm (cp, NULL, 0, error, sizeof(error))) == NULL) {
            p->pq_text = getcpy (cp);
            p->pq_error = getcpy (error);
        } else {
index 679ae6d..8589463 100644 (file)
@@ -669,7 +669,7 @@ putfmt (char *name, char *str, FILE *out)
 {
     int count, grp, i, keep;
     char *cp, *pp, *qp;
-    char namep[BUFSIZ];
+    char namep[BUFSIZ], error[BUFSIZ];
     struct mailname *mp = NULL, *np = NULL;
     struct headers *hdr;
 
@@ -732,18 +732,20 @@ putfmt (char *name, char *str, FILE *out)
 
     tmpaddrs.m_next = NULL;
     for (count = 0; (cp = getname (str)); count++)
-       if ((mp = getm (cp, NULL, 0, AD_HOST, NULL))) {
+       if ((mp = getm (cp, NULL, 0, error, sizeof(error)))) {
            if (tmpaddrs.m_next)
                np->m_next = mp;
            else
                tmpaddrs.m_next = mp;
            np = mp;
        }
-       else
+       else {
+           admonish(cp, "%s", error);
            if (hdr->flags & HTRY)
                badadr++;
            else
                badmsg++;
+       }
 
     if (count < 1) {
        if (hdr->flags & HNIL)
@@ -784,7 +786,8 @@ putfmt (char *name, char *str, FILE *out)
            if (np->m_gname)
                putgrp (namep, np->m_gname, out, hdr->flags);
            while ((cp = getname (pp))) {
-               if (!(mp = getm (cp, NULL, 0, AD_HOST, NULL))) {
+               if (!(mp = getm (cp, NULL, 0, error, sizeof(error)))) {
+                   admonish(cp, "%s", error);
                    badadr++;
                    continue;
                }
index ee404ef..6a906b4 100644 (file)
@@ -317,7 +317,7 @@ replformataddr (char *orig, char *str)
 
     /* concatenate all the new addresses onto 'buf' */
     for (isgroup = 0; (cp = getname (fixed_str)); ) {
-       if ((mp = getm (cp, dfhost, dftype, AD_NAME, error)) == NULL) {
+       if ((mp = getm (cp, dfhost, dftype, error, sizeof(error))) == NULL) {
            snprintf (baddr, sizeof(baddr), "\t%s -- %s\n", cp, error);
            badaddrs = add (baddr, badaddrs);
            continue;
@@ -523,7 +523,8 @@ fix_addresses (char *str) {
             adr_nodep->next = NULL;
 
             /* With AD_NAME, errors are not reported to user. */
-            if ((mp = getm (cp, dfhost, dftype, AD_NAME, error)) == NULL) {
+            if ((mp = getm (cp, dfhost, dftype, error,
+                           sizeof(error))) == NULL) {
                 const char *no_at_sign = "no at-sign after local-part";
 
                 adr_nodep->escape_local_part =
@@ -562,7 +563,7 @@ fix_addresses (char *str) {
                 new_adr = concat (display_name, " ", angle_addr, NULL);
                 adr = getname (new_adr);
                 if (adr != NULL  &&
-                    (mp = getm (adr, dfhost, dftype, AD_NAME, NULL)) != NULL) {
+                    (mp = getm (adr, dfhost, dftype, NULL, 0)) != NULL) {
                     fixed_address = 1;
                     mnfree (mp);
                 }