gnats-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to gnats/gnats/file-pr.c


From: Milan Zamazal
Subject: Changes to gnats/gnats/file-pr.c
Date: Sun, 23 Dec 2001 15:22:20 -0500

Index: gnats/gnats/file-pr.c
diff -c gnats/gnats/file-pr.c:1.43 gnats/gnats/file-pr.c:1.44
*** gnats/gnats/file-pr.c:1.43  Tue Sep  4 14:24:19 2001
--- gnats/gnats/file-pr.c       Sun Dec 23 15:22:20 2001
***************
*** 546,555 ****
    char *prID = NULL;
    AdmEntry *cat;
    const char *headerValue;
-   char *c;
    struct re_pattern_buffer regex;
    struct re_registers regs;
!   int i, start, end;
    char case_fold[256];
    char *possiblePrNum;
    reg_syntax_t old_syntax;
--- 546,554 ----
    char *prID = NULL;
    AdmEntry *cat;
    const char *headerValue;
    struct re_pattern_buffer regex;
    struct re_registers regs;
!   int i, start, end, idstart;
    char case_fold[256];
    char *possiblePrNum;
    reg_syntax_t old_syntax;
***************
*** 569,579 ****
        case_fold[i] = tolower(i);
      }
    regex.translate = case_fold;
! 
!   /* look for "category/1234" and "category: 1234" */
! #define PAT "(.*re[ \t]*(\\[[0-9]+\\])?:)?[ \t]*([-a-z0-9_+.]*[:/][ 
\t]*([0-9]+))"
! 
!   re_compile_pattern (PAT, strlen (PAT), &regex);
    i = re_match (&regex, headerValue, strlen (headerValue), 0, &regs);
    regex.translate = NULL;
    regfree (&regex);
--- 568,578 ----
        case_fold[i] = tolower(i);
      }
    regex.translate = case_fold;
!   
!   {
!     const char *const PAT = "\\<((PR[ \t/])|([-a-z0-9_+.]+)/)([0-9]+)";
!     re_compile_pattern (PAT, strlen (PAT), &regex);
!   }
    i = re_match (&regex, headerValue, strlen (headerValue), 0, &regs);
    regex.translate = NULL;
    regfree (&regex);
***************
*** 584,591 ****
        return NULL;
      }
  
!   start = regs.start[3];
!   end = regs.end[3];
  
    free (regs.start);
    free (regs.end);
--- 583,591 ----
        return NULL;
      }
  
!   start = regs.start[0];
!   end = regs.end[0];
!   idstart = regs.start[4] - start;
  
    free (regs.start);
    free (regs.end);
***************
*** 594,633 ****
    memcpy (possiblePrNum, headerValue + start, end - start);
    possiblePrNum[end - start] = '\0';
  
!   c = strchr (possiblePrNum, '/');
!   if (c == NULL)
!     {
!       c = strchr (possiblePrNum, ':');
!     }
! 
!   if (c != NULL)
!     {
!       *c = '\0';
  
!       /* See if the category exists: */
!       cat = get_adm_record (CATEGORY (pr->database), possiblePrNum);
  
!       /* If no such category, then this is not a reply to a valid
!        * problem report.  This situtation can arise, for example, when
!        * someone has the string "OS/2" in their Subject header.
!        */
!       /* Folks often send in "pr/1234" instead of a valid category */
!       if ((cat != NULL) || (strcasecmp(possiblePrNum, "pr") == 0))
!         {
!           /* We only needed res, never cat, so free cat. */
!           free_adm_entry (cat);
! 
!         c++;                          /* skip sep */
!         while (*c != '\0' && isspace ((int) *c))
!           {
!             c++;
!           }
!           prID = xstrdup (c);
!         }
!     }
!   else
!     {
!       prID = xstrdup (possiblePrNum);
      }
  
    free (possiblePrNum);
--- 594,614 ----
    memcpy (possiblePrNum, headerValue + start, end - start);
    possiblePrNum[end - start] = '\0';
  
!   *(possiblePrNum + idstart - 1) = '\0';
  
!   /* See if the category exists: */
!   cat = get_adm_record (CATEGORY (pr->database), possiblePrNum);
  
!   /* If no such category, then this is not a reply to a valid
!    * problem report.  This situtation can arise, for example, when
!    * someone has the string "OS/2" in their Subject header.
!    */
!   /* Folks often send in "pr/1234" instead of a valid category */
!   if ((cat != NULL) || (strcasecmp (possiblePrNum, "pr") == 0))
!     {
!       /* We only needed res, never cat, so free cat. */
!       free_adm_entry (cat);
!       prID = xstrdup (possiblePrNum + idstart);
      }
  
    free (possiblePrNum);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]