]> diplodocus.org Git - nmh/blobdiff - uip/aliasbr.c
Replace getcpy() with mh_xstrdup().
[nmh] / uip / aliasbr.c
index a696e8a6406607eee4e38c67d9abdcb1f07b45c3..65cd5e445311d94511e54d9a2714db348c172422 100644 (file)
@@ -41,7 +41,6 @@ static char *seekp (char *, char *, char **);
 static int addfile (struct aka *, char *);
 static int addgroup (struct aka *, char *);
 static int addmember (struct aka *, char *);
-static int addall (struct aka *);
 static char *getalias (char *);
 static void add_aka (struct aka *, char *);
 static struct aka *akalloc (char *);
@@ -104,6 +103,12 @@ akval (struct aka *ak, char *s)
     if (!s)
        return s;                       /* XXX */
 
+    /* It'd be tempting to check for a trailing semicolon and remove
+       it.  But that would break the EXMH alias parser on what would
+       then be valid expressions:
+       http://lists.gnu.org/archive/html/nmh-workers/2012-10/msg00039.html
+     */
+
     for (; ak; ak = ak->ak_next) {
        if (aleq (s, ak->ak_name)) {
            return akresult (ak);
@@ -120,7 +125,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);
@@ -265,10 +270,6 @@ alias (char *file)
                }
                break;
 
-           case '*':           /* Everyone */
-               addall (ak);
-               break;
-
            default:            /* list */
                while ((cp = getalias (pp)))
                    add_aka (ak, cp);
@@ -433,26 +434,6 @@ addmember (struct aka *ak, char *grp)
 }
 
 
-static int
-addall (struct aka *ak)
-{
-    int noshell = NoShell == NULL || *NoShell == 0;
-    register struct home *hm;
-
-    init_pw ();
-
-    if (Everyone < 0)
-       Everyone = EVERYONE;
-
-    for (hm = homehead; hm; hm = hm->h_next)
-        if ((int) hm->h_uid > Everyone
-               && (noshell || strcmp (hm->h_shell, NoShell)))
-           add_aka (ak, hm->h_name);
-
-    return homehead != NULL;
-}
-
-
 static char *
 getalias (char *addrs)
 {
@@ -497,7 +478,7 @@ add_aka (struct aka *ak, char *pp)
        if (!strcmp (pp, ad->ad_text))
            return;
 
-    ad = (struct adr *) mh_xmalloc (sizeof(*ad));
+    NEW(ad);
     ad->ad_text = getcpy (pp);
     ad->ad_local = strchr(pp, '@') == NULL && strchr(pp, '!') == NULL;
     ad->ad_next = NULL;
@@ -538,8 +519,7 @@ akalloc (char *id)
 {
     register struct aka *p;
 
-    p = (struct aka *) mh_xmalloc (sizeof(*p));
-
+    NEW(p);
     p->ak_name = getcpy (id);
     p->ak_visible = 0;
     p->ak_addr = NULL;
@@ -559,8 +539,7 @@ hmalloc (struct passwd *pw)
 {
     register struct home *p;
 
-    p = (struct home *) mh_xmalloc (sizeof(*p));
-
+    NEW(p);
     p->h_name = getcpy (pw->pw_name);
     p->h_uid = pw->pw_uid;
     p->h_gid = pw->pw_gid;