diff src/getidblock.c @ 79:56fa05fd5271

Patch from Robert Simpson for encryption type 2. Fix the order of testing item types to avoid claiming there are multiple message stores.
author Carl Byington <carl@five-ten-sg.com>
date Fri, 13 Jun 2008 20:47:01 -0700
parents 987aa872294e
children 3ec5ad97e926
line wrap: on
line diff
--- a/src/getidblock.c	Tue Jun 10 14:28:55 2008 -0700
+++ b/src/getidblock.c	Fri Jun 13 20:47:01 2008 -0700
@@ -9,7 +9,7 @@
     // pass the id number to display on the command line
     char *fname, *sid;
     pst_file pstfile;
-    unsigned int id;
+    uint64_t id;
     int decrypt = 0, process = 0, binary = 0, c;
     char *buf = NULL;
     size_t readSize;
@@ -46,8 +46,8 @@
         exit(EXIT_FAILURE);
     }
     fname = argv[optind];
-    sid = argv[optind + 1];
-    id = (unsigned int) strtol(sid, NULL, 0);
+    sid   = argv[optind + 1];
+    id    = (uint64_t)strtoll(sid, NULL, 0);
 
     DEBUG_MAIN(("Opening file\n"));
     memset(&pstfile, 0, sizeof(pstfile));
@@ -73,7 +73,7 @@
         printf("Block %#x, size %#x[%i]\n", id, (unsigned int) readSize, (int) readSize);
 
     if (decrypt != 0)
-        if (pst_decrypt(buf, readSize, (int) pstfile.encryption) != 0) {
+        if (pst_decrypt(id, buf, readSize, (int) pstfile.encryption) != 0) {
             DIE(("Error decrypting block\n"));
         }