~ubuntu-branches/debian/sid/claws-mail/sid

« back to all changes in this revision

Viewing changes to src/procheader.c

  • Committer: Package Import Robot
  • Author(s): Ricardo Mones
  • Date: 2015-08-18 16:37:25 UTC
  • mfrom: (1.3.7)
  • Revision ID: package-import@ubuntu.com-20150818163725-1it32n9mzqkwy2ef
Tags: 3.12.0-1
* New upstream release:
- 'cannot reorganize mailboxes' (Closes: #777208)
- 'dropdown menu bar has disappeared…'(Closes: #778886)
- 'depends on plugins libraries'  (Closes: #779824)
- 'new upstream version (3.12.0)…' (Closes: #793665)
* 14CVE_2010_5109.patch, 15fix_crash_open_folder.patch,
  13desktop_file_categories.patch
- Remove patches applied upstream
* debian/control, debian/copyright, debian/claws-mail-managesieve*
- Add managesieve plugin (new in this release)
* debian/rules
- Set perl-plugin manpage release version automatically
* 12fix_manpage_header.patch
- Update patch to cope with upstream changes
* debian/control, debian/watch
- Update VCS-* and watch URLs (thanks Julian Wollrath)

Show diffs side-by-side

added added

removed removed

Lines of Context:
337
337
MsgInfo *procheader_parse_file(const gchar *file, MsgFlags flags,
338
338
                               gboolean full, gboolean decrypted)
339
339
{
340
 
        struct stat s;
 
340
        GStatBuf s;
341
341
        FILE *fp;
342
342
        MsgInfo *msginfo;
343
343
 
790
790
{
791
791
        gint result;
792
792
        gint month_n;
793
 
        gchar zone1[3];
794
 
        gchar zone2[3];
 
793
        gint secfract;
 
794
        gint zone1 = 0, zone2 = 0;
 
795
        gchar offset_sign, zonestr[7];
 
796
        gchar sep1;
795
797
 
796
798
        if (str == NULL)
797
799
                return -1;
798
800
 
799
 
        result = sscanf(str, "%10s %d %9s %d %2d:%2d:%2d %5s",
 
801
        result = sscanf(str, "%10s %d %9s %d %2d:%2d:%2d %6s",
800
802
                        weekday, day, month, year, hh, mm, ss, zone);
801
803
        if (result == 8) return 0;
802
804
 
803
805
        /* RFC2822 */
804
 
        result = sscanf(str, "%3s,%d %9s %d %2d:%2d:%2d %5s",
 
806
        result = sscanf(str, "%3s,%d %9s %d %2d:%2d:%2d %6s",
805
807
                        weekday, day, month, year, hh, mm, ss, zone);
806
808
        if (result == 8) return 0;
807
809
 
808
 
        result = sscanf(str, "%d %9s %d %2d:%2d:%2d %5s",
 
810
        result = sscanf(str, "%d %9s %d %2d:%2d:%2d %6s",
809
811
                        day, month, year, hh, mm, ss, zone);
810
812
        if (result == 7) return 0;
811
813
 
819
821
        if (result == 6) return 0;
820
822
 
821
823
        *ss = 0;
822
 
        result = sscanf(str, "%10s %d %9s %d %2d:%2d %5s",
 
824
        result = sscanf(str, "%10s %d %9s %d %2d:%2d %6s",
823
825
                        weekday, day, month, year, hh, mm, zone);
824
826
        if (result == 7) return 0;
825
827
 
836
838
                        day, month, year, hh, mm);
837
839
        if (result == 5) return 0;
838
840
 
839
 
        /* RFC3339 subset */
840
841
        *weekday = '\0';
841
 
        result = sscanf(str, "%4d-%2d-%2d %2d:%2d:%2d+%2s:%2s",
842
 
                        year, &month_n, day, hh, mm, ss, zone1, zone2);
843
 
        if (result == 8) {
844
 
                if (1 <= month_n && month_n <= 12) {
845
 
                        strncpy2(month, monthstr+((month_n-1)*3), 4);
846
 
                        *zone = '+';
847
 
                        strncpy2(zone+1, zone1, 3);
848
 
                        strncpy2(zone+3, zone2, 3);
849
 
                        return 0;
850
 
                }
851
 
        }
852
 
 
853
 
        /* RFC3339 subset */
 
842
 
 
843
        /* RFC3339 subset, with fraction of second */
 
844
        result = sscanf(str, "%4d-%2d-%2d%c%2d:%2d:%2d.%1d%6s",
 
845
                        year, &month_n, day, &sep1, hh, mm, ss, &secfract, zonestr);
 
846
        debug_print("str |%s|, result %d\n", str, result);
 
847
        if (result == 9
 
848
                        && (sep1 == 'T' || sep1 == 't' || sep1 == ' ')) {
 
849
                if (month_n >= 1 && month_n <= 12) {
 
850
                        strncpy2(month, monthstr+((month_n-1)*3), 4);
 
851
                        if (zonestr[0] == 'z' || zonestr[0] == 'Z') {
 
852
                                strcat(zone, "+00:00");
 
853
                        } else if (sscanf(zonestr, "%c%2d:%2d",
 
854
                                                &offset_sign, &zone1, &zone2) == 3) {
 
855
                                strcat(zone, zonestr);
 
856
                        }
 
857
                        return 0;
 
858
                }
 
859
        }
 
860
 
 
861
        /* RFC3339 subset, no fraction of second */
 
862
        result = sscanf(str, "%4d-%2d-%2d%c%2d:%2d:%2d%6s",
 
863
                        year, &month_n, day, &sep1, hh, mm, ss, zonestr);
 
864
        debug_print("str |%s|, result %d\n", str, result);
 
865
        if (result == 8
 
866
                        && (sep1 == 'T' || sep1 == 't' || sep1 == ' ')) {
 
867
                if (month_n >= 1 && month_n <= 12) {
 
868
                        strncpy2(month, monthstr+((month_n-1)*3), 4);
 
869
                        if (zonestr[0] == 'z' || zonestr[0] == 'Z') {
 
870
                                strcat(zone, "+00:00");
 
871
                        } else if (sscanf(zonestr, "%c%2d:%2d",
 
872
                                                &offset_sign, &zone1, &zone2) == 3) {
 
873
                                strcat(zone, zonestr);
 
874
                        }
 
875
                        return 0;
 
876
                }
 
877
        }
 
878
 
854
879
        *zone = '\0';
855
 
        *weekday = '\0';
 
880
 
 
881
        /* RFC3339 subset */
 
882
        /* This particular "subset" is invalid, RFC requires the time offset */
856
883
        result = sscanf(str, "%4d-%2d-%2d %2d:%2d:%2d",
857
884
                        year, &month_n, day, hh, mm, ss);
858
885
        if (result == 6) {
928
955
        gchar month[10];
929
956
        gint year;
930
957
        gint hh, mm, ss;
931
 
        gchar zone[6];
 
958
        gchar zone[7];
932
959
        GDateMonth dmonth = G_DATE_BAD_MONTH;
933
960
        struct tm t;
934
961
        gchar *p;