<<< Date Index >>>     <<< Thread Index >>>

Re: mutt/2144: Please always use ascii_strcasecmp to compare ASCII parameter strings



The following reply was made to PR mutt/2144; it has been noted by GNATS.

From: Recai Oktas <roktas@xxxxxxxxxx>
To: bug-any@xxxxxxxxxxxxx
Cc: 
Subject: Re: mutt/2144: Please always use ascii_strcasecmp to compare ASCII 
parameter strings
Date: Fri, 16 Dec 2005 16:37:01 +0200

 --+pHx0qQiF2pBVqBT
 Content-Type: multipart/mixed; boundary="IJpNTDwzlM2Ie8A6"
 Content-Disposition: inline
 
 
 --IJpNTDwzlM2Ie8A6
 Content-Type: text/plain; charset=iso-8859-9
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable
 
 Hi,
 
 * Brendan Cully [2005-12-13 20:18:49+0100]
 > Synopsis: Please always use ascii_strcasecmp to compare ASCII parameter s=
 trings
 >=20
 > **** Comment added by brendan on Tue, 13 Dec 2005 20:18:49 +0100 ****
 >  I'd like to see this patch with mutt_ascii_* changed back to ascii_*. I
 >  know it may seem a little inconsistent, but this patch doesn't make
 >  things better in that regard, since all the other callers are still
 >  using the old name. If you use the ascii_* form, this patch looks fine
 >  to me.
 
 Sorry for the late response.  I've successfully tested the patch attached.
 It seems to work without any observed problem.
 
 Regards,
 
 --=20
 roktas
 
 --IJpNTDwzlM2Ie8A6
 Content-Type: text/x-patch; charset=iso-8859-9
 Content-Disposition: attachment; filename="mutt_ascii_strcase.patch"
 Content-Transfer-Encoding: quoted-printable
 
 diff -ru mutt.orig/color.c mutt/color.c
 --- mutt.orig/color.c  2005-09-17 23:46:10.000000000 +0300
 +++ mutt/color.c       2005-12-01 21:06:02.000000000 +0200
 @@ -309,14 +309,14 @@
  {
    char *eptr;
 =20
 -  if (mutt_strncasecmp (s, "bright", 6) =3D=3D 0)
 +  if (ascii_strncasecmp (s, "bright", 6) =3D=3D 0)
    {
      *attr |=3D brite;
      s +=3D 6;
    }
 =20
    /* allow aliases for xterm color resources */
 -  if (mutt_strncasecmp (s, "color", 5) =3D=3D 0)
 +  if (ascii_strncasecmp (s, "color", 5) =3D=3D 0)
    {
      s +=3D 5;
      *col =3D strtol (s, &eptr, 10);
 diff -ru mutt.orig/crypt.c mutt/crypt.c
 --- mutt.orig/crypt.c  2005-10-21 07:35:37.000000000 +0300
 +++ mutt/crypt.c       2005-12-01 21:07:19.000000000 +0200
 @@ -552,7 +552,7 @@
        convert_to_7bit (a->parts);
      }=20
      else if (a->type =3D=3D TYPEMESSAGE &&
 -           mutt_strcasecmp(a->subtype, "delivery-status"))
 +           ascii_strcasecmp(a->subtype, "delivery-status"))
      {
        if(a->encoding !=3D ENC7BIT)
        mutt_message_to_7bit (a, NULL);
 @@ -808,15 +808,15 @@
   =20
    if ((WithCrypto & APPLICATION_PGP)
        && protocol_major =3D=3D TYPEAPPLICATION
 -      && !mutt_strcasecmp (protocol_minor, "pgp-signature"))
 +      && !ascii_strcasecmp (protocol_minor, "pgp-signature"))
      ;
    else if ((WithCrypto & APPLICATION_SMIME)
             && protocol_major =3D=3D TYPEAPPLICATION
 -         && !(mutt_strcasecmp (protocol_minor, "x-pkcs7-signature")
 -             && mutt_strcasecmp (protocol_minor, "pkcs7-signature")))
 +         && !(ascii_strcasecmp (protocol_minor, "x-pkcs7-signature")
 +             && ascii_strcasecmp (protocol_minor, "pkcs7-signature")))
      ;
    else if (protocol_major =3D=3D TYPEMULTIPART
 -         && !mutt_strcasecmp (protocol_minor, "mixed"))
 +         && !ascii_strcasecmp (protocol_minor, "mixed"))
      ;
    else
    {
 @@ -840,7 +840,7 @@
        {
          if ((WithCrypto & APPLICATION_PGP)
                && signatures[i]->type =3D=3D TYPEAPPLICATION=20
 -            && !mutt_strcasecmp (signatures[i]->subtype, "pgp-signature"))
 +            && !ascii_strcasecmp (signatures[i]->subtype, "pgp-signature"))
          {
            if (crypt_pgp_verify_one (signatures[i], s, tempfile) !=3D 0)
              goodsig =3D 0;
 @@ -850,8 +850,8 @@
 =20
          if ((WithCrypto & APPLICATION_SMIME)
                && signatures[i]->type =3D=3D TYPEAPPLICATION=20
 -            && (!mutt_strcasecmp(signatures[i]->subtype, "x-pkcs7-signature")
 -                || !mutt_strcasecmp(signatures[i]->subtype, 
"pkcs7-signature")))
 +            && (!ascii_strcasecmp(signatures[i]->subtype, "x-pkcs7-signature")
 +                || !ascii_strcasecmp(signatures[i]->subtype, 
"pkcs7-signature")))
          {
            if (crypt_smime_verify_one (signatures[i], s, tempfile) !=3D 0)
              goodsig =3D 0;
 diff -ru mutt.orig/handler.c mutt/handler.c
 --- mutt.orig/handler.c        2005-11-22 14:21:14.000000000 +0200
 +++ mutt/handler.c     2005-12-01 21:08:18.000000000 +0200
 @@ -1843,7 +1843,7 @@
        handler =3D mutt_signed_handler;
      }
      else if ((WithCrypto & APPLICATION_PGP)
 -             && mutt_strcasecmp ("encrypted", b->subtype) =3D=3D 0)
 +             && ascii_strcasecmp ("encrypted", b->subtype) =3D=3D 0)
      {
        p =3D mutt_get_parameter ("protocol", b->parameter);
 =20
 diff -ru mutt.orig/init.c mutt/init.c
 --- mutt.orig/init.c   2005-10-05 22:24:40.000000000 +0300
 +++ mutt/init.c        2005-12-01 21:09:26.000000000 +0200
 @@ -834,9 +834,9 @@
      a =3D safe_malloc(sizeof(ATTACH_MATCH));
 =20
      /* some cheap hacks that I expect to remove */
 -    if (!mutt_strcasecmp(buf->data, "any"))
 +    if (!ascii_strcasecmp(buf->data, "any"))
        a->major =3D safe_strdup("*/.*");
 -    else if (!mutt_strcasecmp(buf->data, "none"))
 +    else if (!ascii_strcasecmp(buf->data, "none"))
        a->major =3D safe_strdup("cheap_hack/this_should_never_match");
      else
        a->major =3D safe_strdup(buf->data);
 @@ -898,9 +898,9 @@
    {
      mutt_extract_token (buf, s, 0);
 =20
 -    if (!mutt_strcasecmp(buf->data, "any"))
 +    if (!ascii_strcasecmp(buf->data, "any"))
        tmp =3D safe_strdup("*/.*");
 -    else if (!mutt_strcasecmp(buf->data, "none"))
 +    else if (!ascii_strcasecmp(buf->data, "none"))
        tmp =3D safe_strdup("cheap_hack/this_should_never_match");
      else
        tmp =3D safe_strdup(buf->data);
 @@ -1001,13 +1001,13 @@
      op =3D '+';
      category--;
    }
 -  if (!mutt_strncasecmp(category, "attachment", strlen(category))) {
 +  if (!ascii_strncasecmp(category, "attachment", strlen(category))) {
      if (op =3D=3D '+')
        listp =3D &AttachAllow;
      else
        listp =3D &AttachExclude;
    }
 -  else if (!mutt_strncasecmp(category, "inline", strlen(category))) {
 +  else if (!ascii_strncasecmp(category, "inline", strlen(category))) {
      if (op =3D=3D '+')
        listp =3D &InlineAllow;
      else
 @@ -1038,13 +1038,13 @@
      op =3D '+';
      p--;
    }
 -  if (!mutt_strncasecmp(p, "attachment", strlen(p))) {
 +  if (!ascii_strncasecmp(p, "attachment", strlen(p))) {
      if (op =3D=3D '+')
        listp =3D &AttachAllow;
      else
        listp =3D &AttachExclude;
    }
 -  else if (!mutt_strncasecmp(p, "inline", strlen(p))) {
 +  else if (!ascii_strncasecmp(p, "inline", strlen(p))) {
      if (op =3D=3D '+')
        listp =3D &InlineAllow;
      else
 diff -ru mutt.orig/parse.c mutt/parse.c
 --- mutt.orig/parse.c  2005-10-21 07:35:37.000000000 +0300
 +++ mutt/parse.c       2005-12-01 21:10:36.000000000 +0200
 @@ -1542,7 +1542,7 @@
      {
        /* Always recurse multiparts, except multipart/alternative. */
        shallrecurse =3D 1;
 -      if (!mutt_strcasecmp(bp->subtype, "alternative"))
 +      if (!ascii_strcasecmp(bp->subtype, "alternative"))
          shallrecurse =3D 0;
 =20
        /* Don't count containers if they're top-level. */
 diff -ru mutt.orig/smime.c mutt/smime.c
 --- mutt.orig/smime.c  2005-10-21 07:35:38.000000000 +0300
 +++ mutt/smime.c       2005-12-01 21:11:55.000000000 +0200
 @@ -1621,7 +1621,7 @@
        rewind (smimeerr);
       =20
        line =3D mutt_read_line (line, &linelen, smimeerr, &lineno);
 -      if (linelen && !mutt_strcasecmp (line, "verification successful"))
 +      if (linelen && !ascii_strcasecmp (line, "verification successful"))
        badsig =3D 0;
 =20
        FREE (&line);
 @@ -1842,7 +1842,7 @@
      rewind (smimeerr);
     =20
      line =3D mutt_read_line (line, &linelen, smimeerr, &lineno);
 -    if (linelen && !mutt_strcasecmp (line, "verification successful"))
 +    if (linelen && !ascii_strcasecmp (line, "verification successful"))
        m->goodsig =3D 1;
      FREE (&line);
    }
 
 --IJpNTDwzlM2Ie8A6--
 
 --+pHx0qQiF2pBVqBT
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: Digital signature
 Content-Disposition: inline
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.4 (GNU/Linux)
 
 iD8DBQFDotENnA44mz/SXIQRAn/wAJ9q1FKjqoC+EMIs5/PxOeiWWV4x1ACeOPYW
 m8EJzHtE57fSLh6mwzMF04U=
 =2fAv
 -----END PGP SIGNATURE-----
 
 --+pHx0qQiF2pBVqBT--