makemap shout strip initial and trailing whitespaces using strip()
authorgilles <gilles@openbsd.org>
Sat, 17 Oct 2015 19:44:07 +0000 (19:44 +0000)
committergilles <gilles@openbsd.org>
Sat, 17 Oct 2015 19:44:07 +0000 (19:44 +0000)
ok millert@, ok jung@

usr.sbin/smtpd/makemap.c

index f54bd57..bc5020c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: makemap.c,v 1.54 2015/10/12 07:58:19 deraadt Exp $    */
+/*     $OpenBSD: makemap.c,v 1.55 2015/10/17 19:44:07 gilles Exp $     */
 
 /*
  * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -385,7 +385,6 @@ make_aliases(DBT *val, char *text)
 {
        struct expandnode       xn;
        char                   *subrcpt;
-       char                   *endp;
        char                   *origtext;
 
        val->data = NULL;
@@ -394,17 +393,11 @@ make_aliases(DBT *val, char *text)
        origtext = xstrdup(text, "make_aliases");
 
        while ((subrcpt = strsep(&text, ",")) != NULL) {
-               /* subrcpt: strip initial whitespace. */
-               while (isspace((unsigned char)*subrcpt))
-                       ++subrcpt;
+               /* subrcpt: strip initial and trailing whitespace. */
+               subrcpt = strip(subrcpt);
                if (*subrcpt == '\0')
                        goto error;
 
-               /* subrcpt: strip trailing whitespace. */
-               endp = subrcpt + strlen(subrcpt) - 1;
-               while (subrcpt < endp && isspace((unsigned char)*endp))
-                       *endp-- = '\0';
-
                if (! text_to_expandnode(&xn, subrcpt))
                        goto error;
        }