[exim-cvs] cvs commit: exim/exim-src/src dk.c expand.c trans…

Etusivu
Poista viesti
Vastaa
Lähettäjä: Philip Hazel
Päiväys:  
Vastaanottaja: exim-cvs
Aihe: [exim-cvs] cvs commit: exim/exim-src/src dk.c expand.c transport.c
ph10 2005/06/20 12:20:41 BST

  Modified files:
    exim-src/src         dk.c expand.c transport.c 
  Log:
  Add a whole pile of casts to get rid of compiler warnings in Tom's DK
  code. I hadn't compiled it before, but a user complained...


  Revision  Changes    Path
  1.3       +13 -13    exim/exim-src/src/dk.c
  1.32      +14 -14    exim/exim-src/src/expand.c
  1.10      +3 -3      exim/exim-src/src/transport.c


  Index: dk.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/dk.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- dk.c    8 Mar 2005 16:57:28 -0000    1.2
  +++ dk.c    20 Jun 2005 11:20:41 -0000    1.3
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/dk.c,v 1.2 2005/03/08 16:57:28 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/dk.c,v 1.3 2005/06/20 11:20:41 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -38,7 +38,7 @@
     if (dk_context != NULL) {
       /* Send oldest byte */
       if ((dkbuff[0] < 256) && (dk_internal_status == DK_STAT_OK)) {
  -      dk_internal_status = dk_message(dk_context, (char *)&dkbuff[0], 1);
  +      dk_internal_status = dk_message(dk_context, CUS &dkbuff[0], 1);
         if (dk_internal_status != DK_STAT_OK)
           DEBUG(D_receive) debug_printf("DK: %s\n", DK_STAT_to_string(dk_internal_status));
       }
  @@ -133,7 +133,7 @@
     /* Send remaining bytes from input which are still in the buffer. */
     for (i=0;i<6;i++)
       if (dkbuff[i] < 256)
  -      dk_internal_status = dk_message(dk_context, (char *)&dkbuff[i], 1);
  +      dk_internal_status = dk_message(dk_context, CUS &dkbuff[i], 1);


     /* Flag end-of-message. */
     dk_internal_status = dk_end(dk_context, NULL);
  @@ -249,7 +249,7 @@
     /* Figure out what canonicalization to use. Unfortunately
        we must do this BEFORE knowing which domain we sign for. */
     if ((dk_canon != NULL) && (Ustrcmp(dk_canon, "nofws") == 0)) dk_canon_int = DK_CANON_NOFWS;
  -  else dk_canon = "simple";
  +  else dk_canon = US "simple";


     /* Initialize signing context. */
     dk_context = dk_sign(dk_lib, &dk_internal_status, dk_canon_int);
  @@ -263,7 +263,7 @@


       if ((c == '.') && seen_lfdot) {
         /* escaped dot, write "\n.", continue */
  -      dk_message(dk_context, "\n.", 2);
  +      dk_message(dk_context, CUS "\n.", 2);
         seen_lf = 0;
         seen_lfdot = 0;
         continue;
  @@ -271,7 +271,7 @@


       if (seen_lfdot) {
         /* EOM, write "\n" and break */
  -      dk_message(dk_context, "\n", 1);
  +      dk_message(dk_context, CUS "\n", 1);
         break;
       }


@@ -282,7 +282,7 @@

       if (seen_lf) {
         /* normal lf, just send it */
  -      dk_message(dk_context, "\n", 1);
  +      dk_message(dk_context, CUS "\n", 1);
         seen_lf = 0;
       }


  @@ -292,7 +292,7 @@
       }


       /* write the char */
  -    dk_message(dk_context, &c, 1);
  +    dk_message(dk_context, CUS &c, 1);
     }


     /* Handle failed read above. */
  @@ -310,13 +310,13 @@


     /* Get domain to use, unless overridden. */
     if (dk_domain == NULL) {
  -    dk_domain = dk_address(dk_context);
  +    dk_domain = US dk_address(dk_context);
       switch(dk_domain[0]) {
         case 'N': dk_domain = NULL; break;
         case 'F':
         case 'S':
           dk_domain++;
  -        dk_domain = strrchr(dk_domain,'@');
  +        dk_domain = Ustrrchr(dk_domain,'@');
           if (dk_domain != NULL) {
             uschar *p;
             dk_domain++;
  @@ -331,7 +331,7 @@
            DomainKey-Signature header. If there is no domain to sign for, we
            can send the message anyway since the recipient has no policy to
            apply ... */
  -      rc = "";
  +      rc = US"";
         goto CLEANUP;
       }
     }
  @@ -373,7 +373,7 @@
          (Ustrcmp(dk_private_key,"0") == 0) ||
          (Ustrcmp(dk_private_key,"false") == 0) ) {
       /* don't sign, but no error */
  -    rc = "";
  +    rc = US"";
       goto CLEANUP;
     }


  @@ -381,7 +381,7 @@
       int privkey_fd = 0;
       /* Looks like a filename, load the private key. */
       memset(big_buffer,0,big_buffer_size);
  -    privkey_fd = open(dk_private_key,O_RDONLY);
  +    privkey_fd = open(CS dk_private_key,O_RDONLY);
       read(privkey_fd,big_buffer,16383);
       close(privkey_fd);
       dk_private_key = big_buffer;
  @@ -399,7 +399,7 @@


     rc = store_get(1024);
     /* Build DomainKey-Signature header to return. */
  -  snprintf(rc, 1024, "DomainKey-Signature: a=rsa-sha1; q=dns; c=%s;\r\n"
  +  snprintf(CS rc, 1024, "DomainKey-Signature: a=rsa-sha1; q=dns; c=%s;\r\n"
                        "\ts=%s; d=%s;\r\n"
                        "\tb=%s;\r\n", dk_canon, dk_selector, dk_domain, sig);



  Index: expand.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/expand.c,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- expand.c    20 Jun 2005 10:28:33 -0000    1.31
  +++ expand.c    20 Jun 2005 11:20:41 -0000    1.32
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/expand.c,v 1.31 2005/06/20 10:28:33 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/expand.c,v 1.32 2005/06/20 11:20:41 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -1281,31 +1281,31 @@


       if (Ustrcmp(var_table[middle].name, "dk_sender_source") == 0)
         switch(dk_verify_block->address_source) {
  -        case DK_EXIM_ADDRESS_NONE: s = "0"; break;
  -        case DK_EXIM_ADDRESS_FROM_FROM: s = "from"; break;
  -        case DK_EXIM_ADDRESS_FROM_SENDER: s = "sender"; break;
  +        case DK_EXIM_ADDRESS_NONE: s = US"0"; break;
  +        case DK_EXIM_ADDRESS_FROM_FROM: s = US"from"; break;
  +        case DK_EXIM_ADDRESS_FROM_SENDER: s = US"sender"; break;
         }


       if (Ustrcmp(var_table[middle].name, "dk_status") == 0)
         switch(dk_verify_block->result) {
  -        case DK_EXIM_RESULT_ERR: s = "error"; break;
  -        case DK_EXIM_RESULT_BAD_FORMAT: s = "bad format"; break;
  -        case DK_EXIM_RESULT_NO_KEY: s = "no key"; break;
  -        case DK_EXIM_RESULT_NO_SIGNATURE: s = "no signature"; break;
  -        case DK_EXIM_RESULT_REVOKED: s = "revoked"; break;
  -        case DK_EXIM_RESULT_NON_PARTICIPANT: s = "non-participant"; break;
  -        case DK_EXIM_RESULT_GOOD: s = "good"; break;
  -        case DK_EXIM_RESULT_BAD: s = "bad"; break;
  +        case DK_EXIM_RESULT_ERR: s = US"error"; break;
  +        case DK_EXIM_RESULT_BAD_FORMAT: s = US"bad format"; break;
  +        case DK_EXIM_RESULT_NO_KEY: s = US"no key"; break;
  +        case DK_EXIM_RESULT_NO_SIGNATURE: s = US"no signature"; break;
  +        case DK_EXIM_RESULT_REVOKED: s = US"revoked"; break;
  +        case DK_EXIM_RESULT_NON_PARTICIPANT: s = US"non-participant"; break;
  +        case DK_EXIM_RESULT_GOOD: s = US"good"; break;
  +        case DK_EXIM_RESULT_BAD: s = US"bad"; break;
         }


       if (Ustrcmp(var_table[middle].name, "dk_signsall") == 0)
  -      s = (dk_verify_block->signsall)? "1" : "0";
  +      s = (dk_verify_block->signsall)? US"1" : US"0";


       if (Ustrcmp(var_table[middle].name, "dk_testing") == 0)
  -      s = (dk_verify_block->testing)? "1" : "0";
  +      s = (dk_verify_block->testing)? US"1" : US"0";


       if (Ustrcmp(var_table[middle].name, "dk_is_signed") == 0)
  -      s = (dk_verify_block->is_signed)? "1" : "0";
  +      s = (dk_verify_block->is_signed)? US"1" : US"0";


       return (s == NULL)? US"" : s;
   #endif


  Index: transport.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/transport.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- transport.c    24 May 2005 14:56:27 -0000    1.9
  +++ transport.c    20 Jun 2005 11:20:41 -0000    1.10
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/transport.c,v 1.9 2005/05/24 14:56:27 ph10 Exp $ */
  +/* $Cambridge: exim/exim-src/src/transport.c,v 1.10 2005/06/20 11:20:41 ph10 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -1042,8 +1042,8 @@
       uschar *dk_strict_result = expand_string(dk_strict);
       if (dk_strict_result != NULL)
         {
  -      if ( (strcmpic(dk_strict,"1") == 0) ||
  -           (strcmpic(dk_strict,"true") == 0) )
  +      if ( (strcmpic(dk_strict,US"1") == 0) ||
  +           (strcmpic(dk_strict,US"true") == 0) )
           {
           save_errno = errno;
           rc = FALSE;
  @@ -1061,7 +1061,7 @@
       /* write the chunk */
       DK_WRITE:
       #ifdef SUPPORT_TLS
  -    if (tls_active == fd) wwritten = tls_write(p, sread); else
  +    if (tls_active == fd) wwritten = tls_write(US p, sread); else
       #endif
       wwritten = write(fd,p,sread);
       if (wwritten == -1)