]> diplodocus.org Git - nmh/blobdiff - sbr/mf.c
Added const to last argument of trace_cb signature, it'll be
[nmh] / sbr / mf.c
index f993c2357b01fe8a23aaaa13e420c4390c5f93eb..d99d2b387d8ad2d245751d32ede9c34d742fcc42 100644 (file)
--- a/sbr/mf.c
+++ b/sbr/mf.c
@@ -8,14 +8,11 @@
  */
 
 #include <h/mf.h>
-#include <ctype.h>
-#include <stdio.h>
 #include <h/utils.h>
 
 /*
  * static prototypes
  */
-static char *getcpy (const char *);
 static int isat (const char *);
 static int parse_address (void);
 static int phrase (char *);
@@ -26,25 +23,6 @@ static int route (char *);
 static int my_lex (char *);
 
 
-static char *
-getcpy (const char *s)
-{
-    register char *p;
-
-    if (!s) {
-/* causes compiles to blow up because the symbol _cleanup is undefined 
-   where did this ever come from? */
-       /* _cleanup(); */
-       abort();
-       for(;;)
-           pause();
-    }
-    p = mh_xmalloc ((size_t) (strlen (s) + 2));
-    strcpy (p, s);
-    return p;
-}
-
-
 int
 isfrom(const char *string)
 {
@@ -218,7 +196,7 @@ getadrx (const char *addrs)
     err[0] = 0;
 
     if (dp == NULL) {
-       dp = cp = getcpy (addrs ? addrs : "");
+       dp = cp = strdup (addrs ? addrs : "");
        glevel = 0;
     }
     else
@@ -252,6 +230,15 @@ getadrx (const char *addrs)
            break;
        }
 
+    /*
+     * Reject the address if key fields contain 8bit characters
+     */
+
+    if (contains8bit(mbox, NULL) || contains8bit(host, NULL) ||
+       contains8bit(path, NULL) || contains8bit(grp, NULL)) {
+       strcpy(err, "Address contains 8-bit characters");
+    }
+
     if (err[0])
        for (;;) {
            switch (last_lex) {
@@ -299,7 +286,7 @@ again: ;
     switch (my_lex (buffer)) {
        case LX_ATOM: 
        case LX_QSTR: 
-           pers = getcpy (buffer);
+           pers = strdup (buffer);
            break;
 
        case LX_SEMI: 
@@ -553,7 +540,7 @@ domain (char *buffer)
 static int
 route (char *buffer)
 {
-    path = getcpy ("@");
+    path = strdup ("@");
 
     for (;;) {
        switch (my_lex (buffer)) {
@@ -652,7 +639,7 @@ my_lex (char *buffer)
                    if (--i < 0) {
                        *bp = 0;
                        note = note ? add (buffer, add (" ", note))
-                           : getcpy (buffer);
+                           : strdup (buffer);
                        return my_lex (buffer);
                    }
            }