[exim-cvs] cvs commit: exim/exim-src/src dcc.c dns.c malware…

Páxina inicial
Borrar esta mensaxe
Responder a esta mensaxe
Autor: Nigel Metheringham
Data:  
Para: exim-cvs
Asunto: [exim-cvs] cvs commit: exim/exim-src/src dcc.c dns.c malware.c mime.c receive.c spf.c
nm4 2009/11/11 10:08:02 GMT

  Modified files:
    exim-src/src         dcc.c dns.c malware.c mime.c receive.c 
                         spf.c 
  Log:
  Applied signed/unsigned fixes.  Need confirmation that this completely deals with bug.  Related: #905


  Revision  Changes    Path
  1.4       +12 -32    exim/exim-src/src/dcc.c
  1.20      +1 -1      exim/exim-src/src/dns.c
  1.18      +1 -1      exim/exim-src/src/malware.c
  1.19      +2 -2      exim/exim-src/src/mime.c
  1.51      +3 -2      exim/exim-src/src/receive.c
  1.9       +5 -5      exim/exim-src/src/spf.c


  Index: dcc.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/dcc.c,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- dcc.c    13 Oct 2009 15:08:03 -0000    1.3
  +++ dcc.c    11 Nov 2009 10:08:01 -0000    1.4
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/dcc.c,v 1.3 2009/10/13 15:08:03 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/dcc.c,v 1.4 2009/11/11 10:08:01 nm4 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -50,16 +50,8 @@
   int dcc_process(uschar **listptr) {
     int sep = 0;
     uschar *list = *listptr;
  -  uschar *user_name;
  -  uschar *body_begin;
  -  uschar user_name_buffer[128];
  -  unsigned long mbox_size;
     FILE *data_file;
  -  int dcc_sock;
  -  uschar dcc_buffer[32600];
     uschar *dcc_daemon_ip = US"";
  -  int dcc_daemon_port = 6276;
  -  uschar *dcc_request = US"header";
     uschar *dcc_default_ip_option = US"127.0.0.1";
     uschar *dcc_ip_option = US"";
     uschar *dcc_helo_option = US"localhost";
  @@ -67,7 +59,8 @@
     uschar *xtra_hdrs = NULL;


     /* from local_scan */
  -  int i, j, k, c, retval, sockfd, servlen, resp, portnr, line;
  +  int i, j, k, c, retval, sockfd, servlen, resp, line;
  +  unsigned int portnr;
     struct sockaddr_un  serv_addr;
     struct sockaddr_in  serv_addr_in;
     struct hostent *ipaddress;
  @@ -82,23 +75,10 @@
     uschar mbox_path[1024];
     uschar message_subdir[2];
     struct header_line *dcchdr;
  -  struct recipient_item *dcc_rcpt = recipients_list;
     uschar *dcc_acl_options;
     uschar dcc_acl_options_buffer[10];
     uschar dcc_xtra_hdrs[1024];


  -  int offset, result;
  -  uschar *p,*q;
  -  int override = 0;
  -  time_t start;
  -  struct sockaddr_un server;
  -#ifndef NO_POLL_H
  -  struct pollfd pollfd;
  -#endif
  -
  -  /* stop compiler warning */
  -  result = result;
  -
     /* grep 1st option */
     if ((dcc_acl_options = string_nextinlist(&list, &sep,
                                              dcc_acl_options_buffer,
  @@ -153,7 +133,7 @@
       if (dccifd_address[0] == '/')
         Ustrncpy(sockpath, dccifd_address, sizeof(sockpath));
       else
  -      if( sscanf(CS dccifd_address, "%s %u", sockip, portnr) != 2) {
  +      if( sscanf(CS dccifd_address, "%s %u", sockip, &portnr) != 2) {
           log_write(0, LOG_MAIN,
             "dcc acl condition: warning - invalid dccifd address: '%s'", dccifd_address);
           (void)fclose(data_file);
  @@ -329,7 +309,7 @@
     Ustrncat(sendbuf, "\n", sizeof(sendbuf)-Ustrlen(sendbuf)-1);
     flushbuffer(sockfd, sendbuf);
     DEBUG(D_acl)
  -    debug_printf("\n****************************\n", sendbuf);
  +    debug_printf("\n****************************\n%s", sendbuf);


     /* Clear the input buffer */
     bzero(sendbuf, sizeof(sendbuf));
  @@ -380,7 +360,7 @@


     /* Let's read from the socket until there's nothing left to read */
     bzero(recvbuf, sizeof(recvbuf));
  -  while(resp = read(sockfd, recvbuf, sizeof(recvbuf)-1) > 0) {
  +  while((resp = read(sockfd, recvbuf, sizeof(recvbuf)-1)) > 0) {
       /* How much did we get from the socket */
       c = Ustrlen(recvbuf) + 1;
       DEBUG(D_acl)
  @@ -405,13 +385,13 @@
                 DEBUG(D_acl)
                   debug_printf("Overall result = A\treturning OK\n");
                 Ustrcpy(dcc_return_text, "Mail accepted by DCC");
  -              dcc_result = "A";
  +              dcc_result = US"A";
                 retval = OK;
               }
               else if(recvbuf[i] == 'R') {
                 DEBUG(D_acl)
                   debug_printf("Overall result = R\treturning FAIL\n");
  -              dcc_result = "R";
  +              dcc_result = US"R";
                 retval = FAIL;
                 if(sender_host_name) {
                   log_write(0, LOG_MAIN, "H=%s [%s] F=<%s>: rejected by DCC", sender_host_name, sender_host_address, sender_address);
  @@ -427,14 +407,14 @@
                 Ustrcpy(dcc_return_text, "Not all recipients accepted by DCC");
                 /* Since we're in an ACL we want a global result
                  * so we accept for all */
  -              dcc_result = "A";
  +              dcc_result = US"A";
                 retval = OK;
               }
               else if(recvbuf[i] == 'G') {
                 DEBUG(D_acl)
                   debug_printf("Overall result  = G\treturning FAIL\n");
                 Ustrcpy(dcc_return_text, "Greylisted by DCC");
  -              dcc_result = "G";
  +              dcc_result = US"G";
                 retval = FAIL;
               }
               else if(recvbuf[i] == 'T') {
  @@ -443,7 +423,7 @@
                 retval = DEFER;
                 log_write(0,LOG_MAIN,"Temporary error with DCC: %s\n", recvbuf);
                 Ustrcpy(dcc_return_text, "Temporary error with DCC");
  -              dcc_result = "T";
  +              dcc_result = US"T";
               }
               else {
                 DEBUG(D_acl)
  @@ -451,7 +431,7 @@
                 retval = DEFER;
                 log_write(0,LOG_MAIN,"Unknown DCC response: %s\n", recvbuf);
                 Ustrcpy(dcc_return_text, "Unknown DCC response");
  -              dcc_result = "T";
  +              dcc_result = US"T";
               }
             }
             else {
  @@ -517,7 +497,7 @@


     /* check if we should add additional headers passed in acl_m_dcc_add_header */
     if(dcc_direct_add_header) {
  -    if (((xtra_hdrs = expand_string("$acl_m_dcc_add_header")) != NULL) && (xtra_hdrs[0] != '\0')) {
  +    if (((xtra_hdrs = expand_string(US"$acl_m_dcc_add_header")) != NULL) && (xtra_hdrs[0] != '\0')) {
         Ustrncpy(dcc_xtra_hdrs, xtra_hdrs, sizeof(dcc_xtra_hdrs) - 2);
         if (dcc_xtra_hdrs[Ustrlen(dcc_xtra_hdrs)-1] != '\n')
           Ustrcat(dcc_xtra_hdrs, "\n");


  Index: dns.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/dns.c,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- dns.c    19 Oct 2009 14:20:58 -0000    1.19
  +++ dns.c    11 Nov 2009 10:08:01 -0000    1.20
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/dns.c,v 1.19 2009/10/19 14:20:58 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/dns.c,v 1.20 2009/11/11 10:08:01 nm4 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -462,8 +462,8 @@
   int
   dns_basic_lookup(dns_answer *dnsa, uschar *name, int type)
   {
  -int rc = -1;
   #ifndef STAND_ALONE
  +int rc = -1;
   uschar *save;
   #endif



  Index: malware.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/malware.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- malware.c    5 Nov 2009 19:40:51 -0000    1.17
  +++ malware.c    11 Nov 2009 10:08:01 -0000    1.18
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/malware.c,v 1.17 2009/11/05 19:40:51 nm4 Exp $ */
  +/* $Cambridge: exim/exim-src/src/malware.c,v 1.18 2009/11/11 10:08:01 nm4 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -231,7 +231,7 @@
           if ( Ustrstr(buf, US"<detected type=\"") != NULL ) {
             detected = 1;
           } else if ( detected && (strhelper = Ustrstr(buf, US"<name>")) ) {
  -          if (strhelper2 = (Ustrstr(buf, US"</name>"))) {
  +          if ((strhelper2 = Ustrstr(buf, US"</name>")) != NULL) {
               *strhelper2 = '\0';
               Ustrcpy(malware_name_buffer, strhelper + 6);
             }


  Index: mime.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/mime.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- mime.c    9 Nov 2009 14:31:24 -0000    1.18
  +++ mime.c    11 Nov 2009 10:08:02 -0000    1.19
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/mime.c,v 1.18 2009/11/09 14:31:24 tom Exp $ */
  +/* $Cambridge: exim/exim-src/src/mime.c,v 1.19 2009/11/11 10:08:02 nm4 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -106,7 +106,7 @@


     opos = obuf;


  -  while (fgets((char *)ibuf, MIME_MAX_LINE_LENGTH, in) != NULL)
  +  while (Ufgets(ibuf, MIME_MAX_LINE_LENGTH, in) != NULL)
     {
       if (boundary != NULL
         && Ustrncmp(ibuf, "--", 2) == 0
  @@ -153,7 +153,7 @@
           return -1; /* error */
         size += len;
         /* copy incomplete last byte to start of obuf, where we continue */
  -      if (bytestate & 3 != 0)
  +      if ((bytestate & 3) != 0)
           *obuf = *opos;
         opos = obuf;
       }


  Index: receive.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/receive.c,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- receive.c    16 Oct 2009 12:33:09 -0000    1.50
  +++ receive.c    11 Nov 2009 10:08:02 -0000    1.51
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/receive.c,v 1.50 2009/10/16 12:33:09 nm4 Exp $ */
  +/* $Cambridge: exim/exim-src/src/receive.c,v 1.51 2009/11/11 10:08:02 nm4 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -1067,7 +1067,7 @@
   header_line *my_headerlist;
   uschar *user_msg, *log_msg;
   int mime_part_count_buffer = -1;
  -int rc;
  +int rc = OK;


memset(CS rfc822_file_path,0,2048);

@@ -1285,7 +1285,8 @@
BOOL
receive_msg(BOOL extract_recip)
{
-int i, rc;
+int i;
+int rc = FAIL;
int msg_size = 0;
int process_info_len = Ustrlen(process_info);
int error_rc = (error_handling == ERRORS_SENDER)?

  Index: spf.c
  ===================================================================
  RCS file: /home/cvs/exim/exim-src/src/spf.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- spf.c    12 Feb 2008 12:52:51 -0000    1.8
  +++ spf.c    11 Nov 2009 10:08:02 -0000    1.9
  @@ -1,4 +1,4 @@
  -/* $Cambridge: exim/exim-src/src/spf.c,v 1.8 2008/02/12 12:52:51 nm4 Exp $ */
  +/* $Cambridge: exim/exim-src/src/spf.c,v 1.9 2009/11/11 10:08:02 nm4 Exp $ */


   /*************************************************
   *     Exim - an Internet mail transport agent    *
  @@ -43,7 +43,7 @@
       return 0;
     }


  -  if (SPF_server_set_rec_dom(spf_server, primary_hostname)) {
  +  if (SPF_server_set_rec_dom(spf_server, CS primary_hostname)) {
       debug_printf("spf: SPF_server_set_rec_dom() failed.\n");
       spf_server = NULL;
       return 0;
  @@ -51,14 +51,14 @@


     spf_request = SPF_request_new(spf_server);


  -  if (SPF_request_set_ipv4_str(spf_request, spf_remote_addr)) {
  +  if (SPF_request_set_ipv4_str(spf_request, CS spf_remote_addr)) {
       debug_printf("spf: SPF_request_set_ipv4_str() failed.\n");
       spf_server = NULL;
       spf_request = NULL;
       return 0;
     }


  -  if (SPF_request_set_helo_dom(spf_request, spf_helo_domain)) {
  +  if (SPF_request_set_helo_dom(spf_request, CS spf_helo_domain)) {
       debug_printf("spf: SPF_set_helo_dom() failed.\n");
       spf_server = NULL;
       spf_request = NULL;
  @@ -86,7 +86,7 @@
       goto SPF_EVALUATE;
     };


  -  if (SPF_request_set_env_from(spf_request, spf_envelope_sender)) {
  +  if (SPF_request_set_env_from(spf_request, CS spf_envelope_sender)) {
       /* Invalid sender address. This should be a real rare occurence */
       rc = SPF_RESULT_PERMERROR;
       goto SPF_EVALUATE;
  @@ -94,7 +94,7 @@


     /* get SPF result */
     if (action == SPF_PROCESS_FALLBACK)
  -    SPF_request_query_fallback(spf_request, &spf_response, spf_guess);
  +    SPF_request_query_fallback(spf_request, &spf_response, CS spf_guess);
     else
       SPF_request_query_mailfrom(spf_request, &spf_response);