comparison src/libpst.c @ 142:2189a6b8134e

improve character set handling - don't try to convert utf-8 to single byte for fields that were not originally unicode. if the conversion fails, leave the data in utf-8.
author Carl Byington <carl@five-ten-sg.com>
date Mon, 23 Feb 2009 20:40:51 -0800
parents fd4297884319
children fdc58ad2c758
comparison
equal deleted inserted replaced
141:fd4297884319 142:2189a6b8134e
123 0xfd, 0x9d, 0x18, 0x41, 0x7d, 0x93, 0xd8, 0x58, 0x2c, 0xce, 0xfe, 0x24, 0xaf, 0xde, 0xb8, 0x36, 123 0xfd, 0x9d, 0x18, 0x41, 0x7d, 0x93, 0xd8, 0x58, 0x2c, 0xce, 0xfe, 0x24, 0xaf, 0xde, 0xb8, 0x36,
124 0xc8, 0xa1, 0x80, 0xa6, 0x99, 0x98, 0xa8, 0x2f, 0x0e, 0x81, 0x65, 0x73, 0xe4, 0xc2, 0xa2, 0x8a, 124 0xc8, 0xa1, 0x80, 0xa6, 0x99, 0x98, 0xa8, 0x2f, 0x0e, 0x81, 0x65, 0x73, 0xe4, 0xc2, 0xa2, 0x8a,
125 0xd4, 0xe1, 0x11, 0xd0, 0x08, 0x8b, 0x2a, 0xf2, 0xed, 0x9a, 0x64, 0x3f, 0xc1, 0x6c, 0xf9, 0xec 125 0xd4, 0xe1, 0x11, 0xd0, 0x08, 0x8b, 0x2a, 0xf2, 0xed, 0x9a, 0x64, 0x3f, 0xc1, 0x6c, 0xf9, 0xec
126 }; 126 };
127 127
128 // for "strong" encryption, we have the two additional tables 128 // for "strong" encryption, we have the two additional tables,
129 // which (with the previous table) are used as the keys in an
130 // Enigma 3 rotor cipher
129 static unsigned char comp_high1 [] = { 131 static unsigned char comp_high1 [] = {
130 0x41, 0x36, 0x13, 0x62, 0xa8, 0x21, 0x6e, 0xbb, 0xf4, 0x16, 0xcc, 0x04, 0x7f, 0x64, 0xe8, 0x5d, 132 0x41, 0x36, 0x13, 0x62, 0xa8, 0x21, 0x6e, 0xbb, 0xf4, 0x16, 0xcc, 0x04, 0x7f, 0x64, 0xe8, 0x5d,
131 0x1e, 0xf2, 0xcb, 0x2a, 0x74, 0xc5, 0x5e, 0x35, 0xd2, 0x95, 0x47, 0x9e, 0x96, 0x2d, 0x9a, 0x88, 133 0x1e, 0xf2, 0xcb, 0x2a, 0x74, 0xc5, 0x5e, 0x35, 0xd2, 0x95, 0x47, 0x9e, 0x96, 0x2d, 0x9a, 0x88,
132 0x4c, 0x7d, 0x84, 0x3f, 0xdb, 0xac, 0x31, 0xb6, 0x48, 0x5f, 0xf6, 0xc4, 0xd8, 0x39, 0x8b, 0xe7, 134 0x4c, 0x7d, 0x84, 0x3f, 0xdb, 0xac, 0x31, 0xb6, 0x48, 0x5f, 0xf6, 0xc4, 0xd8, 0x39, 0x8b, 0xe7,
133 0x23, 0x3b, 0x38, 0x8e, 0xc8, 0xc1, 0xdf, 0x25, 0xb1, 0x20, 0xa5, 0x46, 0x60, 0x4e, 0x9c, 0xfb, 135 0x23, 0x3b, 0x38, 0x8e, 0xc8, 0xc1, 0xdf, 0x25, 0xb1, 0x20, 0xa5, 0x46, 0x60, 0x4e, 0x9c, 0xfb,
517 DEBUG_RET(); 519 DEBUG_RET();
518 return 0; 520 return 0;
519 } 521 }
520 522
521 if (p->list_index) { 523 if (p->list_index) {
522 id2_head = pst_build_id2(pf, p->list_index, NULL); 524 id2_head = pst_build_id2(pf, p->list_index);
523 pst_printID2ptr(id2_head); 525 pst_printID2ptr(id2_head);
524 } else { 526 } else {
525 DEBUG_WARN(("Have not been able to fetch any id2 values for item 0x61. Brace yourself!\n")); 527 DEBUG_WARN(("Have not been able to fetch any id2 values for item 0x61. Brace yourself!\n"));
526 } 528 }
527 529
1045 DEBUG_RET(); 1047 DEBUG_RET();
1046 return NULL; 1048 return NULL;
1047 } 1049 }
1048 1050
1049 if (d_ptr->list_index) { 1051 if (d_ptr->list_index) {
1050 id2_head = pst_build_id2(pf, d_ptr->list_index, NULL); 1052 id2_head = pst_build_id2(pf, d_ptr->list_index);
1051 (void)pst_printID2ptr(id2_head); 1053 (void)pst_printID2ptr(id2_head);
1052 } else {
1053 DEBUG_WARN(("Have not been able to fetch any id2 values for this item. Brace yourself!\n"));
1054 } 1054 }
1055 1055
1056 list = pst_parse_block(pf, d_ptr->desc->id, id2_head, NULL); 1056 list = pst_parse_block(pf, d_ptr->desc->id, id2_head, NULL);
1057 if (!list) { 1057 if (!list) {
1058 DEBUG_WARN(("pst_parse_block() returned an error for d_ptr->desc->id [%#"PRIx64"]\n", d_ptr->desc->id)); 1058 DEBUG_WARN(("pst_parse_block() returned an error for d_ptr->desc->id [%#"PRIx64"]\n", d_ptr->desc->id));
1071 if (id2_head) pst_free_id2(id2_head); 1071 if (id2_head) pst_free_id2(id2_head);
1072 DEBUG_RET(); 1072 DEBUG_RET();
1073 return NULL; 1073 return NULL;
1074 } 1074 }
1075 if (list) pst_free_list(list); 1075 if (list) pst_free_list(list);
1076 list = NULL; //pst_process will free the items in the list 1076 list = NULL;
1077
1078 if ((id_ptr = pst_getID2(id2_head, (uint64_t)0x692))) {
1079 // DSN/MDN reports?
1080 DEBUG_EMAIL(("DSN/MDN processing \n"));
1081 if ((list = pst_parse_block(pf, id_ptr->id, id2_head, NULL)) == NULL) {
1082 DEBUG_WARN(("ERROR error processing main DSN/MDN record\n"));
1083 if (item) pst_freeItem(item);
1084 if (list) pst_free_list(list);
1085 if (id2_head) pst_free_id2(id2_head);
1086 DEBUG_RET();
1087 return item;
1088 }
1089 else {
1090 for (x=0; x < list->count_array; x++) {
1091 attach = (pst_item_attach*) xmalloc(sizeof(pst_item_attach));
1092 memset(attach, 0, sizeof(pst_item_attach));
1093 attach->next = item->attach;
1094 item->attach = attach;
1095 }
1096
1097 if (pst_process(list, item, item->attach)) {
1098 DEBUG_WARN(("ERROR pst_process() failed with attachments\n"));
1099 if (item) pst_freeItem(item);
1100 if (list) pst_free_list(list);
1101 if (id2_head) pst_free_id2(id2_head);
1102 DEBUG_RET();
1103 return NULL;
1104 }
1105 if (list) pst_free_list(list);
1106 list = NULL;
1107 }
1108 }
1077 1109
1078 if ((id_ptr = pst_getID2(id2_head, (uint64_t)0x671))) { 1110 if ((id_ptr = pst_getID2(id2_head, (uint64_t)0x671))) {
1079 // should not have any existing attachments anyway 1111 // should not have any existing attachments anyway
1080 while (item->attach) { 1112 //while (item->attach) {
1081 DEBUG_EMAIL(("throw away existing attachment\n")); 1113 // DEBUG_EMAIL(("throw away existing attachment\n"));
1082 attach = item->attach->next; 1114 // attach = item->attach->next;
1083 free(item->attach); 1115 // free(item->attach);
1084 item->attach = attach; 1116 // item->attach = attach;
1085 } 1117 //}
1086 1118
1087 DEBUG_EMAIL(("ATTACHMENT processing attachment\n")); 1119 DEBUG_EMAIL(("ATTACHMENT processing attachment\n"));
1088 if ((list = pst_parse_block(pf, id_ptr->id, id2_head, NULL)) == NULL) { 1120 if ((list = pst_parse_block(pf, id_ptr->id, id2_head, NULL)) == NULL) {
1089 DEBUG_WARN(("ERROR error processing main attachment record\n")); 1121 DEBUG_WARN(("ERROR error processing main attachment record\n"));
1090 if (id2_head) pst_free_id2(id2_head); 1122 if (id2_head) pst_free_id2(id2_head);
1123 // load all the extra stuff here. 1155 // load all the extra stuff here.
1124 if ((list = pst_parse_block(pf, id_ptr->id, NULL, NULL)) == NULL) { 1156 if ((list = pst_parse_block(pf, id_ptr->id, NULL, NULL)) == NULL) {
1125 DEBUG_WARN(("ERROR error processing an attachment record\n")); 1157 DEBUG_WARN(("ERROR error processing an attachment record\n"));
1126 attach = attach->next; 1158 attach = attach->next;
1127 continue; 1159 continue;
1160 }
1161 if (list->count_array > 1) {
1162 DEBUG_WARN(("ERROR probably fatal, list count array will overrun attach structure.\n"));
1128 } 1163 }
1129 if (pst_process(list, item, attach)) { 1164 if (pst_process(list, item, attach)) {
1130 DEBUG_WARN(("ERROR pst_process() failed with an attachment\n")); 1165 DEBUG_WARN(("ERROR pst_process() failed with an attachment\n"));
1131 if (list) pst_free_list(list); 1166 if (list) pst_free_list(list);
1132 list = NULL; 1167 list = NULL;
1144 } else { 1179 } else {
1145 DEBUG_WARN(("have not located the correct value for the attachment [%#"PRIx64"]\n", attach->id2_val)); 1180 DEBUG_WARN(("have not located the correct value for the attachment [%#"PRIx64"]\n", attach->id2_val));
1146 } 1181 }
1147 } else { 1182 } else {
1148 DEBUG_WARN(("ERROR cannot locate id2 value %#"PRIx64"\n", attach->id2_val)); 1183 DEBUG_WARN(("ERROR cannot locate id2 value %#"PRIx64"\n", attach->id2_val));
1184 attach->id2_val = 0; // suppress this missing attachment
1149 } 1185 }
1150 attach = attach->next; 1186 attach = attach->next;
1151 } 1187 }
1152 } 1188 }
1153 } 1189 }
1682 } \ 1718 } \
1683 } 1719 }
1684 1720
1685 #define NULL_CHECK(x) { if (!x) { DEBUG_EMAIL(("NULL_CHECK: Null Found\n")); break;} } 1721 #define NULL_CHECK(x) { if (!x) { DEBUG_EMAIL(("NULL_CHECK: Null Found\n")); break;} }
1686 1722
1687 #define MOVE_NEXT(targ) { \ 1723
1688 if (next){\ 1724 /**
1689 if (!targ) {\ 1725 * process the list of items produced from parse_block()
1690 DEBUG_EMAIL(("MOVE_NEXT: Target is NULL. Will stop processing this option\n"));\ 1726 *
1691 break;\ 1727 * @param list pointer to the linked list of things from parse_block()
1692 }\ 1728 * @param item pointer to the item to be updated from the list.
1693 targ = targ->next;\ 1729 * this item may be an email, contact or other sort of item.
1694 if (!targ) {\ 1730 * the type of this item is generally set by the things
1695 DEBUG_EMAIL(("MOVE_NEXT: Target is NULL after next. Will stop processing this option\n"));\ 1731 * from the list.
1696 break;\ 1732 * @param attach pointer to the linked list of attachment records. If
1697 }\ 1733 * this is non-null, the length of the this attachment list
1698 next=0;\ 1734 * must be at least as large as the length of the list.
1699 }\ 1735 *
1700 } 1736 * @return 0 for ok, -1 for error.
1701 1737 */
1702 1738 int pst_process(pst_num_array *list, pst_item *item, pst_item_attach *attach) {
1703 int pst_process(pst_num_array *list , pst_item *item, pst_item_attach *attach) {
1704 int32_t x, t;
1705 int next = 0;
1706 pst_item_extra_field *ef;
1707
1708 DEBUG_ENT("pst_process"); 1739 DEBUG_ENT("pst_process");
1709 if (!item) { 1740 if (!item) {
1710 DEBUG_EMAIL(("item cannot be NULL.\n")); 1741 DEBUG_EMAIL(("item cannot be NULL.\n"));
1711 DEBUG_RET(); 1742 DEBUG_RET();
1712 return -1; 1743 return -1;
1713 } 1744 }
1714 1745
1715 while (list) { 1746 while (list) {
1716 x = 0; 1747 int32_t x = 0;
1717 while (x < list->count_item) { 1748 while (x < list->count_item) {
1749 int32_t t;
1750 pst_item_extra_field *ef;
1718 // check here to see if the id is one that is mapped. 1751 // check here to see if the id is one that is mapped.
1719 DEBUG_EMAIL(("#%d - id: %#x type: %#x length: %#x\n", x, list->items[x]->id, list->items[x]->type, list->items[x]->size)); 1752 DEBUG_EMAIL(("#%d - id: %#x type: %#x length: %#x\n", x, list->items[x]->id, list->items[x]->type, list->items[x]->size));
1720 1753
1721 switch (list->items[x]->id) { 1754 switch (list->items[x]->id) {
1722 case PST_ATTRIB_HEADER: // CUSTOM attribute for saying the Extra Headers 1755 case PST_ATTRIB_HEADER: // CUSTOM attribute for saying the Extra Headers
1769 case 0x0017: // PR_IMPORTANCE 1802 case 0x0017: // PR_IMPORTANCE
1770 // How important the sender deems it to be 1803 // How important the sender deems it to be
1771 // 0 - Low 1804 // 0 - Low
1772 // 1 - Normal 1805 // 1 - Normal
1773 // 2 - High 1806 // 2 - High
1774
1775 DEBUG_EMAIL(("Importance Level - ")); 1807 DEBUG_EMAIL(("Importance Level - "));
1776 MALLOC_EMAIL(item); 1808 MALLOC_EMAIL(item);
1777 memcpy(&(item->email->importance), list->items[x]->data, sizeof(item->email->importance)); 1809 memcpy(&(item->email->importance), list->items[x]->data, sizeof(item->email->importance));
1778 LE32_CPU(item->email->importance); 1810 LE32_CPU(item->email->importance);
1779 t = item->email->importance; 1811 t = item->email->importance;
1780 DEBUG_EMAIL(("%s [%i]\n", ((int)t==0?"Low":((int)t==1?"Normal":"High")), t)); 1812 DEBUG_EMAIL(("%s [%i]\n", ((int)t==0?"Low":
1813 ((int)t==1?"Normal":
1814 "High")), t));
1781 break; 1815 break;
1782 case 0x001A: // PR_MESSAGE_CLASS Ascii type of messages - NOT FOLDERS 1816 case 0x001A: // PR_MESSAGE_CLASS Ascii type of messages - NOT FOLDERS
1783 // must be case insensitive 1817 // must be case insensitive
1784 DEBUG_EMAIL(("IPM.x - ")); 1818 DEBUG_EMAIL(("IPM.x - "));
1785 LIST_COPY(item->ascii_type, (char*)); 1819 LIST_COPY(item->ascii_type, (char*));
1860 DEBUG_EMAIL(("Original Sensitivity - ")); 1894 DEBUG_EMAIL(("Original Sensitivity - "));
1861 MALLOC_EMAIL(item); 1895 MALLOC_EMAIL(item);
1862 memcpy(&(item->email->orig_sensitivity), list->items[x]->data, sizeof(item->email->orig_sensitivity)); 1896 memcpy(&(item->email->orig_sensitivity), list->items[x]->data, sizeof(item->email->orig_sensitivity));
1863 LE32_CPU(item->email->orig_sensitivity); 1897 LE32_CPU(item->email->orig_sensitivity);
1864 t = item->email->orig_sensitivity; 1898 t = item->email->orig_sensitivity;
1865 DEBUG_EMAIL(("%s [%i]\n", ((int)t==0?"None":((int)t==1?"Personal": 1899 DEBUG_EMAIL(("%s [%i]\n", ((int)t==0?"None":
1866 ((int)t==2?"Private":"Company Confidential"))), t)); 1900 ((int)t==1?"Personal":
1901 ((int)t==2?"Private":
1902 "Company Confidential"))), t));
1903 break;
1904 case 0x0032: // PR_REPORT_TIME
1905 DEBUG_EMAIL(("Report time - "));
1906 MALLOC_EMAIL(item);
1907 LIST_COPY_TIME(item->email->report_time);
1908 DEBUG_EMAIL(("%s", fileTimeToAscii(item->email->report_time)));
1867 break; 1909 break;
1868 case 0x0036: // PR_SENSITIVITY 1910 case 0x0036: // PR_SENSITIVITY
1869 // sender's opinion of the sensitivity of an email 1911 // sender's opinion of the sensitivity of an email
1870 // 0 - None 1912 // 0 - None
1871 // 1 - Personal 1913 // 1 - Personal
1872 // 2 - Private 1914 // 2 - Private
1873 // 3 - Company Confidiential 1915 // 3 - Company Confidential
1874 DEBUG_EMAIL(("Sensitivity - ")); 1916 DEBUG_EMAIL(("Sensitivity - "));
1875 MALLOC_EMAIL(item); 1917 MALLOC_EMAIL(item);
1876 memcpy(&(item->email->sensitivity), list->items[x]->data, sizeof(item->email->sensitivity)); 1918 memcpy(&(item->email->sensitivity), list->items[x]->data, sizeof(item->email->sensitivity));
1877 LE32_CPU(item->email->sensitivity); 1919 LE32_CPU(item->email->sensitivity);
1878 t = item->email->sensitivity; 1920 t = item->email->sensitivity;
1879 DEBUG_EMAIL(("%s [%i]\n", ((int)t==0?"None":((int)t==1?"Personal": 1921 DEBUG_EMAIL(("%s [%i]\n", ((int)t==0?"None":
1880 ((int)t==2?"Private":"Company Confidential"))), t)); 1922 ((int)t==1?"Personal":
1923 ((int)t==2?"Private":
1924 "Company Confidential"))), t));
1881 break; 1925 break;
1882 case 0x0037: // PR_SUBJECT raw subject 1926 case 0x0037: // PR_SUBJECT raw subject
1883 DEBUG_EMAIL(("Raw Subject - ")); 1927 DEBUG_EMAIL(("Raw Subject - "));
1884 MALLOC_EMAIL(item); 1928 MALLOC_EMAIL(item);
1885 item->email->subject = (pst_item_email_subject*) realloc(item->email->subject, sizeof(pst_item_email_subject)); 1929 item->email->subject = (pst_item_email_subject*) realloc(item->email->subject, sizeof(pst_item_email_subject));
2084 DEBUG_EMAIL(("Internet Header - ")); 2128 DEBUG_EMAIL(("Internet Header - "));
2085 MALLOC_EMAIL(item); 2129 MALLOC_EMAIL(item);
2086 LIST_COPY(item->email->header, (char*)); 2130 LIST_COPY(item->email->header, (char*));
2087 DEBUG_EMAIL(("%s\n", item->email->header)); 2131 DEBUG_EMAIL(("%s\n", item->email->header));
2088 break; 2132 break;
2133 case 0x0C04: // PR_NDR_REASON_CODE
2134 MALLOC_EMAIL(item);
2135 memcpy(&(item->email->ndr_reason_code), list->items[x]->data, sizeof(item->email->ndr_reason_code));
2136 LE32_CPU(item->email->ndr_reason_code);
2137 t = item->email->ndr_reason_code;
2138 DEBUG_EMAIL(("NDR reason code - [%i]\n", (int)t));
2139 break;
2140 case 0x0C05: // PR_NDR_DIAG_CODE
2141 MALLOC_EMAIL(item);
2142 memcpy(&(item->email->ndr_diag_code), list->items[x]->data, sizeof(item->email->ndr_diag_code));
2143 LE32_CPU(item->email->ndr_diag_code);
2144 t = item->email->ndr_diag_code;
2145 DEBUG_EMAIL(("NDR diag code - [%i]\n", (int)t));
2146 break;
2147 case 0x0C06: // PR_NON_RECEIPT_NOTIFICATION_REQUESTED
2148 DEBUG_EMAIL(("Non-Receipt Notification Requested - (ignored) - "));
2149 if (*(int16_t*)list->items[x]->data) {
2150 DEBUG_EMAIL(("True\n"));
2151 } else {
2152 DEBUG_EMAIL(("False\n"));
2153 }
2154 break;
2089 case 0x0C17: // PR_REPLY_REQUESTED 2155 case 0x0C17: // PR_REPLY_REQUESTED
2090 DEBUG_EMAIL(("Reply Requested - ")); 2156 DEBUG_EMAIL(("Reply Requested - "));
2091 MALLOC_EMAIL(item); 2157 MALLOC_EMAIL(item);
2092 if (*(int16_t*)list->items[x]->data) { 2158 if (*(int16_t*)list->items[x]->data) {
2093 DEBUG_EMAIL(("True\n")); 2159 DEBUG_EMAIL(("True\n"));
2101 DEBUG_EMAIL(("Sender Structure 2 -- NOT HANDLED\n")); 2167 DEBUG_EMAIL(("Sender Structure 2 -- NOT HANDLED\n"));
2102 break; 2168 break;
2103 case 0x0C1A: // PR_SENDER_NAME Name of Sender Structure 2 2169 case 0x0C1A: // PR_SENDER_NAME Name of Sender Structure 2
2104 DEBUG_EMAIL(("Name of Sender Structure 2 -- NOT HANDLED\n")); 2170 DEBUG_EMAIL(("Name of Sender Structure 2 -- NOT HANDLED\n"));
2105 break; 2171 break;
2172 case 0x0C1B: // PR_SUPPLEMENTARY_INFO
2173 DEBUG_EMAIL(("Supplementary info - "));
2174 MALLOC_EMAIL(item);
2175 LIST_COPY(item->email->supplementary_info, (char*));
2176 DEBUG_EMAIL(("%s\n", item->email->supplementary_info));
2177 break;
2106 case 0x0C1D: // PR_SENDER_SEARCH_KEY Name of Sender Address 2 2178 case 0x0C1D: // PR_SENDER_SEARCH_KEY Name of Sender Address 2
2107 DEBUG_EMAIL(("Name of Sender Address 2 (Sender search key) - ")); 2179 DEBUG_EMAIL(("Name of Sender Address 2 (Sender search key) - "));
2108 MALLOC_EMAIL(item); 2180 MALLOC_EMAIL(item);
2109 LIST_COPY(item->email->outlook_sender2, (char*)); 2181 LIST_COPY(item->email->outlook_sender2, (char*));
2110 DEBUG_EMAIL(("%s\n", item->email->outlook_sender2)); 2182 DEBUG_EMAIL(("%s\n", item->email->outlook_sender2));
2118 case 0x0C1F: // PR_SENDER_EMAIL_ADDRESS Sender Address 2 2190 case 0x0C1F: // PR_SENDER_EMAIL_ADDRESS Sender Address 2
2119 DEBUG_EMAIL(("Sender Address - ")); 2191 DEBUG_EMAIL(("Sender Address - "));
2120 MALLOC_EMAIL(item); 2192 MALLOC_EMAIL(item);
2121 LIST_COPY(item->email->sender2_address, (char*)); 2193 LIST_COPY(item->email->sender2_address, (char*));
2122 DEBUG_EMAIL(("%s\n", item->email->sender2_address)); 2194 DEBUG_EMAIL(("%s\n", item->email->sender2_address));
2195 break;
2196 case 0x0C20: // PR_NDR_STATUS_CODE
2197 MALLOC_EMAIL(item);
2198 memcpy(&(item->email->ndr_status_code), list->items[x]->data, sizeof(item->email->ndr_status_code));
2199 LE32_CPU(item->email->ndr_status_code);
2200 t = item->email->ndr_status_code;
2201 DEBUG_EMAIL(("NDR status code - [%i]\n", (int)t));
2123 break; 2202 break;
2124 case 0x0E01: // PR_DELETE_AFTER_SUBMIT 2203 case 0x0E01: // PR_DELETE_AFTER_SUBMIT
2125 // I am not too sure how this works 2204 // I am not too sure how this works
2126 DEBUG_EMAIL(("Delete after submit - ")); 2205 DEBUG_EMAIL(("Delete after submit - "));
2127 MALLOC_EMAIL(item); 2206 MALLOC_EMAIL(item);
2204 } 2283 }
2205 break; 2284 break;
2206 case 0x0E20: // PR_ATTACH_SIZE binary Attachment data in record 2285 case 0x0E20: // PR_ATTACH_SIZE binary Attachment data in record
2207 DEBUG_EMAIL(("Attachment Size - ")); 2286 DEBUG_EMAIL(("Attachment Size - "));
2208 NULL_CHECK(attach); 2287 NULL_CHECK(attach);
2209 MOVE_NEXT(attach);
2210 t = (*(int32_t*)list->items[x]->data); 2288 t = (*(int32_t*)list->items[x]->data);
2211 LE32_CPU(t); 2289 LE32_CPU(t);
2212 attach->size = (size_t)t; 2290 attach->size = (size_t)t;
2213 DEBUG_EMAIL(("%i\n", attach->size)); 2291 DEBUG_EMAIL(("%i\n", attach->size));
2214 break; 2292 break;
2217 LIST_COPY(item->record_key, (char*)); 2295 LIST_COPY(item->record_key, (char*));
2218 item->record_key_size = list->items[x]->size; 2296 item->record_key_size = list->items[x]->size;
2219 DEBUG_EMAIL_HEXPRINT(item->record_key, item->record_key_size); 2297 DEBUG_EMAIL_HEXPRINT(item->record_key, item->record_key_size);
2220 DEBUG_EMAIL(("\n")); 2298 DEBUG_EMAIL(("\n"));
2221 break; 2299 break;
2222 case 0x1000: // PR_BODY Plain Text body 2300 case 0x1000: // PR_BODY
2223 DEBUG_EMAIL(("Plain Text body - "));
2224 MALLOC_EMAIL(item); 2301 MALLOC_EMAIL(item);
2225 LIST_COPY(item->email->body, (char*)); 2302 LIST_COPY(item->email->body, (char*));
2226 DEBUG_EMAIL(("%s\n", item->email->body)); 2303 item->email->body_was_unicode = (list->items[x]->type == 0x1f) ? 1 : 0;
2304 DEBUG_EMAIL(("Plain Text body %s - \n%s\n", (item->email->body_was_unicode) ? "unicode" : "sbcs",
2305 item->email->body));
2306 break;
2307 case 0x1001: // PR_REPORT_TEXT
2308 DEBUG_EMAIL(("Report Text - "));
2309 MALLOC_EMAIL(item);
2310 LIST_COPY(item->email->report_text, (char*));
2311 item->email->report_was_unicode = (list->items[x]->type == 0x1f) ? 1 : 0;
2312 DEBUG_EMAIL(("Report Text %s - \n%s\n", (item->email->report_was_unicode) ? "unicode" : "sbcs",
2313 item->email->report_text));
2227 break; 2314 break;
2228 case 0x1006: // PR_RTF_SYNC_BODY_CRC 2315 case 0x1006: // PR_RTF_SYNC_BODY_CRC
2229 DEBUG_EMAIL(("RTF Sync Body CRC - ")); 2316 DEBUG_EMAIL(("RTF Sync Body CRC - "));
2230 MALLOC_EMAIL(item); 2317 MALLOC_EMAIL(item);
2231 memcpy(&(item->email->rtf_body_crc), list->items[x]->data, sizeof(item->email->rtf_body_crc)); 2318 memcpy(&(item->email->rtf_body_crc), list->items[x]->data, sizeof(item->email->rtf_body_crc));
2269 MALLOC_EMAIL(item); 2356 MALLOC_EMAIL(item);
2270 memcpy(&(item->email->rtf_ws_trailing_count), list->items[x]->data, sizeof(item->email->rtf_ws_trailing_count)); 2357 memcpy(&(item->email->rtf_ws_trailing_count), list->items[x]->data, sizeof(item->email->rtf_ws_trailing_count));
2271 DEBUG_EMAIL(("%i\n", item->email->rtf_ws_trailing_count)); 2358 DEBUG_EMAIL(("%i\n", item->email->rtf_ws_trailing_count));
2272 break; 2359 break;
2273 case 0x1013: // HTML body 2360 case 0x1013: // HTML body
2274 DEBUG_EMAIL(("HTML body - "));
2275 MALLOC_EMAIL(item); 2361 MALLOC_EMAIL(item);
2276 LIST_COPY(item->email->htmlbody, (char*)); 2362 LIST_COPY(item->email->htmlbody, (char*));
2277 DEBUG_EMAIL(("%s\n", item->email->htmlbody)); 2363 item->email->htmlbody_was_unicode = (list->items[x]->type == 0x1f) ? 1 : 0;
2364 DEBUG_EMAIL(("HTML body %s - \n%s\n", (item->email->htmlbody_was_unicode) ? "unicode" : "sbcs",
2365 item->email->htmlbody));
2278 break; 2366 break;
2279 case 0x1035: // Message ID 2367 case 0x1035: // Message ID
2280 DEBUG_EMAIL(("Message ID - ")); 2368 DEBUG_EMAIL(("Message ID - "));
2281 MALLOC_EMAIL(item); 2369 MALLOC_EMAIL(item);
2282 LIST_COPY(item->email->messageid, (char*)); 2370 LIST_COPY(item->email->messageid, (char*));
2450 DEBUG_EMAIL(("%i [%#x]\n", item->folder->assoc_count, item->folder->assoc_count)); 2538 DEBUG_EMAIL(("%i [%#x]\n", item->folder->assoc_count, item->folder->assoc_count));
2451 break; 2539 break;
2452 case 0x3701: // PR_ATTACH_DATA_OBJ binary data of attachment 2540 case 0x3701: // PR_ATTACH_DATA_OBJ binary data of attachment
2453 DEBUG_EMAIL(("Binary Data [Size %i] - ", list->items[x]->size)); 2541 DEBUG_EMAIL(("Binary Data [Size %i] - ", list->items[x]->size));
2454 NULL_CHECK(attach); 2542 NULL_CHECK(attach);
2455 MOVE_NEXT(attach);
2456 if (!list->items[x]->data) { //special case 2543 if (!list->items[x]->data) { //special case
2457 attach->id2_val = list->items[x]->type; 2544 attach->id2_val = list->items[x]->type;
2458 DEBUG_EMAIL(("Seen a Reference. The data hasn't been loaded yet. [%#"PRIx64"][%#x]\n", 2545 DEBUG_EMAIL(("Seen a Reference. The data hasn't been loaded yet. [%#"PRIx64"][%#x]\n",
2459 attach->id2_val, list->items[x]->type)); 2546 attach->id2_val, list->items[x]->type));
2460 } else { 2547 } else {
2464 } 2551 }
2465 break; 2552 break;
2466 case 0x3704: // PR_ATTACH_FILENAME Attachment filename (8.3) 2553 case 0x3704: // PR_ATTACH_FILENAME Attachment filename (8.3)
2467 DEBUG_EMAIL(("Attachment Filename - ")); 2554 DEBUG_EMAIL(("Attachment Filename - "));
2468 NULL_CHECK(attach); 2555 NULL_CHECK(attach);
2469 MOVE_NEXT(attach);
2470 LIST_COPY(attach->filename1, (char*)); 2556 LIST_COPY(attach->filename1, (char*));
2471 DEBUG_EMAIL(("%s\n", attach->filename1)); 2557 DEBUG_EMAIL(("%s\n", attach->filename1));
2472 break; 2558 break;
2473 case 0x3705: // PR_ATTACH_METHOD 2559 case 0x3705: // PR_ATTACH_METHOD
2474 // 0 - No Attachment 2560 // 0 - No Attachment
2478 // 4 - Attach by ref only 2564 // 4 - Attach by ref only
2479 // 5 - Embedded Message 2565 // 5 - Embedded Message
2480 // 6 - OLE 2566 // 6 - OLE
2481 DEBUG_EMAIL(("Attachment method - ")); 2567 DEBUG_EMAIL(("Attachment method - "));
2482 NULL_CHECK(attach); 2568 NULL_CHECK(attach);
2483 MOVE_NEXT(attach);
2484 memcpy(&(attach->method), list->items[x]->data, sizeof(attach->method)); 2569 memcpy(&(attach->method), list->items[x]->data, sizeof(attach->method));
2485 LE32_CPU(attach->method); 2570 LE32_CPU(attach->method);
2486 t = attach->method; 2571 t = attach->method;
2487 DEBUG_EMAIL(("%s [%i]\n", (t==0?"No Attachment": 2572 DEBUG_EMAIL(("%s [%i]\n", (t==0?"No Attachment":
2488 (t==1?"Attach By Value": 2573 (t==1?"Attach By Value":
2492 (t==5?"Embedded Message":"OLE")))))),t)); 2577 (t==5?"Embedded Message":"OLE")))))),t));
2493 break; 2578 break;
2494 case 0x3707: // PR_ATTACH_LONG_FILENAME Attachment filename (long?) 2579 case 0x3707: // PR_ATTACH_LONG_FILENAME Attachment filename (long?)
2495 DEBUG_EMAIL(("Attachment Filename long - ")); 2580 DEBUG_EMAIL(("Attachment Filename long - "));
2496 NULL_CHECK(attach); 2581 NULL_CHECK(attach);
2497 MOVE_NEXT(attach);
2498 LIST_COPY(attach->filename2, (char*)); 2582 LIST_COPY(attach->filename2, (char*));
2499 DEBUG_EMAIL(("%s\n", attach->filename2)); 2583 DEBUG_EMAIL(("%s\n", attach->filename2));
2500 break; 2584 break;
2501 case 0x370B: // PR_RENDERING_POSITION 2585 case 0x370B: // PR_RENDERING_POSITION
2502 // position in characters that the attachment appears in the plain text body 2586 // position in characters that the attachment appears in the plain text body
2503 DEBUG_EMAIL(("Attachment Position - ")); 2587 DEBUG_EMAIL(("Attachment Position - "));
2504 NULL_CHECK(attach); 2588 NULL_CHECK(attach);
2505 MOVE_NEXT(attach);
2506 memcpy(&(attach->position), list->items[x]->data, sizeof(attach->position)); 2589 memcpy(&(attach->position), list->items[x]->data, sizeof(attach->position));
2507 LE32_CPU(attach->position); 2590 LE32_CPU(attach->position);
2508 DEBUG_EMAIL(("%i [%#x]\n", attach->position)); 2591 DEBUG_EMAIL(("%i [%#x]\n", attach->position));
2509 break; 2592 break;
2510 case 0x370E: // PR_ATTACH_MIME_TAG Mime type of encoding 2593 case 0x370E: // PR_ATTACH_MIME_TAG Mime type of encoding
2511 DEBUG_EMAIL(("Attachment mime encoding - ")); 2594 DEBUG_EMAIL(("Attachment mime encoding - "));
2512 NULL_CHECK(attach); 2595 NULL_CHECK(attach);
2513 MOVE_NEXT(attach);
2514 LIST_COPY(attach->mimetype, (char*)); 2596 LIST_COPY(attach->mimetype, (char*));
2515 DEBUG_EMAIL(("%s\n", attach->mimetype)); 2597 DEBUG_EMAIL(("%s\n", attach->mimetype));
2516 break; 2598 break;
2517 case 0x3710: // PR_ATTACH_MIME_SEQUENCE 2599 case 0x3710: // PR_ATTACH_MIME_SEQUENCE
2518 // sequence number for mime parts. Includes body 2600 // sequence number for mime parts. Includes body
2519 DEBUG_EMAIL(("Attachment Mime Sequence - ")); 2601 DEBUG_EMAIL(("Attachment Mime Sequence - "));
2520 NULL_CHECK(attach); 2602 NULL_CHECK(attach);
2521 MOVE_NEXT(attach);
2522 memcpy(&(attach->sequence), list->items[x]->data, sizeof(attach->sequence)); 2603 memcpy(&(attach->sequence), list->items[x]->data, sizeof(attach->sequence));
2523 LE32_CPU(attach->sequence); 2604 LE32_CPU(attach->sequence);
2524 DEBUG_EMAIL(("%i\n", attach->sequence)); 2605 DEBUG_EMAIL(("%i\n", attach->sequence));
2525 break; 2606 break;
2526 case 0x3A00: // PR_ACCOUNT 2607 case 0x3A00: // PR_ACCOUNT
3011 DEBUG_EMAIL(("Other Address Post Office box - ")); 3092 DEBUG_EMAIL(("Other Address Post Office box - "));
3012 MALLOC_CONTACT(item); 3093 MALLOC_CONTACT(item);
3013 LIST_COPY(item->contact->other_po_box, (char*)); 3094 LIST_COPY(item->contact->other_po_box, (char*));
3014 DEBUG_EMAIL(("%s\n", item->contact->other_po_box)); 3095 DEBUG_EMAIL(("%s\n", item->contact->other_po_box));
3015 break; 3096 break;
3097 case 0x3FDE: // PR_INTERNET_CPID
3098 MALLOC_EMAIL(item);
3099 memcpy(&(item->email->internet_cpid), list->items[x]->data, sizeof(item->email->internet_cpid));
3100 LE32_CPU(item->email->internet_cpid);
3101 t = item->email->internet_cpid;
3102 DEBUG_EMAIL(("Internet code page %i\n", (int)t));
3103 break;
3104 case 0x3FFD: // PR_MESSAGE_CODEPAGE
3105 MALLOC_EMAIL(item);
3106 memcpy(&(item->email->message_codepage), list->items[x]->data, sizeof(item->email->message_codepage));
3107 LE32_CPU(item->email->message_codepage);
3108 t = item->email->message_codepage;
3109 DEBUG_EMAIL(("Message code page %i\n", (int)t));
3110 break;
3016 case 0x65E3: // Entry ID? 3111 case 0x65E3: // Entry ID?
3017 DEBUG_EMAIL(("Entry ID - ")); 3112 DEBUG_EMAIL(("Entry ID - "));
3018 item->record_key = (char*) xmalloc(16+1); 3113 item->record_key = (char*) xmalloc(16+1);
3019 memcpy(item->record_key, &(list->items[x]->data[1]), 16); //skip first byte 3114 memcpy(item->record_key, &(list->items[x]->data[1]), 16); //skip first byte
3020 item->record_key[16]='\0'; 3115 item->record_key[16]='\0';
3023 break; 3118 break;
3024 case 0x67F2: // ID2 value of the attachments proper record 3119 case 0x67F2: // ID2 value of the attachments proper record
3025 DEBUG_EMAIL(("Attachment ID2 value - ")); 3120 DEBUG_EMAIL(("Attachment ID2 value - "));
3026 if (attach) { 3121 if (attach) {
3027 uint32_t tempid; 3122 uint32_t tempid;
3028 MOVE_NEXT(attach);
3029 memcpy(&(tempid), list->items[x]->data, sizeof(tempid)); 3123 memcpy(&(tempid), list->items[x]->data, sizeof(tempid));
3030 LE32_CPU(tempid); 3124 LE32_CPU(tempid);
3031 attach->id2_val = tempid; 3125 attach->id2_val = tempid;
3032 DEBUG_EMAIL(("%#"PRIx64"\n", attach->id2_val)); 3126 DEBUG_EMAIL(("%#"PRIx64"\n", attach->id2_val));
3033 } else { 3127 } else {
3521 list->items[x]->data = NULL; 3615 list->items[x]->data = NULL;
3522 } 3616 }
3523 } 3617 }
3524 x++; 3618 x++;
3525 } 3619 }
3526 x = 0;
3527 list = list->next; 3620 list = list->next;
3528 next = 1; 3621 if (attach) attach = attach->next;
3529 } 3622 }
3530 DEBUG_RET(); 3623 DEBUG_RET();
3531 return 0; 3624 return 0;
3532 } 3625 }
3533 3626
3556 3649
3557 void pst_free_id2(pst_index2_ll * head) { 3650 void pst_free_id2(pst_index2_ll * head) {
3558 pst_index2_ll *t; 3651 pst_index2_ll *t;
3559 DEBUG_ENT("pst_free_id2"); 3652 DEBUG_ENT("pst_free_id2");
3560 while (head) { 3653 while (head) {
3654 if (head->child) pst_free_id2(head->child);
3561 t = head->next; 3655 t = head->next;
3562 free (head); 3656 free(head);
3563 head = t; 3657 head = t;
3564 } 3658 }
3565 DEBUG_RET(); 3659 DEBUG_RET();
3566 } 3660 }
3567 3661
3613 } 3707 }
3614 DEBUG_RET(); 3708 DEBUG_RET();
3615 } 3709 }
3616 3710
3617 3711
3618 pst_index2_ll * pst_build_id2(pst_file *pf, pst_index_ll* list, pst_index2_ll* head_ptr) { 3712 pst_index2_ll * pst_build_id2(pst_file *pf, pst_index_ll* list) {
3619 pst_block_header block_head; 3713 pst_block_header block_head;
3620 pst_index2_ll *head = NULL, *tail = NULL; 3714 pst_index2_ll *head = NULL, *tail = NULL;
3621 uint16_t x = 0; 3715 uint16_t x = 0;
3622 char *b_ptr = NULL; 3716 char *b_ptr = NULL;
3623 char *buf = NULL; 3717 char *buf = NULL;
3624 pst_id2_assoc id2_rec; 3718 pst_id2_assoc id2_rec;
3625 pst_index_ll *i_ptr = NULL; 3719 pst_index_ll *i_ptr = NULL;
3626 pst_index2_ll *i2_ptr = NULL; 3720 pst_index2_ll *i2_ptr = NULL;
3627 DEBUG_ENT("pst_build_id2"); 3721 DEBUG_ENT("pst_build_id2");
3628 3722
3629 if (head_ptr) {
3630 head = head_ptr;
3631 while (head_ptr) head_ptr = (tail = head_ptr)->next;
3632 }
3633 if (pst_read_block_size(pf, list->offset, list->size, &buf) < list->size) { 3723 if (pst_read_block_size(pf, list->offset, list->size, &buf) < list->size) {
3634 //an error occured in block read 3724 //an error occured in block read
3635 WARN(("block read error occured. offset = %#"PRIx64", size = %#"PRIx64"\n", list->offset, list->size)); 3725 WARN(("block read error occured. offset = %#"PRIx64", size = %#"PRIx64"\n", list->offset, list->size));
3636 if (buf) free(buf); 3726 if (buf) free(buf);
3637 DEBUG_RET(); 3727 DEBUG_RET();
3654 list->id, block_head.count, list->offset)); 3744 list->id, block_head.count, list->offset));
3655 x = 0; 3745 x = 0;
3656 b_ptr = buf + ((pf->do_read64) ? 0x08 : 0x04); 3746 b_ptr = buf + ((pf->do_read64) ? 0x08 : 0x04);
3657 while (x < block_head.count) { 3747 while (x < block_head.count) {
3658 b_ptr += pst_decode_assoc(pf, &id2_rec, b_ptr); 3748 b_ptr += pst_decode_assoc(pf, &id2_rec, b_ptr);
3659 DEBUG_INDEX(("\tid2 = %#x, id = %#"PRIx64", table2 = %#"PRIx64"\n", id2_rec.id2, id2_rec.id, id2_rec.table2)); 3749 DEBUG_INDEX(("id2 = %#x, id = %#"PRIx64", table2 = %#"PRIx64"\n", id2_rec.id2, id2_rec.id, id2_rec.table2));
3660 if ((i_ptr = pst_getID(pf, id2_rec.id)) == NULL) { 3750 if ((i_ptr = pst_getID(pf, id2_rec.id)) == NULL) {
3661 DEBUG_WARN(("\t\t%#"PRIx64" - Not Found\n", id2_rec.id)); 3751 DEBUG_WARN(("%#"PRIx64" - Not Found\n", id2_rec.id));
3662 } else { 3752 } else {
3663 DEBUG_INDEX(("\t\t%#"PRIx64" - Offset %#"PRIx64", u1 %#"PRIx64", Size %"PRIi64"(%#"PRIx64")\n", 3753 DEBUG_INDEX(("%#"PRIx64" - Offset %#"PRIx64", u1 %#"PRIx64", Size %"PRIi64"(%#"PRIx64")\n",
3664 i_ptr->id, i_ptr->offset, i_ptr->u1, i_ptr->size, i_ptr->size)); 3754 i_ptr->id, i_ptr->offset, i_ptr->u1, i_ptr->size, i_ptr->size));
3665 // add it to the linked list 3755 // add it to the tree
3666 i2_ptr = (pst_index2_ll*) xmalloc(sizeof(pst_index2_ll)); 3756 i2_ptr = (pst_index2_ll*) xmalloc(sizeof(pst_index2_ll));
3667 i2_ptr->id2 = id2_rec.id2; 3757 i2_ptr->id2 = id2_rec.id2;
3668 i2_ptr->id = i_ptr; 3758 i2_ptr->id = i_ptr;
3669 i2_ptr->next = NULL; 3759 i2_ptr->child = NULL;
3760 i2_ptr->next = NULL;
3670 if (!head) head = i2_ptr; 3761 if (!head) head = i2_ptr;
3671 if (tail) tail->next = i2_ptr; 3762 if (tail) tail->next = i2_ptr;
3672 tail = i2_ptr; 3763 tail = i2_ptr;
3673 if (id2_rec.table2 != 0) { 3764 if (id2_rec.table2) {
3674 if ((i_ptr = pst_getID(pf, id2_rec.table2)) == NULL) { 3765 if ((i_ptr = pst_getID(pf, id2_rec.table2)) == NULL) {
3675 DEBUG_WARN(("\tTable2 [%#x] not found\n", id2_rec.table2)); 3766 DEBUG_WARN(("Table2 [%#x] not found\n", id2_rec.table2));
3676 } 3767 }
3677 else { 3768 else {
3678 DEBUG_INDEX(("\tGoing deeper for table2 [%#x]\n", id2_rec.table2)); 3769 DEBUG_INDEX(("Going deeper for table2 [%#x]\n", id2_rec.table2));
3679 if ((i2_ptr = pst_build_id2(pf, i_ptr, head))) { 3770 i2_ptr->child = pst_build_id2(pf, i_ptr);
3680 // DEBUG_INDEX(("pst_build_id2(): \t\tAdding new list onto end of current\n"));
3681 // if (!head)
3682 // head = i2_ptr;
3683 // if (tail)
3684 // tail->next = i2_ptr;
3685 // while (i2_ptr->next)
3686 // i2_ptr = i2_ptr->next;
3687 // tail = i2_ptr;
3688 }
3689 // need to re-establish tail
3690 DEBUG_INDEX(("Returned from depth\n"));
3691 if (tail) {
3692 while (tail->next) tail = tail->next;
3693 }
3694 } 3771 }
3695 } 3772 }
3696 } 3773 }
3697 x++; 3774 x++;
3698 } 3775 }
3747 SAFE_FREE(item->email->sentmail_folder); 3824 SAFE_FREE(item->email->sentmail_folder);
3748 SAFE_FREE(item->email->sentto_address); 3825 SAFE_FREE(item->email->sentto_address);
3749 if (item->email->subject) 3826 if (item->email->subject)
3750 SAFE_FREE(item->email->subject->subj); 3827 SAFE_FREE(item->email->subject->subj);
3751 SAFE_FREE(item->email->subject); 3828 SAFE_FREE(item->email->subject);
3829 SAFE_FREE(item->email->report_text);
3830 SAFE_FREE(item->email->report_time);
3831 SAFE_FREE(item->email->supplementary_info);
3752 free(item->email); 3832 free(item->email);
3753 } 3833 }
3754 if (item->folder) { 3834 if (item->folder) {
3755 free(item->folder); 3835 free(item->folder);
3756 } 3836 }
4010 DEBUG_RET(); 4090 DEBUG_RET();
4011 return ptr; 4091 return ptr;
4012 } 4092 }
4013 4093
4014 4094
4015 pst_index_ll * pst_getID2(pst_index2_ll *ptr, uint64_t id) { 4095 pst_index_ll *pst_getID2(pst_index2_ll *head, uint64_t id) {
4016 DEBUG_ENT("pst_getID2"); 4096 DEBUG_ENT("pst_getID2");
4017 DEBUG_INDEX(("Head = %p id = %#"PRIx64"\n", ptr, id)); 4097 DEBUG_INDEX(("looking for id = %#"PRIx64"\n", id));
4018 while (ptr && (ptr->id2 != id)) { 4098 pst_index2_ll *ptr = head;
4099 while (ptr) {
4100 if (ptr->id2 == id) break;
4101 if (ptr->child) {
4102 pst_index_ll *rc = pst_getID2(ptr->child, id);
4103 if (rc) {
4104 DEBUG_RET();
4105 return rc;
4106 }
4107 }
4019 ptr = ptr->next; 4108 ptr = ptr->next;
4020 } 4109 }
4021 if (ptr) { 4110 if (ptr) {
4022 if (ptr->id) {DEBUG_INDEX(("Found value %#"PRIx64"\n", ptr->id->id)); } 4111 if (ptr->id) {DEBUG_INDEX(("Found value %#"PRIx64"\n", ptr->id->id)); }
4023 else {DEBUG_INDEX(("Found value, though it is NULL!\n"));} 4112 else {DEBUG_INDEX(("Found value, though it is NULL!\n"));}
4024 DEBUG_RET(); 4113 DEBUG_RET();
4025 return ptr->id; 4114 return ptr->id;
4026 } 4115 }
4027 DEBUG_INDEX(("ERROR Not Found\n")); 4116 //DEBUG_INDEX(("ERROR Not Found\n"));
4028 DEBUG_RET(); 4117 DEBUG_RET();
4029 return NULL; 4118 return NULL;
4030 } 4119 }
4031 4120
4032 4121
4085 4174
4086 void pst_printID2ptr(pst_index2_ll *ptr) { 4175 void pst_printID2ptr(pst_index2_ll *ptr) {
4087 DEBUG_ENT("pst_printID2ptr"); 4176 DEBUG_ENT("pst_printID2ptr");
4088 while (ptr) { 4177 while (ptr) {
4089 DEBUG_INDEX(("%#"PRIx64" id=%#"PRIx64"\n", ptr->id2, (ptr->id ? ptr->id->id : (uint64_t)0))); 4178 DEBUG_INDEX(("%#"PRIx64" id=%#"PRIx64"\n", ptr->id2, (ptr->id ? ptr->id->id : (uint64_t)0)));
4179 if (ptr->child) pst_printID2ptr(ptr->child);
4090 ptr = ptr->next; 4180 ptr = ptr->next;
4091 } 4181 }
4092 DEBUG_RET(); 4182 DEBUG_RET();
4093 } 4183 }
4094 4184