comparison src/libpst.c @ 231:fe64279df92b

patches from Chris White, Roberto Polli, Justin Greer
author Carl Byington <carl@five-ten-sg.com>
date Thu, 10 Sep 2009 15:21:23 -0700
parents 42b38d65f7e4
children 1d50ff3c5091
comparison
equal deleted inserted replaced
230:42b38d65f7e4 231:fe64279df92b
1258 1258
1259 if ((id2_ptr = pst_getID2(id2_head, (uint64_t)0x692))) { 1259 if ((id2_ptr = pst_getID2(id2_head, (uint64_t)0x692))) {
1260 // DSN/MDN reports? 1260 // DSN/MDN reports?
1261 DEBUG_INFO(("DSN/MDN processing\n")); 1261 DEBUG_INFO(("DSN/MDN processing\n"));
1262 list = pst_parse_block(pf, id2_ptr->id->i_id, id2_head); 1262 list = pst_parse_block(pf, id2_ptr->id->i_id, id2_head);
1263 if (!list) { 1263 if (list) {
1264 for (x=0; x < list->count_objects; x++) {
1265 attach = (pst_item_attach*) pst_malloc(sizeof(pst_item_attach));
1266 memset(attach, 0, sizeof(pst_item_attach));
1267 attach->next = item->attach;
1268 item->attach = attach;
1269 }
1270 if (pst_process(list, item, item->attach)) {
1271 DEBUG_WARN(("ERROR pst_process() failed with DSN/MDN attachments\n"));
1272 pst_freeItem(item);
1273 pst_free_list(list);
1274 if (!m_head) pst_free_id2(id2_head);
1275 DEBUG_RET();
1276 return NULL;
1277 }
1278 pst_free_list(list);
1279 } else {
1264 DEBUG_WARN(("ERROR error processing main DSN/MDN record\n")); 1280 DEBUG_WARN(("ERROR error processing main DSN/MDN record\n"));
1265 if (!m_head) pst_free_id2(id2_head); 1281 // if (!m_head) pst_free_id2(id2_head);
1266 DEBUG_RET(); 1282 // DEBUG_RET();
1267 return item; 1283 // return item;
1268 } 1284 }
1269 for (x=0; x < list->count_objects; x++) {
1270 attach = (pst_item_attach*) pst_malloc(sizeof(pst_item_attach));
1271 memset(attach, 0, sizeof(pst_item_attach));
1272 attach->next = item->attach;
1273 item->attach = attach;
1274 }
1275 if (pst_process(list, item, item->attach)) {
1276 DEBUG_WARN(("ERROR pst_process() failed with DSN/MDN attachments\n"));
1277 pst_freeItem(item);
1278 pst_free_list(list);
1279 if (!m_head) pst_free_id2(id2_head);
1280 DEBUG_RET();
1281 return NULL;
1282 }
1283 pst_free_list(list);
1284 } 1285 }
1285 1286
1286 if ((id2_ptr = pst_getID2(id2_head, (uint64_t)0x671))) { 1287 if ((id2_ptr = pst_getID2(id2_head, (uint64_t)0x671))) {
1287 DEBUG_INFO(("ATTACHMENT processing attachment\n")); 1288 DEBUG_INFO(("ATTACHMENT processing attachment\n"));
1288 list = pst_parse_block(pf, id2_ptr->id->i_id, id2_head); 1289 list = pst_parse_block(pf, id2_ptr->id->i_id, id2_head);
1590 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); 1591 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7);
1591 DEBUG_RET(); 1592 DEBUG_RET();
1592 return NULL; 1593 return NULL;
1593 } 1594 }
1594 1595
1595 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, table_rec.value, &block_offset5)) { 1596 if (table_rec.value > 0) {
1596 DEBUG_WARN(("internal error (7c.b5.desc offset %#x) in reading block id %#"PRIx64"\n", table_rec.value, block_id)); 1597 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, table_rec.value, &block_offset5)) {
1597 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); 1598 DEBUG_WARN(("internal error (7c.b5.desc offset %#x) in reading block id %#"PRIx64"\n", table_rec.value, block_id));
1598 DEBUG_RET(); 1599 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7);
1599 return NULL; 1600 DEBUG_RET();
1600 } 1601 return NULL;
1601 1602 }
1602 // this will give the number of records in this block 1603
1603 num_mapi_objects = (block_offset5.to - block_offset5.from) / (4 + table_rec.ref_type); 1604 // this will give the number of records in this block
1604 1605 num_mapi_objects = (block_offset5.to - block_offset5.from) / (4 + table_rec.ref_type);
1605 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, seven_c_blk.ind2_offset, &block_offset6)) { 1606
1606 DEBUG_WARN(("internal error (7c.ind2 offset %#x) in reading block id %#"PRIx64"\n", seven_c_blk.ind2_offset, block_id)); 1607 if (pst_getBlockOffsetPointer(pf, i2_head, &subblocks, seven_c_blk.ind2_offset, &block_offset6)) {
1607 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); 1608 DEBUG_WARN(("internal error (7c.ind2 offset %#x) in reading block id %#"PRIx64"\n", seven_c_blk.ind2_offset, block_id));
1608 DEBUG_RET(); 1609 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7);
1609 return NULL; 1610 DEBUG_RET();
1610 } 1611 return NULL;
1611 ind2_ptr = block_offset6.from; 1612 }
1612 ind2_end = block_offset6.to; 1613 ind2_ptr = block_offset6.from;
1614 ind2_end = block_offset6.to;
1615 }
1616 else {
1617 num_mapi_objects = 0;
1618 }
1613 DEBUG_INFO(("7cec block index2 pointer %#x and end %#x\n", ind2_ptr, ind2_end)); 1619 DEBUG_INFO(("7cec block index2 pointer %#x and end %#x\n", ind2_ptr, ind2_end));
1614 } 1620 }
1615 else { 1621 else {
1616 DEBUG_WARN(("ERROR: Unknown block constant - %#hx for id %#"PRIx64"\n", block_hdr.type, block_id)); 1622 DEBUG_WARN(("ERROR: Unknown block constant - %#hx for id %#"PRIx64"\n", block_hdr.type, block_id));
1617 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7); 1623 freeall(&subblocks, &block_offset1, &block_offset2, &block_offset3, &block_offset4, &block_offset5, &block_offset6, &block_offset7);